Linux下安装Redis
-
下载Redis:
wget http://download.redis.io/releases/redis-4.0.8.tar.gz
(没有wget命令的话执行yum安装:yum -y install wget
) -
解压安装包:
tar -zvxf redis-4.0.8.tar.gz
-
进入解压目录,编译和安装:
make
,,,,cd src
,,,make install PREFIX=/usr/local/redis
-
创建etc文件夹:
cd /usr/local/redis/
,,,mkdir etc
; -
复制Redis.conf文件到安装目录etc下:
cp /redis-4.0.8/redis.conf /usr/local/redis/etc
; -
配置redis为后台启动:
vi /usr/local/redis/etc/redis.conf
修改 daemonize no 字段值为 yes ; -
将redis加入到开机启动:
vi /etc/rc.local
添加如下内容 /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf ; -
开启Redis:
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
常用命令
-
启动Redis:
redis-server /usr/local/redis/etc/redis.conf
; -
pkill redis
//停止redis -
卸载Redis:
rm -rf /usr/local/redis
;rm -rf /usr/bin/redis-*
;rm -rf /root/download/redis-4.0.4
。