yum update -y
cd export/install tar -zxvf redis-6.2.1.tar.gz
//安装c++yum install gcc-c++ -y//查看版本gcc -v
cd redis-6.2.1make
make install
make install PREFIX=/usr/local/redis//后面的是你想要安装的路径
cd /cd usr/local/bin./redis-server
cd /cd export/install/redis-6.2.1cp redis.conf /usr/local/bin/7.1. Modify the configuration file
cd /cd usr/local/bin vim redis.conf
./redis-server redis.conf
ps aux|grep redis
##8. Close the service
./redis-cli shutdown
#Test:It is correct that pong appears.
Exit
./redis-server redis.conf ./redis-cli
10. Start remote connection
Firewall allows.
quit
firewall-cmd --zone=public --add-port=6379/tcp --permanent firewall-cmd --reload
Remember to restart the service after modifying it.
修改redis.conf 文件,protected-mode 要设置成no。//如果需要设置密码requirepass 空格后面跟设置的密码修改redis.conf 文件,将 bind 127.0.0.1 修改成bind * -::* 或者直接将bind这一行注释掉
Link redis with other ip addresses
The ip here is changed according to the ip address you want to link to
redis-cli -h 127.0.0.1 -p 6379 shutdown # 干掉redis服务器(比较暴力,谨慎使用) sudo kill -9 pid 进程号
./redis-cli -h 192.168.10.20 -p 6379
The above is the detailed content of How to install and configure Redis in Centos7. For more information, please follow other related articles on the PHP Chinese website!