In this chapter, we will introduce to you how to install Node.js on window and Linux.
This installation tutorial takes Node.js v0.10.26 version as an example.
The Node.js installation package and source code download address are: http://www.nodejs.org/download/.
Select the Node.js installation package you need according to different platform systems.
Note: Python 2.6 or 2.7 is required to install Node.js on Linux. It is not recommended to install Python 3.0 or above.
Install Node.js on Windowv
Windows Installation Package (.msi) :
32-bit installation package download address: http://nodejs.org/dist/v0.10.26/node-v0.10.26-x86.msi
64-bit installation package download address: http://nodejs.org/dist/v0.10.26/x64/node-v0.10.26-x64.msi
Installation steps:
Step 1: Double-click the downloaded installation package node-v0.10.26-x86.msi, as shown below:
Step 2: Click Run above and the following interface will appear:
Step 3: Check the Accept Agreement option and click the next button:
Step 4: The default installation directory of Node.js is "C:/Program Files/nodejs/". You can modify the directory and click next (next):
Step 5: Click the tree icon to select the installation mode you need, and then click Next (Next)
Step 6: Click Install to start installing Node.js. You can also click Back to modify the previous configuration. Then and click next:
Installation process:
Click the Finish button to exit the installation wizard.
Check whether Node.js is configured with PATH environment variable, click Start =》Run =》Enter "cmd" => Enter the command "path", and the following results are output:
Copy the code as follows: PATH=C:/oraclexe/app/oracle/product/10.2.0/server/bin;C:/Windows/system32;C:/Windows;C:/Windows/System32/Wbem;C:/Windows/System32/WindowsPowerShell/v1.0/;c:/python32/python;C:/MinGW/bin;C:/Program Files/GTK2-Runtime/lib;C:/Program Files/MySQL/MySQL Server 5.5/bin;C:/Program Files/nodejs/;C:/Users/rg/AppData/Roaming/npm
We can see that the environment variable already contains C:/Program Files/nodejs/
Check Node.js version
Windows binary file (.exe) installation :
32-bit installation package download address: http://nodejs.org/dist/v0.10.26/node.exe
64-bit installation package download address: http://nodejs.org/dist/v0.10.26/x64/node.exe
Installation steps
Step 1: Double-click the downloaded installation package Node.exe, and the following interface will appear:
Click the Run button and the command line window will appear:
Version testing
Enter the directory where node.exe is located, as follows:
If you get the above output, it means that you have successfully installed Node.js.
Install Node.js on Linux Ubuntu
In the following section, we will introduce the installation of Node.js under Ubuntu Linux. Other Linux systems, such as Centos, etc., are installed as follows.
Get the Node.js source code on Github:
After completing the download, change the source code package name to 'node'.
Modify directory permissions:
Create a compiled file using './configure'.
Compiled: make.
Complete the installation: make install.
Finally, we enter the 'node --version' command to check whether Node.js is installed successfully.
Install nodejs under centOS
1. To download the source code, you need to download the latest Nodejs version at http://nodejs.org/. This article takes v0.10.24 as an example:
The code copy is as follows: cd /usr/local/src/wget http://nodejs.org/dist/v0.10.24/node-v0.10.24.tar.gz
2. Decompress the source code
Copy the code as follows: tar zxvf node-v0.10.24.tar.gz
3. Compile and install
Copy the code as follows: cd node-v0.10.24./configure --prefix=/usr/local/node/0.10.24make install
4. Configure NODE_HOME and enter profile to edit environment variables
Copy the code as follows: vim /etc/profile
Set nodejs environment variables and add the following content on the line export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL :
Copy the code as follows:#set for nodejsexport NODE_HOME=/usr/local/node/0.10.24export PATH=$NODE_HOME/bin:$PATH
:wq save and exit, compile /etc/profile to make the configuration take effect
Copy the code as follows: source /etc/profile
Verify that the installation configuration is successful
Copy the code as follows: node -v
Output v0.10.24 indicates successful configuration
npm module installation path
Copy the code as follows: /usr/local/node/0.10.24/lib/node_modules/
Note: The official website of Nodejs provides compiled Linux binary packages, which you can also download and apply directly.