Linux-Redis安裝(CentOS7)
安裝Redis
wget https://download.redis.io/releases/redis-6.0.9.tar.gz
tar xzf redis-6.0.9.tar.gz
cd redis-6.0.9
make
(gcc版本偏低編譯可能會報錯,gcc版本老問題,新版本的redis6.0以上不相容,需升級gcc-看文末)
執行Redis:src/redis-server
Redis設定service服務啟動與關閉
1、開啟redis.conf,daemonize設為yes,開啟守護程式:
vi /usr/local/redis/redis-6.0.9/redis.conf
daemonize=yes
(bind 127.0.0.1-如果要使其他redis客戶端連上redis,可註釋掉這行)
2、複製redis配置檔案
mkdir /etc/redis
cp /usr/local/redis/redis-6.0.9/redis.conf /etc/redis
3、修改啟動指令碼引數
vi /usr/local/redis/redis-6.0.9/utils/redis_init_script
EXEC=/usr/local/redis/redis-6.0.9/src/redis-server
CLIEXEC=/usr/local/redis/redis-6.0.9/src/redis-cli
CONF="/etc/redis/redis.conf"
4、複製redis啟動指令碼
cp /usr/local/redis/redis-6.0.9/utils/redis_init_script /etc/init.d/redis
5、啟動redis
啟動服務:systemctl start redis
停止服務:systemctl stop redis
檢視狀態:systemctl status redis
設為開機啟動:chkconfig redis on
設為開機關閉:chkconfig redis off
設定redis密碼
方法一(redis重啟之後密碼就會失效):
/usr/local/redis/redis-6.0.9/src/redis-cli
config get requirepass
config set requirepass 123456
方法二(修改配置檔案):
修改redis.conf配置檔案
#requirepass foobared後加上
requirepass 123456
有密碼時關閉Redis:
src/redis-cli
auth 123456
shutdown
gcc
安裝gcc:yum -y install gcc
升級gcc(升級到9.3-scl命令啟用只是臨時的,退出shell或重啟就會恢復原系統gcc版本):
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
如若有疑問需我解答,歡迎留言~!
相關文章
- Centos7安裝安裝部署dockerCentOSDocker
- 安裝centos7最小化安裝CentOS
- CentOS7 安裝 memcacheCentOS
- Centos7安裝nginxCentOSNginx
- CentOS7 安裝 dockerCentOSDocker
- CentOS7 安裝 MySQLCentOSMySql
- CentOS7安裝RedisCentOSRedis
- Centos7 安裝ffmpegCentOS
- centos7安裝protobufCentOS
- 4.1 CentOS7安裝CentOS
- CentOS7 安裝NginxCentOSNginx
- centos7 安裝pipCentOS
- Centos7安裝RabbitMQCentOSMQ
- centos7安裝dockerCentOSDocker
- centos7安裝iptablesCentOS
- CentOS7安裝xrdpCentOS
- centos7 安裝rocketmqCentOSMQ
- centos7 安裝 rcloneCentOS
- centos7安裝mysqlCentOSMySql
- centos7安裝教程詳解 centos7安裝詳細步驟CentOS
- CentOS7 下安裝 ElasticsearchCentOSElasticsearch
- centos7下安裝ffmpegCentOS
- centos7 docker 安裝教程CentOSDocker
- vmware 線上安裝 CentOS7CentOS
- Centos7快速安裝RocketMQCentOSMQ
- centos7快速安裝dockerCentOSDocker
- CentOS7安裝wpsCentOS
- centOs7安裝最新dockerCentOSDocker
- centos7下安裝phpCentOSPHP
- centos7安裝composerCentOS
- centos7安裝supervisorCentOS
- CentOS7安裝OpenvswitchCentOS
- Centos7上安裝dockerCentOSDocker
- VirtualBox安裝Centos7CentOS
- centos7下docker安裝CentOSDocker
- centos7安裝HadoopCentOSHadoop
- centos7下安裝 dockerCentOSDocker
- centos7安裝zabbix 5.0CentOS