How to install Node. js in Ubuntu 11.10

Source: Internet
Author: User

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...

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.