第一步,安裝EPEL,直接第二步會報錯
Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.sonn.com * extras: mirror.supremebytes.com * updates: mirrors.cat.pdx.edu Setting up Install Process No package redis available. Error: Nothing to do
所以先下載https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm後安裝
第二步,安裝Redis
在CLI用su提權
執行yum -y install redis
過程有點漫長,不知為啥最初鏈接到國外服務器了,反正最後還是完成了
Running transaction Installing : jemalloc-3.6.0-1.el7.x86_64 1/2 Installing : redis-2.8.19-2.el7.x86_64 2/2 Verifying : redis-2.8.19-2.el7.x86_64 1/2 Verifying : jemalloc-3.6.0-1.el7.x86_64 2/2 Installed: redis.x86_64 0:2.8.19-2.el7 Dependency Installed: jemalloc.x86_64 0:3.6.0-1.el7 Complete!調用
systemctl start redis.service把redis啟動起來
調用
systemctl enable redis.service
把redis做成服務.
第四步,允許外網訪問
當然,我們要打開防火墻6379端口
然後vi /etc/redis.conf修改一下bind,最簡單的做法就是註釋掉這樣大家都能訪問了
最後給出redis相關的命令
Now start the redis server after this.
systemctl start redis.service
Check the running status of redis server
systemctl status redis.service
To test the installation of Redis, use below given command
redis-cli ping
If the response output is PONG, it means installation is completed successfully.
[root@localhost ~]# redis-cli ping
PONG
[root@localhost ~]#
Start/Stop/Restart/Status and Enable redis server
To start redis server
systemctl start redis.service
To stop redis server
systemctl stop redis.service
To restart redis server
systemctl restart redis.service
To get running status of redis server
systemctl status redis.service
To enable redis server at system’s booting time.
systemctl enable redis.service
To disable redis server at system’s booting time.
systemctl disable redis.service
Listening Port Of Redis Server
Redis Server listens by default at port number 6379. Use below given ss command. (To learn more about ss command)
[root@localhost ~]# ss -nlp|grep redis
tcp LISTEN 0 128 127.0.0.1:6379 *:* users:(("redis-server",19706,4))
Tags: 國外服務器 Running package 防火墻 enable
文章來源: