下载安装
1 2 3
| wget http://download.redis.io/releases/redis-6.0.6.tar.gz tar xzf redis-6.0.6.tar.gz mv redis-6.0.6 /usr/local/redis
|
安装编译时需要的软件
1
| yum -y install gcc automake autoconf libtool make
|
安装gcc
1 2 3 4 5 6 7 8 9 10 11 12
|
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile source /etc/profile
|
安装atomic库
1 2 3 4 5
| find / -name "libatomic.so*"
yum -y install *atomic* --skip-broken
|
编译:
1 2
| make make install PREFIX=/usr/local/redis
|
前台运行
1
| ./bin/redis-server redis.conf
|
后台运行配置:修改redis.conf中daemonize no改为daemonize yes
注释bind 127.0.0.1
保护模式关闭
添加linux服务
1 2
| vi /etc/systemd/system/redis.service
|
1 2 3 4 5 6 7 8 9 10 11 12
| [Unit] Description=redis-server After=network.target
[Service] Type=forking ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf PrivateTmp=true
[Install] WantedBy=multi-user.target
|
命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| systemctl daemon-reload
systemctl stop redis.service
systemctl start redis.service
systemctl status redis.service
systemctl restart redis.service
systemctl enable redis.service
|