1.下载redis安装包
wget http://download.redis.io/redis-stable.tar.gz
2. 解压
tar –zxvf redis-stable.tar.gz
3.编译、安装
cd redis-stable
make
make install
可查看,/usr/local/bin下已有这些文件,并新建redis.conf,可从包copy过来
4.添加开机启动
vi /etc/systemd/system/redis-server.service
[Unit]
Description=The redis-server Process Manager
After=syslog.target network.target
[Service]
Type=simple
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/bin/redis-server /usr/local/bin/redis.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID
[Install]
WantedBy=multi-user.target
5.设置开机启动
systemctl daemon-reload
systemctl start redis-server.service
systemctl enable redis-server.service