下载
mkdir /usr/local/redis
cd /usr/local/redis
wget http://download.redis.io/releases/redis-stable.tar.gz
tar -zxvf redis-stable.tar.gz
cd redis-stable
make
cd src
make install PREFIX=/usr/local/redis
//上面命令安装完成之后在/usr/local/redis会多一个bin目录
cd /usr/local/redis
mkdir etc
cp /usr/local/redis/redis-stable/redis.conf /usr/local/redis/etc/
启动
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
配置
守护进程方式启动:
vi /usr/local/redis/etc/redis.conf
修改daemonize yes即可
添加环境变量
vi /etc/profile
在末尾追加
PATH=$PATH:/usr/local/redis/bin
export PATH
让配置生效
source /etc/profile
这个时候就可以直接通过redis-cli命令操作了
redis-cli