CENTOS6 Installing and installing node. js

Source: Internet
Author: User

I. Preparatory work

1. Installing GCC
yum install gcc-c++ openssl-devel

2. Upgrade Python
Upgrade Step: http://blog.51cto.com/qiangsh/1979284

Ii. compiling and installing node. js
wget http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gztar -xzvf node-v0.10.29.tar.gz cd node-v0.10.29/ ./configure make sudo make install

Test:

node --versionv0.10.29

The following error occurred during the installation:

ImportError: No module named bz2make[1]: *** [/data/package/node-v0.10.29/out/Release/obj/gen/libraries.cc] Error 1make[1]: Leaving directory `/data/package/node-v0.10.29/out‘make: *** [node] Error 2

Workaround:

yum install bzip2-devel然后需要重新编译一下python,之后再import bz2就不会提示错误了。
Three. Test node. js

The first program is the Hello World, find a free directory

vi hello_world.js  plaster入以下内容:var http = require(‘http‘);  http.createServer(function (req, res) {      res.writeHead(200, {‘Content-Type‘: ‘text/plain‘});      res.end(‘Hello Node.js\n‘);  }).listen(8888, "127.0.0.1");  console.log(‘Server running at http://127.0.0.1:8888/‘);  然后编译,当前目录下输入:node hello_world.js  

Output server running at ... Represents a successful compilation. (if prompted Commad:node:not found, then the second compilation is not successful, you can compile the times, notice whether there is an error, or can not find the node command, configure a soft connection: Ln-s/usr/local/bin/node/usr/bin/ node)

Then in the browser input http://127.0.0.1:8888, the browser prints out Hello node. js

Iv. Follow-up work

Installing NPM

NPM is a NODEJS package management and Distribution tool, has become the unofficial Release Node module (package) standard, with NPM, you can quickly find a specific service to use the package, to download, install and manage the installed packages

curl http://npmjs.org/install.sh | sh

Tips...... It worked, NPM installation is successful!
Then install the Express module

npm install express
Well, the installation is complete and node. js can be developed!

CENTOS6 Installing and installing node. js

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.