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安裝php、安裝MySqlCentOSPHPMySql
- centos7 安裝pipCentOS
- CentOS7 安裝 MySQLCentOSMySql
- centos7安裝protobufCentOS
- 4.1 CentOS7安裝CentOS
- CentOS7安裝wpsCentOS
- VirtualBox安裝Centos7CentOS
- CentOS7 安裝NginxCentOSNginx
- CentOS7安裝OpenvswitchCentOS
- centos7 安裝rocketmqCentOSMQ
- CentOS7 安裝 dockerCentOSDocker
- centos7安裝dockerCentOSDocker
- CentOS7 安裝 memcacheCentOS
- CentOS7 安裝 libreofficeCentOS
- centos7 安裝 rcloneCentOS
- centos7安裝nginxCentOSNginx
- centos7安裝mysqlCentOSMySql
- Centos7 安裝 NginxCentOSNginx
- Centos7安裝RabbitMQCentOSMQ
- centos7安裝composerCentOS
- centos7安裝supervisorCentOS
- CentOS7安裝RedisCentOSRedis
- Centos7 安裝ffmpegCentOS
- centos7安裝HadoopCentOSHadoop
- centos7安裝教程詳解 centos7安裝詳細步驟CentOS
- mac virualbox 安裝centos7MacCentOS
- centos7快速安裝dockerCentOSDocker
- CentOS7 安裝配置 GitLabCentOSGitlab
- Centos7上安裝dockerCentOSDocker
- 【CentOS】CentOS7安裝PostgreSQLCentOSSQL
- centos7 docker 安裝教程CentOSDocker
- Centos7快速安裝RocketMQCentOSMQ
- centos7下安裝ffmpegCentOS
- centos7下安裝 dockerCentOSDocker
- CentOS7 下安裝 ElasticsearchCentOSElasticsearch
- centos7安裝elasticsearch:7.9.3CentOSElasticsearch
- centos7 安裝MariaDB 10.6CentOS