Linux 安裝redis6.0.9
阿新 • • 發佈:2022-05-18
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 (報錯)
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 #重新啟動服務