How to install node. js

Source: Internet
Author: User
Tags install node joyent

Address: http://www.ooso.net/archives/589

Reference address: http://cnodejs.org/blog? P = 2080

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
      Git clone git:// Github.com/joyent/node.git
      CD Node
      ./Configure
      Make
      Sudo make install
    Ubuntu
      1. Install dependency packages

         Sudo Apt  -  Get  Install g  ++  Curl libssl  -  Dev apache2  -  Utils
        Sudo Apt - Get Install git - Core
      2. Run the following command line:
        Git clone git:// Github.com/joyent/node.git
        CD Node
        ./Configure
        Make
        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:
          Git clone git:// Github.com/joyent/node.git
          CD Node
          ./Configure
          Make
          Sudo make install
        Centos
        Yum install gcc  -  C  ++  OpenSSL  -  Devel
        Wget -- No - Check - Certificate https : // Github.com/joyent/node/tarball/v0.3.3
        Tar - Xzvf ry - Node - V0 . 3.3 - 0 - G57544ba . Tar . GZ
        CD ry - Node - V0 . 3.3 - 0 - G57544bac1
        ./ Configure
        Make
        Make install
        Hello node. JS!

        Write a small segmentProgramFor example, hello_node.js to verify whether the installation is correct:

         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 this section with NodeCode

           node hello_node  .   JS 
        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.

        End

        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.