centos 安裝nodejs__js
來源:互聯網
上載者:User
安裝
挨個執行以下命令。 建立檔案夾 mkdir /usr/local/node cd /usr/local/node wget http://nodejs.org/dist/v0.6.14/node-v0.6.14.tar.gz tar zxvf node-v0.6.14.tar.gz cd node-v0.6.14 ./configure (這一步看看少什麼,新安裝的centos6 會少 gcc-c++ openssl,執行下面兩行命令安裝這些) yum install gcc-c++ yum install openssl-devel make(這個命令可能也需要先安裝:yum -y install gcc automake autoconf libtool make) make install
測試 cd /usr/local/node/code vim hello_node.js 輸入以下代碼: var http = require('http'); http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}); res.end('hello world ! nodejs success'); }).listen(8088); console.log('Server running at http://127.0.0.1:8088/'); 運行: node hello_node.js 訪問: http://127.0.0.1:8088/ 輸出:hello world ! nodejs success
以上轉自:http://my.oschina.net/u/142412/blog/52693
題外:memcached 問題 在nodejs中找到node_modules安裝資料夾 在它的上一級目錄執行命令 npm install connect-memcached express restler winston 設定memcached伺服器端自動啟動 [root@crm ~]# chkconfig --add memcached
[root@crm ~]# chkconfig --level 235 memcached on
[root@crm ~]# chkconfig --list | grep mem
memcached 0:off 1:off 2:on 3:on 4:off 5:on 6:off
接下來,可以用以下命令啟動與停止 memcached
/etc/rc.d/init.d/memcached start
/etc/rc.d/init.d/memcached stop
/etc/rc.d/init.d/memcached restart 可參考: http://www.cnblogs.com/technet/archive/2011/09/11/2173485.html