1. start with the official website to find the latest stable version of the download link. Currently 5.0.7. Execute the following commands to download and install
Enter the installation directory #
cd / usr / local # Download the installation package, if not wget installed, execute yum install wget wget HTTP: // download.redis.io/releases/redis-5.0.7.tar.gz
# unpack
tar -zxvf Redis-5.0.7.tar.gz
# install the package if the wrong cc: cammand not find, the first implementation yum gcc install
cd redis-5.0.7
the make MALLOC = libc
# redis run to see if the installation was successful, if you see the following screen is installed successfully, ctrl + z to exit
cd src
./redis-server
2. Allow background redis set to start
Redis modify configuration files in the directory redis.conf. This file is in the installation directory, I was /usr/local/redis-5.0.7/redis.conf. Daemonize set to yes.
daemonize yes
redis default password is not necessary, and the way we add a password, add a line within the redis.conf, the password is set to password (needs its own set)
requirepass=password
Restart the service, and the use of execution redis-cli script in the src directory into the redis command line, then use the auth password authorization
./redis-cli
3. redis set to boot from Kai
Edit the file # vim /usr/lib/systemd/system/redis.service # Add the following file and save it in redis.service ########################## [Unit] Description=Redis-5.0.7-6379 After=network.target [Service] Type=forking PIDfile=/var/run/redis-6379.pid ExecStart=/usr/local/redis-5.0.7/src/redis-server /usr/local/redis-5.0.7/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target ###########################
# load service
systemctl daemon-reload
Execute the following command to see whether to add service
# Start services through redis systemctl start redis # Is there a process to retrieve the redis ps -ef | grip Redis
Finally, execute this command will redis service is set to boot from the start. Restart centos system then use the ps command to check the settings or redis-cli success
systemctl enable redis