1 下载安装包并解压
官网:https://download.redis.io
下载安装包:
wget https://download.redis.io/redis-stable.tar.gz
解压
tar -zxvf redis-stable.tar.gz*
2 安装
安装
cd redis-stable
make install PREFIX=/opt/install/redis6
设置环境变量
vi /etc/profile
export REDIS_HOME=<font color="red">/opt/install/redis6</font>
export PATH=$PATH:$REDIS_HOME/bin
环境变量生效
source /etc/profile
安装服务
cd utils
./install_server.sh
如果报如下错误:
执行下面步骤
vi ./install_server.sh
#bail if this system is managed by systemd
#_pid_1_exe="$(readlink -f /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
再次执行:.
/install_server.sh
Redis服务状态/启动/停止: service redis_6379 status/start/stop