這篇文章主要講解了“Centos7怎么安裝redis5.0”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“Centos7怎么安裝Redis5.0”吧!
為包河等地區(qū)用戶提供了全套網(wǎng)頁設(shè)計制作服務(wù),及包河網(wǎng)站建設(shè)行業(yè)解決方案。主營業(yè)務(wù)為成都做網(wǎng)站、網(wǎng)站設(shè)計、外貿(mào)營銷網(wǎng)站建設(shè)、包河網(wǎng)站設(shè)計,以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務(wù)。我們深信只要達到每一位用戶的要求,就會得到認(rèn)可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!
一、安裝gcc依賴
由于 redis 是用 C 語言開發(fā),安裝之前必先確認(rèn)是否安裝 gcc 環(huán)境(gcc -v),如果沒有安裝,執(zhí)行以下命令進行安裝
[root@localhost local]# yum install -y gcc
二、下載并解壓安裝包
[root@localhost local]# wget http://download.redis.io/releases/redis-5.0.3.tar.gz
[root@localhost local]# tar -zxvf redis-5.0.3.tar.gz
三、cd切換到redis解壓目錄下,執(zhí)行編譯
[root@localhost local]# cd redis-5.0.3
[root@localhost redis-5.0.3]# make
四、安裝并指定安裝目錄
[root@localhost redis-5.0.3]# make install PREFIX=/usr/local/redis
五、啟動服務(wù)
5.1前臺啟動
[root@localhost redis-5.0.3]# cd /usr/local/redis/bin/
[root@localhost bin]# ./redis-server
5.2后臺啟動
從 redis 的源碼目錄中復(fù)制 redis.conf 到 redis 的安裝目錄
[root@localhost bin]# cp /usr/local/redis-5.0.3/redis.conf /usr/local/redis/bin/
修改 redis.conf 文件,把 daemonize no 改為 daemonize yes
[root@localhost bin]# vi redis.conf
修改redis.conf文件
vim redis.conf
#注釋掉它,以便讓外網(wǎng)訪問
#bind 127.0.0.1
#后臺進程方式啟動
daemonize yes
#requirepass foobared去掉注釋,foobared改為自己的密碼
后臺啟動
[root@localhost bin]# ./redis-server redis.conf
六、設(shè)置開機啟動
添加開機啟動服務(wù)
[root@localhost bin]# vi /etc/systemd/system/redis.service
復(fù)制粘貼以下內(nèi)容:
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
注意:ExecStart配置成自己的路徑
設(shè)置開機啟動
[root@localhost bin]# systemctl daemon-reload
[root@localhost bin]# systemctl start redis.service
[root@localhost bin]# systemctl enable redis.service
創(chuàng)建 redis 命令軟鏈接
[root@localhost ~]# ln -s /usr/local/redis/bin/redis-cli /usr/bin/redis
測試 redis
服務(wù)操作命令
systemctl start redis.service #啟動redis服務(wù)
systemctl stop redis.service #停止redis服務(wù)
systemctl restart redis.service #重新啟動服務(wù)
systemctl status redis.service #查看服務(wù)當(dāng)前狀態(tài)
systemctl enable redis.service #設(shè)置開機自啟動
systemctl disable redis.service #停止開機自啟動
{{o.name}}
{{m.name}}
感謝各位的閱讀,以上就是“Centos7怎么安裝Redis5.0”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對Centos7怎么安裝Redis5.0這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!
網(wǎng)站標(biāo)題:Centos7怎么安裝Redis5.0
文章分享:http://www.2m8n56k.cn/article16/giosgg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、網(wǎng)站維護、定制網(wǎng)站、關(guān)鍵詞優(yōu)化、網(wǎng)站內(nèi)鏈、Google
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:[email protected]。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)