first step
- Download the redis installation package
- You can go to the following address to view the version, redis download address
- Enter the directory where you want to download the installation package (this article is in the **/usr/local/redis** directory), execute the statement to start downloading
wget http://download.redis.io/releases/redis-5.0.8.tar.gz
Second step
- Give operation authority,
777
representing all authority ( some systems may not need it )
chmod 777 redis-5.0.8.tar.gz
- Unzip
tar -zxvf redis-5.0.8.tar.gz
third step
- yum installs gcc dependency ( if you have installed it before, you can ignore this operation )
yum install gcc
the fourth step
- Enter the decompression directory, install and compile
make
make install
the fifth step
- Modify the configuration file and start redis
- Copy redis.conf as a configuration file ( generally not modify the original file, so as to avoid the error being unrecoverable )
cp redis.conf redis01.conf
vim redis.conf
- Modify the following content
- Will be
daemonize no
modified todaemonize yes
indicate that it can be started in the background. If you want to connect remotely, change the ip to your public network or 0.0.0.0, simple and rude! - Enter the src directory to specify the configuration file to start
cd src
./redis-server /usr/local/redis/redis-5.0.8/redis.conf
- View process
ps -ef | grep redis
Sixth step
- Set boot up automatically (see personal favorite)
- In
/etc
New redis directory directory
mkdir -p redis
- Copy the /usr/local/redis/redis-5.0.8/redis.conf file to the /etc/redis directory and name it 6379.conf
cp /usr/local/redis/redis-5.0.8/redis.conf /etc/redis/6379.conf
- Copy the redis startup script and place it in the /etc/init.d directory
cp /usr/local/redis/redis-5.0.8/utils/redis_init_script /etc/init.d/redisd
- Enter the
/etc/init.d
directory, modify the file
vim redisd
- Add the following content: The comment means that the redis service must be started or closed at run levels 2, 3, 4, and 5. The start priority is 90, and the shutdown priority is 10. Save and exit
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
- Execute boot command
chkconfig redisd on
Seventh step
- The test starts with the service name
service redisd start
- If it appears: /var/run/redis_6379.pid exists, process is already running or crashed , execute the following command and then re-execute the above command.
rm -rf /var/run/redis_6379.pid
service redisd start
- shut down
service redisd stop
- Test connection