-
安装包下载
wget https://download.redis.io/releases/redis-6.2.7.tar.gz
-
解压
tar -zxvf redis-6.2.7.tar.gz
-
编译
# redis解压目录执行make make
此时可能会报错cc not found,此时需要执行步骤4安装gcc
-
安装gcc
yum install gcc
-
再次编译,此时可能会报错,需要先clean
# 清理 make distclean # 编译 make
-
将redis安装成操作系统的服务
(1)安装redis命令make install PREFIX=/opt/redis
(2)配置环境变量,vim /etc/profile,添加
export REDIS_HOME=/opt/redis export PATH=$PATH:$REDIS_HOME/bin
(3)加载环境变量source /etc/profile
(4)安装服务
# 进入redis的utils目录 cd utils # 执行install_server.sh ./install_server.sh
(5)此时报错,需要注释install_server.sh中如下代码
#bail if this system is managed by systemd
#_pid_1_exe=“KaTeX parse error: Expected 'EOF', got '#' at position 28: … /proc/1/exe)" #̲if [ "{_pid_1_exe##*/}” = systemd ]
#then
#echo “This systems seems to use systemd.”
#echo “Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!”
#exit 1
#fi
(6)重新安装,执行./install_server.sh
,一路回车,至此redis服务安装完成 -
验证,进入
/etc/init.d
目录可以看到redis_6379
-
查看redis服务状态
service redis_6379 status
redis安装
最新推荐文章于 2024-01-27 18:56:40 发布