Tutorial 7: Centos7.7 installation redis tutorial

Install Redis tutorial

Reference: https://www.cnblogs.com/heqiuyong/p/10463334.html

Step 1: Download the redis installation package

wget http://download.redis.io/releases/redis-5.0.3.tar.gz

Step 2: Unzip the compressed package

tar -zxvf redis-4.0.6.tar.gz

The third step: yum install gcc dependency

# yum -y install gcc

Step 4: Jump to the redis decompression directory

cd /opt/redis-5.0.7/

Step 5: Compile and install

make

The sixth step, install and specify the installation directory

make install PREFIX=/usr/local/redis

The seventh step, start the service

7.1 Foreground start

cd /usr/local/redis/bin/
./redis-server

7.2 Background startup

从 redis 的源码目录中复制 redis.conf 到 redis 的安装目录
]# cp /opt/redis-5.0.7/redis.conf /usr/local/redis/bin/
修改 redis.conf 文件,把 daemonize no 改为 daemonize yes
bin]# vi redis.conf

Specify background startup file

bin]# ./redis-server redis.conf

The eighth step, close the redis process

View redis process

ps -ef | grep redis

kill the process

The ninth step, set up boot

Add boot service

bin] # vi /etc/systemd/system/redis.service

[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
设置开机启动
[root@localhost bin]# systemctl daemon-reload
[root@localhost bin]# systemctl start redis.service
[root@localhost bin]# systemctl enable redis.service

The tenth step, create a soft link

服务操作命令
systemctl start redis.service   #启动redis服务
systemctl stop redis.service   #停止redis服务
systemctl restart redis.service   #重新启动服务
systemctl status redis.service   #查看服务当前状态
systemctl enable redis.service   #设置开机自启动
systemctl disable redis.service   #停止开机自启动

Restart test

Guess you like

Origin blog.csdn.net/qq_42476834/article/details/106033330