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.