Install nodejs in ubuntu11.10

Source: Internet
Author: User

 

This article focuses onArticleIncluding problems encountered during nodejs and express installation. For future use, while reducing the number of people learning node learning.

1. The installation environment is of the cainiao level for Linux. Therefore, you can install ubuntu11.10 on a virtual machine. The installation of the virtual machine is not mentioned here.

2. Install node. JS: Step 1: Install the dependency package,

Sudo Apt  -  Get  Install g  ++  Curl libssl  -  Dev apache2  -  Utilssudo Apt  -  Get  Install git -  Core 

Step 2: Obtain the node source code

 
Git clone git:// Github.com/joyent/node.git

After the download is complete, go to the CD node to enter the node folder,

Step 3: Specify the version to be migrated out: git checkout v0.4.10. Git is a version management tool. We use git to move out of version 0.4.10, if the node is not migrated out, the latest version of node 0.5.5-pre will be installed. The latest version is not supported for many commonly used packages. For example, express, so pay attention to this place.

Step 4: Develop the path and execute the compilation

 $ Mkdir  ~ /Local: Create a folder in the home directory of the current user $ go to the decompressed configure folder and execute ./  Configure  --  Prefix  =  $ Home  /  Local  /  Node  Compile path  $ Make  Compile. $ Sudo make install  Install.  $ Echo  '  Export  Path  =  $ Home  /  Local  /  Node  /  Bin :  $ Path  '     >     ~  /. Profile: Set the environment variable $ echo 'export node_path = $ home/  Local  /  Node  :  $ Home /  Local  /  Node  /  Lib  /  Node_modules  '     >     ~ /. Profile set node_path $ source ~ /  .  Profile 

Now we can run node-V to check whether the installation is successful. Note that the environment variable settings here are temporary.

Step 5: Set permanent environment variables,

You can use the node command to set permanent environment variables even if you restart the machine. Enter/etc VI profile and append two lines at the end:

Export  Path  ="  $ Home  /  Local  /  Node  /  Bin  :  $ Path  "   Export  Node_path  ="  $ Home  /  Local  /  Node  :  $ Home  /  Local  /  Node /  Lib  /  Node_modules  " 

OK. Now the node. js installation is complete.

3. Install Express

Install NPM: run the following command:

 
Curl HTTP:// Npmjs.org/install.sh | sh
  

Here, we will explain the meaning of this command. Curl http://npmjs.org/install.shis the method that uses the curlcommand to get the shellscript for installation, and then uses the pipe character | submit the obtained script to the sh command for execution. If you do not have the permission, the installation will fail. You need to add sudo to ensure the permission:

 
Curl http://npmjs.org/install.sh | sudo sh

Install Express:

   sudo NPM install express  -  gd   

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.