现在的位置: 首页 > 综合 > 正文

CentOS 6.3 x86_64 安装node.js

2019年06月07日 ⁄ 综合 ⁄ 共 538字 ⁄ 字号 评论关闭

1.准备工作

wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz

yum install gcc openssl-devel gcc-c++ compat-gcc-34 compat-gcc-34-c++

2.开始安装node.js

tar -xf node-v0.10.24.tar.gz

cd node-v0.10.24

./configure --prefix=/usr/local/node

make

make install

ln -s /usr/local/node/bin/* /usr/sbin/

到此node就安装完了。

3.测试是否安装成功
            测试脚本:

cat example.js

var http = require('http'); http.createServer(function (req, res){ res.writeHead(200,{'Content-Type': 'text/plain'}); res.end('Hello World\n'); }).listen(1337,'127.0.0.1'); console.log('Server runing at http://127.0.0.1:8080/');

node example.js

CentOS 6.4 x86_64 安装node.js - Hank - Huangyu的博客

CentOS 6.4 x86_64 安装node.js - Hank - Huangyu的博客

抱歉!评论已关闭.