[Reprinted] how to install node. js

Source: Internet
Author: User
Tags install node joyent

The following describes how to install node. js on Mac, Ubuntu, centos, and Windows respectively.

Mac

On Mac, if you like to use homebrew, you can use only one line to install it:

brew install node

Otherwise, you can only manually install it as follows:

    1. Install xcode
    2. Install git
    3. Run the following command line to compile node. js
      1 git clone git://github.com/joyent/node.git
      2 cd node
      3 ./configure
      4 make
      5 sudo make install

    Ubuntu
      1. Install dependency packages

        1 sudo apt-get install g++ curl libssl-dev apache2-utils
        2 sudo apt-get install git-core
      2. Run the following command line:
        1 git clone git://github.com/joyent/node.git
        2 cd node
        3 ./configure
        4 make
        5 sudo make install

      Windows

      To install node with cygwin, follow these steps:

        1. Install cygwin
        2. Run setup.exe in the cygwindirectory to install the package in the following list.
          • Devel → OpenSSL
          • Devel → G ++-gcc
          • Devel → make
          • Python → Python
          • Devel → git
        3. Run cygwin
        4. Run the following command line:
          1 git clone git://github.com/joyent/node.git
          2 cd node
          3 ./configure
          4 make
          5 sudo make install

        Centos
        1 yum install gcc-c++ openssl-devel
        2 wget --no-check-certificate https://github.com/joyent/node/tarball/v0.3.3
        3 tar -xzvf ry-node-v0.3.3-0-g57544ba.tar.gz
        4 cd ry-node-v0.3.3-0-g57544bac1
        5 ./configure
        6 make
        7 make install
        Hello node. JS!

        Write a small program such as hello_node.js to verify whether the installation is correct:

        1 var http =require('http');
        2 http.createServer(function(req, res){
        3 res.writeHead(200,{'Content-Type':'text/plain'});
        4 res.end('Hello Node.js\n');}).listen(8124,"127.0.0.1");
        5 console.log('Server running at http://127.0.0.1:8124/');

        Use node to run this code

        1 node hello_node.js
        2 Server running at http://127.0.0.1:8124/

        Now, open http: // 127.0.0.1: 8124/in a browser, and you should be able to see good news.

        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.