1.获取redis
wget http://download.redis.io/releases/redis-6.2.7.tar.gz
tar -xvf redis-6.2.7.tar.gz
2.安装
cd redis-6.2.7
make
cd src
(生成bin目录到/usr/local/redis)
make install PREFIX=/usr/local/redis
3.移动配置文件到etc
cd ../
mkdir /usr/local/redis/etc
mv redis.conf /usr/local/redis/etc
4.配置后台启动
vi /usr/local/redis/etc/redis.conf //将daemonize no 改成daemonize yes
5.配置开机启动(个人感觉没有必要)
//在里面添加内容:/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf (意思就是开机调用这段开启redis的命令)
vi /etc/rc.local
6.启动redis
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
7.将redis-cli,redis-server拷贝到bin下,让redis-cli指令可以在任意目录下直接使用(没有)
cp /usr/local/redis/bin/redis-server /usr/local/bin/
cp /usr/local/redis/bin/redis-cli /usr/local/bin/