Linux 安装redis6.0.9
1.升级gcc
# 升级到gcc 9.3: yum -y install centos-release-scl yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils scl enable devtoolset-9 bash # 需要注意的是scl命令启用只是临时的,退出shell或重启就会恢复原系统gcc版本。 # 如果要长期使用gcc 9.3的话: echo -e "\nsource /opt/rh/devtoolset-9/enable" >>/etc/profile
2.下载安装
cd /usr/local/ wget http://download.redis.io/releases/redis-6.0.9.tar.gz tar -zxvf redis-6.0.9.tar.gz -C /user/local/ cd /user/local/redis-6.0.9/
make
make test (报错)
make install PREFIX=/data/program/redis
cp redis.conf /etc/redis/redis.conf
3.安装tcl
wget http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz tar xzvf tcl8.6.1-src.tar.gz -C /usr/local/ cd /usr/local/tcl8.6.1/unix/ ./configure make make install
4.继续测试 结果是ok的(make text)
5.安装
# cd /data/program/redis-6.2.4/utils/ ./install_server.sh
结果:
解决办法:将 install_server.sh 修改:
#_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 #unset _pid_1_exe 将这些注释掉
6.继续执行 ./install_server.sh
箭头中的两个进行 了覆盖
7.最后记得关闭
注意,运行install_server脚本后,默认会启动一个redis实例,我们可以通过下面命令关闭。 1. redis-cli shutdown 2. redis-cli -p 6379 shutdown
8.可以执行的命令
# systemctl stop redis_6379 # systemctl status redis_6379 # systemctl start redis_6379 # systemctl enable redis_6379.service #设置开机自启动 # systemctl disable redis_6379.service #停止开机自启动 # systemctl restart redis_6379.service #重新启动服务
9.注意
记得修改/etc/redis/redis.conf 中bind ip 修改为机器地址