1. Enter the /usr/local directory; download the redis package
wget https://download.redis.io/releases/redis-5.0.14.tar.gz
Two, install gcc
yum install gcc-c++
3. Unzip, enter the directory, compile
tar -xvf redis-5.0.14.tar.gz
cd redis-5.0.14
make ##If an error is reported zmalloc.h:50:31: Fatal error: jemalloc/jemalloc.h, you need to execute make MALLOC=libc
make
make install
Fourth, copy the configuration file of redis
cp /usr/local/redis-5.0.14/redis.conf /etc/redis.conf
Five, modify the configuration file
vi /etc/redis.conf
daemonize yes # daemon running
bind 127.0.0.1 59.1.1.135 59.1.1.140 #Remote specified ip link multiple ip space separated
requirepass 123pwd #Set access password
6. Self-starting at boot
disk cp /usr/local/redis-5.0.14/utils/redis_init_script /etc/init.d/redis
Edit the file copied in the previous step
vi /etc/init.d/redis
1. Modify the path conf of the redis.conf file used when starting redis manually
2. If the access password is set for stopsheredis, the method that needs to be modified is just to add the password
Change $CLIEXEC -p $REDISPORT shutdown to:
$CLIEXEC -p $REDISPORT -a 123pwd shutdown
Seven, open the firewall port
firewall-cmd --list-ports
firewall-cmd --zone=public --add-port=6379/tcp --permanent
firewall-cmd --reload