歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> Linux下安裝配置Node及memcached,nodememcached

Linux下安裝配置Node及memcached,nodememcached

日期:2017/3/6 9:22:44   编辑:學習Linux

Linux下安裝配置Node及memcached,nodememcached


Linux下安裝配置Node及memcached,nodememcached


這篇主要是記錄Linux下安裝Node及memcached遇到的問題及安裝配置過程,方便日後查閱

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    使修改信息生效-------特別要注意配置好/etc/profile後,將配置加入/root/.bashrc中(在文件末尾添加source /etc/profile);否則,配置的環境變量不會在root賬戶下生效

  

  檢查是否安裝成功

[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

  

http://xxxxxx/Linuxjc/1150059.html TechArticle

Copyright © Linux教程網 All Rights Reserved