1. Install the dependency package
Copy codeThe Code is as follows: sudo apt-get install g ++ curl libssl-dev apache2-utils
Sudo apt-get install git-core
2. Download the source codeCopy codeThe Code is as follows: git clone git: // github.com/ry/node.git
This step shows Cloning to node because of poor network conditions...
You can download the source code from the official website and decompress it to the account folder.
Change the file name to node.
3. Compile
Three commands:Copy codeThe Code is as follows:./configure
Make
Sudo make install
After successful installation:
4. Test
Write the following small program named example. js and save it in the node folder.Copy codeThe Code is as follows: var http = require ('http ');
Http. createServer (function (req, res ){
Res. writeHead (200, {'content-type': 'text/plain '});
Res. end ('Hello Node. jsn ');
}). Listen (8124, "127.0.0.1 ");
Console. log ('server running at http: // 127.0.0.1: 8124 /');
Run the following command:
Running result:
For the convenience of applications, you should also set environment variables, install npm, and so on?
I am just starting to learn more...
Annoying confidentiality check, sorting out information...