Install and configure Node. js

Source: Internet
Author: User

Node. js is a set of JavaScript toolkit used to write high-performance network servers. A series of changes started from this. Specifically, Node. js assumes that Linux or Mac OS X is running in the POSIX environment. In Windows, MinGW must be installed to obtain a POSIX-like environment. In Node, Http is the first priority. Node is optimized to create an http server. Therefore, most examples and libraries on the Internet are concentrated on the web.

This article is just a simple installation and configuration of node. js. Note that this version of nodejs installs python2.7.

Install python2.7

1. Go to the official website to download python2.7

Http://python.org

2. decompress and compile

Tar xvf Python-2.7.5.tar.bz2

Cd Python-2.7.5

./Configure -- prefix =/usr/local/python2.7

Make & make install

Ln-s/usr/local/python2.7/bin/python2.7/usr/bin/python2.7 # Do a link, or add/usr/local/python2.7/bin/to the PATH variable.

1. Go to the official website to download the nodejs v0.10.7 installation package. Select INSTALL

2. decompress and compile

Tar xvf node-v0.10.7.tar.gz

Cd node-v0.10.7

./Configure

Make & make install

3. Compile a js File

# Vim test. js

Var http = require ('http ');


Http. createServer (function (req, res ){

Res. writeHead (200, {'content-type': 'text/plain '});

Res. end ('Hello World \ n ');

}). Listen (8080, "127.0.0.1 ");

Console. log ('server running at http: // 127.0.0.1: 8080 /');

Node test. js & # running in the background

4. Access

Elinks http: // 127.0.0.1: 8080/

Now we can see hello world.

Related Article

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.