环境:CentOS 7.1
[root@localhost /]# cd /usr/src [root@localhost src]# wget https://nodejs.org/dist/v4.5.0/node-v4.5.0.tar.gz --2016-09-04 15:57:38-- https://nodejs.org/dist/v4.5.0/node-v4.5.0.tar.gz Resolving nodejs.org (nodejs.org)... 104.20.22.46, 104.20.23.46, 2400:cb00:2048:1::6814:172e, ... Connecting to nodejs.org (nodejs.org)|104.20.22.46|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 22708609 (22M) [application/gzip] Saving to: ‘node-v4.5.0.tar.gz’ 100%[==================================================================================================>] 22,708,609 335KB/s in 75s 2016-09-04 15:58:54 (296 KB/s) - ‘node-v4.5.0.tar.gz’ saved [22708609/22708609] [root@localhost src]# ls debug kernels node-v4.5.0.tar.gz [root@localhost src]# tar -xf node-v4.5.0.tar.gz [root@localhost src]# ls debug kernels node-v4.5.0 node-v4.5.0.tar.gz [root@localhost src]# cd node-v4.5.0/ [root@localhost node-v4.5.0]# ./configure 。。。 。。。 [root@localhost node-v4.5.0]# make 。。。 。。。make时间较长 [root@localhost node-v4.5.0]# sudo make install 。。。。安装过程 。。。然后检查是否安装成功 [root@localhost node-v4.5.0]# node --version v4.5.0
。。。也可以检测nodejs自带的npm的版本号
[root@localhost node-v4.5.0]# npm --version
v2.15.9