installation method
1. Compile and install the offline installation package
1. Upload the redis compressed package to the server/opt via Xftp
2. Unzip to /usr/local/
tar -zxvf redis-4.0.11.tar.gz -C /usr/local/
3. Install gcc dependencies
yum -y install gcc
4. Enter the redis directory and execute make
make
5. Continue to execute make install
make install
6. Start redis
- front-end startup
//在redis/src目录执行启动指令,出现如图即启动成功
redis-server
2. Background start
//在redis根目录执行
redis-server redis.conf >>/dev/null &
Set up autostart
1. First configure redis.conf to enable background startup. Then create a new system service file (redis.service) and write the following content into the file
vim /etc/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
# 这行配置内容要根据redis的安装目录自定义redis-server,redis.conf路径
ExecStart=/usr/local/redis-4.0.11/src/redis-server /usr/local/redis-4.0.11/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target #执行指令
2. Set redis to boot automatically
1. systemctl daemon-reload
2. systemctl enable redis
3. Start the redis service
systemctl start redis
4. Other common commands
systemctl status redis //查看redis状态
systemctl stop redis //关闭redis
systemctl restart redis //重启redis
Two, yum installation
1. Download the epel repository
yum install epel-release -y
2. Download redis database
yum install redis -y
3. Start the redis service
systemctl start redis
4. Other common commands
1. systemctl status redis //查看redis状态
2. systemctl stop redis //关闭redis
3. systemctl restart redis //重启redis
Check the version and the path of each file
1. View version
rpm -qa | grep redis
2. View the path of each file
1. rpm -qa | grep redis
2. rpm -ql redis-3.2.12-2.el7.x86_64