1.Redis安裝
wget http://download.redis.io/releases/redis-2.8.17.tar.gz
這裏默認下載到/root/softtar -xzf redis-2.8.17.tar.gz
解壓縮源碼cd /root/soft/redis-2.8.17
make
此時,src裏會多出redis-benchmark,redis-check-aof,redis-check-dump,redis-sentinel,redis-server等文件,把這幾個文件移動到/usr/bin
同時修改redis.conf裏的內容,daemonize yes 設置爲守護進程,並且把配置文件移動到/etc下。
cp redis.conf /etc/
cp redis-cli redis-server redis-benchmark redis-check-aof /usr/bin
把配置文件複製配置文件目錄下,執行文件複製到bin下,這樣在任意地方都可以執行這些命令了。
redis-server /etc/redis.conf
成功啓動redis服務。
運行以下代碼檢測是否成功運行。
redis-cli set name value
redis-cli get name
能成功設置name的value和獲取value,那就成功了。
2.Nginx安裝
Nginx下載地址
wget http://nginx.org/download/nginx-1.7.6.tar.gz
首先安裝相關依賴包
yum install gcc-C++
yum -y install zlib zlib-devel openssl openssl--devel pcre pcre-devel
若有老版本則移除,若開啓了apache,也請先關閉apache,命令爲
yum remove nginx
ps -ef | grep httpd
service stop httpd
解壓源碼包,進入源碼
tar -zxf /root/soft/nginx-1.7.6.tar.gz
cd /root/soft/nginx-1.7.6
設置安裝路徑,編譯並安裝。
./configure --prefix=/usr/local/nginx
make && make install
如不出錯,就能安裝成功。若需要支持SSL加密的https,這需要在configure配置後面加上--with-http_ssl_module。
配置ssl的時候出錯可能是沒安裝openssl,則需要執行下面兩個。
#yum install openssl #yum install openssl-devel
ps:這裏要注意源碼所在位置和安裝所在位置,如果你在同一地方的時候請不要重名了,不然有可能出錯,需要with prce=指定源碼所在位置。
運行下面的命令,啓動Nginx服務,查看是否正常啓動進程
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf ps -ef | grep nginx
運行ip/ 可以看到nginx啓動的字樣
Welcome to nginx!
更多參考
http://hanqunfeng.iteye.com/blog/684108