Node安裝及配置
[root@hostname ~]tar zxvf node-v0.12.4.tar.gz
[root@hostname ~]cd node-v0.12.4
[root@hostname ~]./configure --prefix=/usr/local/node
[root@hostname ~]make
[root@hostname ~]make install
[root@hostname ~]cd ..
安裝完後需要配置Node的環境變量
[root@hostname ~]export PATH=/usr/local/node/bin: //關閉終端後再次打開就失效了 [root@hostname ~]vi /etc/profile 在文件末尾添加以下內容 export NODE_HOME=/usr/local/node export PATH =$PATH:$NODE_HOME/bin export NODE_PATH =$NODE_HOME/lib/node_modules [root@hostname ~]source /etc/profile 使修改立即生效
檢查是否安裝成功
[root@hostname ~]node -v
[root@hostname ~]v0.12.4
[root@hostname ~]node
>console.log('installing success')
installing success
undefined
>
一切正常,完成安裝
memcached安裝配置
由於memcached的執行需要依賴於libevent,先安裝libevent(有的Linux系統自帶libevent安裝軟件,考慮到版本問題,建議自行安裝libevent)
[root@hostname ~]tar zxvf libevent-2.0.22-stable.tar.gz
[root@hostname ~]cd libevent-2.0.22-stable
[root@hostname ~]./configure --prefix=/usr
[root@hostname ~]make
[root@hostname ~]make install
安裝memcached
[root@hostname ~]tar xzvf memcached-1.4.24.tar.gz
[root@hostname ~]cd memcached-1.4.24
[root@hostname ~]./configure --with-libevent=/usr
[root@hostname ~]make
[root@hostname ~]make install
安裝完成後啓動memcached
[root@hostname ~]memcached -d -m 2048 -uroot -l 127.0.0.1 -p 11211 -c 256 -P /usr/local/bin/memcached.pid
參數說明:
-d 選項是啓動一個守護進程,
-m 是分配給Memcache使用的內存數量,單位是MB,這裏是2G,
-u 是運行Memcache的用戶,這裏是root,
-l 是監聽的服務器IP地址,如果有多個地址的話,以逗號隔開。這裏指定了localhost,
-p 是設置Memcache監聽的端口,默認11211,最好是1024以上的端口,
-c 選項是最大運行的併發連接數,默認是1024,我這裏設置了256,按照你服務器的負載量來設定,
-P 是設置保存Memcache的pid文件,我這裏是保存在 /usr/local/bin/memcached.pid
檢查memcached是否正確運行,這裏使用telnet命令檢查
[root@hostname ~]telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
到這裏memcached也完成安裝
--------------------------------------------------------------------------------
tips:如果使用telnet命令時提示:command not found ------說明沒有安裝telnet命令,centos直接使用yum安裝
[root@hostname ~]yum install telnet