安装脚本7.0.5版本
在线安装脚本,默认版本号是7.0.5,可以根据需要选择需要的版本进行下载编译安装
sudo apt-get install gcc -y
sudo apt-get install pkg-config -y
sudo apt-get install build-essential -y#安装redis
rm -rf ./tmp.log
systemctl status redisd > ./tmp.log
if cat tmp.log |grep "running"
thenecho -e "\033[32m redisd服务已经启动! \033[0m"
elsetouch install_redis.shcat > install_redis.sh <<EOFmkdir -p /home/zenglg/redis/cd /home/zenglg/redis/wget http://download.redis.io/releases/redis-7.0.5.tar.gztar zxvf redis-7.0.5.tar.gzrm -rf /usr/local/redis-7.0.5cp -r redis-7.0.5 /usr/local/sudo apt-get install makecd /usr/local/redis-7.0.5 && make && make install#修改配置文件sed -i '309s/daemonize no/daemonize yes/' /usr/local/redis-7.0.5/redis.conf sed -i '87s/bind 127.0.0.1 -::1/#bind 127.0.0.1 -::1/' /usr/local/redis-7.0.5/redis.conf sed -i '111s/protected-mode yes/protected-mode no/' /usr/local/redis-7.0.5/redis.conf#设置密码sed -i '1036s/# requirepass foobared/requirepass Zenglg2012!@#/' /usr/local/redis-7.0.5/redis.conf#创建文件mkdir -p /etc/redischmod -R 777 /etc/redis#(在默认的配置文件路劲中放置配置文件)rm -rf /etc/redis/6379.conf cp -r /usr/local/redis-7.0.5/redis.conf /etc/redis/chmod -R 777 /etc/redis/redis.conf#修改文件名mv /etc/redis/redis.conf /etc/redis/6379.confrm -rf /etc/init.d/redisd#添加配置密码验证,解决无法关闭redis服务问题sed -i 17c'\$CLIEXEC -a "Zenglg2012!@#" -p \$REDISPORT shutdown' /usr/local/redis-7.0.5/utils/redis_init_scriptcp -r /usr/local/redis-7.0.5/utils/redis_init_script /etc/init.d/#修改文件名mv /etc/init.d/redis_init_script /etc/init.d/redisd#设置开机自启sudo chmod +x /etc/init.d/redisdsudo update-rc.d redisd defaults
EOFsh install_redis.sh
fi#查看redis状态
systemctl start redisd
systemctl enable redisdrm -rf ./tmp.log
systemctl status redisd > ./tmp.log
if cat tmp.log |grep "running"
thenecho -e "\033[32m redisd服务已经启动! \033[0m"
elseecho -e "\033[31m redisd服务未安装! \033[0m"
fi
安装成功
最新版本安装7.2.3
查看最新版本为7.2.3
Index of /releases/ (redis.io)
安装脚本,跟之前版本相比
sudo apt-get install gcc -y
sudo apt-get install pkg-config -y
sudo apt-get install build-essential -y#安装redis
rm -rf ./tmp.log
systemctl status redisd > ./tmp.log
if cat tmp.log |grep "running"
thenecho -e "\033[32m redisd服务已经启动! \033[0m"
elsetouch install_redis.shcat > install_redis.sh <<EOFmkdir -p /home/zenglg/redis/cd /home/zenglg/redis/wget http://download.redis.io/releases/redis-7.2.3.tar.gz tar zxvf redis-7.2.3.tar.gzrm -rf /usr/local/redis-7.2.3cp -r redis-7.2.3 /usr/local/sudo apt-get install makecd /usr/local/redis-7.2.3&& make && make install#修改配置文件sed -i '309s/daemonize no/daemonize yes/' /usr/local/redis-7.2.3/redis.conf sed -i '87s/bind 127.0.0.1 -::1/#bind 127.0.0.1 -::1/' /usr/local/redis-7.2.3/redis.conf sed -i '111s/protected-mode yes/protected-mode no/' /usr/local/redis-7.2.3/redis.conf#设置密码sed -i '1036s/# requirepass foobared/requirepass Zenglg2012!@#/' /usr/local/redis-7.2.3/redis.conf#创建文件mkdir -p /etc/redischmod -R 777 /etc/redis#(在默认的配置文件路劲中放置配置文件)rm -rf /etc/redis/6379.conf cp -r /usr/local/redis-7.2.3/redis.conf /etc/redis/chmod -R 777 /etc/redis/redis.conf#修改文件名mv /etc/redis/redis.conf /etc/redis/6379.confrm -rf /etc/init.d/redisd#添加配置密码验证,解决无法关闭redis服务问题sed -i 17c'\$CLIEXEC -a "Zenglg2012!@#" -p \$REDISPORT shutdown' /usr/local/redis-7.2.3/utils/redis_init_scriptcp -r /usr/local/redis-7.2.3/utils/redis_init_script /etc/init.d/#修改文件名mv /etc/init.d/redis_init_script /etc/init.d/redisd#设置开机自启sudo chmod +x /etc/init.d/redisdsudo update-rc.d redisd defaults
EOFsh install_redis.sh
fi#查看redis状态
systemctl start redisd
systemctl enable redisdrm -rf ./tmp.log
systemctl status redisd > ./tmp.log
if cat tmp.log |grep "running"
thenecho -e "\033[32m redisd服务已经启动! \033[0m"
elseecho -e "\033[31m redisd服务未安装! \033[0m"
fi
编译成功
通过客户端可以看到redis的版本
客户端登录查看是否正常
客户端下载
AnotherRedisDesktopManager 发行版 - Gitee.com
redis客户端使用
输入信息
点击下面按钮
出现下图说明链接成功