安装脚本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"
then
echo -e "\033[32m redisd服务已经启动! \033[0m"
else
touch install_redis.sh
cat > install_redis.sh <<EOF
mkdir -p /home/zenglg/redis/
cd /home/zenglg/redis/
wget http://download.redis.io/releases/redis-7.0.5.tar.gz
tar zxvf redis-7.0.5.tar.gz
rm -rf /usr/local/redis-7.0.5
cp -r redis-7.0.5 /usr/local/
sudo apt-get install make
cd /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/redis
chmod -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.conf
rm -rf /etc/init.d/redisd
#添加配置密码验证,解决无法关闭redis服务问题
sed -i 17c'\$CLIEXEC -a "Zenglg2012!@#" -p \$REDISPORT shutdown' /usr/local/redis-7.0.5/utils/redis_init_script
cp -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/redisd
sudo update-rc.d redisd defaults
EOF
sh install_redis.sh
fi
#查看redis状态
systemctl start redisd
systemctl enable redisd
rm -rf ./tmp.log
systemctl status redisd > ./tmp.log
if cat tmp.log |grep "running"
then
echo -e "\033[32m redisd服务已经启动! \033[0m"
else
echo -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"
then
echo -e "\033[32m redisd服务已经启动! \033[0m"
else
touch install_redis.sh
cat > install_redis.sh <<EOF
mkdir -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.gz
rm -rf /usr/local/redis-7.2.3
cp -r redis-7.2.3 /usr/local/
sudo apt-get install make
cd /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/redis
chmod -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.conf
rm -rf /etc/init.d/redisd
#添加配置密码验证,解决无法关闭redis服务问题
sed -i 17c'\$CLIEXEC -a "Zenglg2012!@#" -p \$REDISPORT shutdown' /usr/local/redis-7.2.3/utils/redis_init_script
cp -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/redisd
sudo update-rc.d redisd defaults
EOF
sh install_redis.sh
fi
#查看redis状态
systemctl start redisd
systemctl enable redisd
rm -rf ./tmp.log
systemctl status redisd > ./tmp.log
if cat tmp.log |grep "running"
then
echo -e "\033[32m redisd服务已经启动! \033[0m"
else
echo -e "\033[31m redisd服务未安装! \033[0m"
fi
编译成功
通过客户端可以看到redis的版本
客户端登录查看是否正常
客户端下载
AnotherRedisDesktopManager 发行版 - Gitee.com
redis客户端使用
输入信息
点击下面按钮
出现下图说明链接成功