首页 > 代码库 > centos安装nodejs

centos安装nodejs

1.下载安装nodejs

 1 wget http://nodejs.org/dist/v0.10.25/node-v0.10.25.tar.gz
 2 yum install gcc openssl-devel gcc-c++ compat-gcc-34 compat-gcc-34-c++
 3 tar -xf node-v0.10.25.tar.gz
 4 cd node-v0.10.25
 5 ./configure --prefix=/usr/local/node
 6 make && make install
 7 ln -s /usr/local/node/bin/* /usr/sbin/

 

2.配置npm

1 npm set prefix /usr/local
2 echo -e \nexport PATH=/usr/local/lib/node_modules:$PATH >> ~/.bashrc
3 source ~/.bashrc

 

 

centos安装nodejs