安装:
1. 下载
wget http://download.redis.io/releases/redis-4.0.2.tar.gz
2. 解压
tar -zxvf redis-4.0.2.tar.gz
3. 安装
cd redis-4.0.2
make
cd src
make install
加入开机启动:
1. 创建目录
mkdir /usr/local/redis
2. 拷贝
cp redis-4.0.2/src/redis-server /usr/local/redis
cp redis-4.0.2/src/redis-cli /usr/local/redis
cp redis-4.0.2/src/redis.conf /usr/local/redis
3. 修改配置文件redis.conf
daemonize yes
#bind 127.0.0.14.创建服务文件redis.service
sudo vim /usr/lib/systemd/system/redis.service5.写入如下内容到redis.service,具体文件路径,各异。
[Unit]
Description=Redis
After=syslog.target network.target remote-fs.target nss-lookup.target[Service]
Type=forking
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/redis/redis-server /usr/local/redis/redis.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true[Install]
WantedBy=multi-user.target6.重载系统服务
sudo systemctl daemon-reload
7.启动redis
sudo systemctl start redis