centos install node.js
已經火紅一段時間的東西了,簡單說就是使用javascript來開發網站,就好像是php or asp這類的後端的程式語言。網路上可以找到很多相關的介紹,本篇將實做在centos安裝並執行運作。
安裝
View Code BASH
123456 wget http://nodejs.org/dist/node-v0.4.8.tar.gztar -xvf node-v0.4.8.tar.gzcd /home/shian/node-v0.4.8./configuremakemake install安裝成功訊息
View Code BASH
12 Waf: Leaving directory `/home/shian/node-v0.4.8/build''install' finished successfully (0.693s)建立node.js檔案
View Code BASH
1 vim node.jsView Code JAVASCRIPT
123456 var http = require('http');http.createServer(function (req, res) { res.writeHead(200, { 'Content-Type': 'text/plain'}); res.end('Hello Node.js\n');}).listen(8124, "127.0.0.1");console.log('Server running at http://127.0.0.1:8124/');執行node.js
View Code BASH
123 node node.jsServer running at http://127.0.0.1:8124/http://127.0.0.1:8124最後在網頁上連結http://127.0.0.1:8124看到Hello Node.js,就表示node.js已經正在運作中囉!
參考資料
您或許對這些文章有興趣: