安裝時(shí),請(qǐng)注意替換成自己服務(wù)器的路徑地址!
一、安裝redis
a、下載redis:
wget http://download.redis.io/redis-stable.tar.gz tar -zxvf redis-stable.tar.gz cd redis-stable make make install |
b、在redis安裝目錄下進(jìn)入utils目錄,執(zhí)行自動(dòng)安裝腳本
cd utils/ ./install_server.sh 一路回車都按照默認(rèn)設(shè)置執(zhí)行 //執(zhí)行完腳本后,會(huì)出現(xiàn)以下提示: Selected config: Port : 6379 Config file : /etc/redis/6379.conf Log file : /var/log/redis_6379.log Data dir : /var/lib/redis/6379 Executable : /usr/local/bin/redis-server Cli Executable : /usr/local/bin/redis-cli |
c、添加redis開(kāi)機(jī)自啟動(dòng)
//修改文件權(quán)限 chmod 755 /etc/init.d/redis_6379 //添加自啟動(dòng) chkconfig --add redis_6379 chkconfig --level 345 redis_6379 on |
d、檢查遠(yuǎn)程服務(wù)器的6379端口是否被防火墻攔截。假如未開(kāi)啟,則開(kāi)添加
/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT /etc/init.d/iptables restart(視服務(wù)器情況而定,如果不知道的話可以選擇重啟服務(wù)器) 也可以在wdcp的后臺(tái)系統(tǒng)管理--iptables添加規(guī)則 使用安騎士等防火墻軟件的自行添加6379端口訪問(wèn)通過(guò)的規(guī)則 |
e、編輯redis配置文件,允許所有ip連接
vim /etc/redis/6379.conf //找到bind 127.0.0.1這一行,替換成下面這行內(nèi)容 bind 0.0.0.0 保存退出 重啟使配置生效:/etc/init.d/redis_6379 restart |
f、通過(guò)客戶端命令行連接redis
//在本地連接 redis-cli -h 127.0.0.1 -p 6379 |
二、添加phpredis擴(kuò)展
獲取并解壓安裝包 cd wget https://github.com/phpredis/phpredis/archive/develop.zip unzip develop.zip 注意:若提示未找到“unzip”命令 解決辦法:運(yùn)行 yum install unzip -y //進(jìn)入目錄 cd phpredis-develop 使用phpize命令添加擴(kuò)展,phpize命令所在路徑根據(jù)實(shí)際情況修改 /www/wdlinux/nginx_php/bin/phpize 注意:可能會(huì)有“Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable. Then, rerun this script.”錯(cuò)誤 解決辦法:運(yùn)行 yum install -y autoconf 再重新運(yùn)行前面的phpize命令 出現(xiàn)類似下圖的提示,則代表成功
(額外幫助信息)啟動(dòng)/關(guān)閉服務(wù)命令
|
二、添加phpredis擴(kuò)展
配置php-config的時(shí)候報(bào)錯(cuò) 能幫我看看是怎么回事嗎?
checking buil ...
skyuser 發(fā)表于 2017-2-13 23:37
歡迎光臨 WDlinux官方論壇 (http://www.fsowen.com/bbs/) | Powered by Discuz! 7.2 |