centos安裝node.js的各類環境

CentOS系統環境:



安裝開始: node

一、 python

wget http://nodejs.org/dist/v0.10.15/node-v0.10.15.tar.gz 
#若提示wget command not found,可直接複製此連接下載安裝包,後面的步驟同樣。
tar zxvf node-v0.10.15.tar.gz
cd node-v0.10.15
./configure 
make && make install

二、
    配置的時候出現以下錯誤:
shell

    fpu = 'vfpv3' if armv7 else 'vfpv2'
    引發此錯誤的緣由是Python的版本太低,升級到2.7便可:
    wget -c http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
    #同上
    tar jxvf Python-2.7.3.tar.bz2
    cd Python-2.7.3
    ./configure 
    make && make install

    python2.7便安裝成功,路徑:/usr/local/lib/python2.7。 瀏覽器


三、重複步驟一便可,安裝成功。查看node.js的版本信息:
python2.7


四、寫個示例代碼測試node.js可否正常運行:
var http = require('http');
http.createServer(function(req,res){
    res.end('hello');
}).listen(3000);
console.log('Server is running at http://localhost:3000/')


五、在瀏覽器端打開 http://localhost:3000,能夠看到頁面打印出了"hello",說明node.js環境安裝成功。 ide


參考資料:
    http://viowan.blog.163.com/blog/static/137629793201321742518560/
    http://my.oschina.net/foxidea/blog/87649     
相關文章
相關標籤/搜索