1、環境檢查
yum -y install gcc
yum -y install epel-release
# 檢視gcc版本是否在5.3以上,centos7.6預設安裝4.8.5
gcc -v
# 更新gcc到5.3及以上,如下:
更新到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
#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 "source /opt/rh/devtoolset-9/enable" >>/etc/profile
這樣退出shell重新打開就是新版的gcc了
準備Redis安裝包
wget https://download.redis.io/releases/redis-6.0.10.tar.gz
-bash: wget: 未找到指令
rpm 安裝
下載下傳wget的RPM包:
# http://mirrors.163.com/centos/6.8/os/x86_64/Packages/wget-1.12-8.el6.x86_64.rpm
# 執行
rpm -ivh wget-1.12-8.el6.x86_64.rpm
yum安裝
yum -y install wget
下載下傳Redis6 壓縮包
wget https://download.redis.io/releases/redis-6.0.10.tar.gz
複制redis-6.0.10.tar.gz 到 指定目錄 /usr/local/redis
解壓redis tar -zxvf redis-6.0.10.tar.gz
編譯安裝:進入redis-6.0.10目錄編譯 make && make install
試運作一把:
進入src目錄 cd src
啟動Redis ./redis-server
配置Redis
設定開機自啟動
将redis.conf中daemonize設定為yes,確定守護程序開啟。
打開加入
vim /etc/profile
檔案末尾添加
export REDIS_HOME=/usr/local
export PATH=$PATH:$REDIS_HOME/bin
儲存并退出
重新整理profile
. /etc/profile
下面執行安裝服務,互動設定根據自己的需要,我都是直接回車
./redis-6.0.10/utils/install_server.sh
在這裡報錯
Welcome to the redis service installer
This script will help you easily set up a running redis server
This systems seems to use systemd.
Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!
打開install_server.sh,注釋掉下面的内容:注釋内容參考
重新執行,一路選擇預設配置即可。