First, the preparatory work
node. js http://nodejs.org/download/
Current version: v0.10.29
Second, the choice of the platform
2.1 Windows Platform
Depending on whether your platform is 32-bit or 64-bit, choose to download a different. msi installer.
Installation is simple, as long as the step by step down to complete the installation.
After the installation is complete, we can find node. js and Node command Prompt in the Start menu, click "node Command prompt", open the Command Line window, and enter:
Node-v < return >
v0.10.29
Npm-v < return >
1.4.14
OK, installation completed successfully!
2.2 Linux Platform
Linux platform recommended two kinds of installation methods, one is to download the compiled files, the other is to download the source code self-compiled. The following are respectively described:
1) Download the compiled file
This is pretty straightforward, first wget the compiled version of node. JS, which is the 32-bit and 64-bit version of "Linux Binaries (. tar.gz)" In the download page, please choose your own download:
wget http://nodejs.org/dist/v0.10.29/node-v0.10.29-linux-x86.tar.gz
After installing or upgrading the necessary packages:
Yum install gcc openssl-devel gcc-c++ compat-gcc-34 compat-gcc-34-c++
unzip the tarball node-v0.10.29-linux-x86.tar.gz to any directory, here I am/home/sm/software :
tar -< Span class= "pun" >< Span class= "com" >node-v0.10.29-linux-x86.tar.gz
set the global:
ln-s Span class= "Apple-converted-space" > /home/sm/software / node-v0 .10.29-linux-x86 /bin/node /usr/local /bin/node
ln-s Span class= "Apple-converted-space" > /home/sm/software / node-v0 .10.29-linux-x86 /bin/npm /usr/local/ BIN/NPM
Node-v < return >
v0.10.29
Npm-v < return >
1.4.14
OK, installation completed successfully!
2) Download source code self-compiling
This is the "Source Code" item in the download page, and the link address is "http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gz".
Just like the method above, first wget back:
wget http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gz
Next, install or update the necessary packages:
Yum install gcc openssl-devel gcc-c++ compat-gcc-34 compat-gcc-34-c++
The next step is to compile the steps:
CD node-v0.10.29
./configure
Make
Make install
cp/usr/local/bin/node/usr/sbin/orln-s /usr/ local /bin /node /*/usr/sbin/
< Span class= "PLN" > Finally, let's test it again:
Node-v < return >
v0.10.29
Npm-v < return >
1.4.14
OK, installation completed successfully!
Attached: ln command
This is a very important command in Linux, please be familiar with it. It is the function of a file in another location to establish a non-link, the most common parameter of this command is-s, the specific use is: Ln-s source file Destination file.
When we need to use the same file in different directories, we do not need to put a file in each required directory, we just put the file in a fixed directory, and then in the other directory with the ln command link it can, do not have to repeatedly occupy disk space. For example: Ln-s/bin/less/usr/local/bin/less-s is the code name (symbolic) meaning.
Here are two points to note: first, the LN command will maintain the synchronization of each linked file, that is, no matter where you change, the other files will change the same; second, ln links and soft links and hard links two, soft link is ln-s * *, It will only generate a mirror image of the file in the location you selected, not disk space, hard link ln * *, no parameter-s, it will generate a file in your chosen location with the same size as the source file, whether it is a soft link or a hard link, the file will remain in sync. Soft links can span partitions, but hard links are only within the same partition.
If you use LS to look at a directory, found that there is a file at the end of a @ symbol, that is, a file generated with the LN command, with the ls-l command to see the link shown in the path.