在CentOS 6.5上安装NodeJS

CentOS的软件源未包含有最新的nodejs, 需要手动编译安装。

首先安装依赖的库与工具

  1. yum install libtool automake autoconf gcc-c++ openssl-devel  


然后下载nodejs的源码包tar, 解压缩后直接三板斧编译安装

  1. ./configure --prefix=/usr  
  2. make  
  3. make install  

最后用 node -v和 npm -v 查看安装的版本

到这里其实还没完, 还需要安装 node-gyp 之类的包

  1. npm install -g node-gyp  

npm的另一种安装方式是

    1. wget http://npmjs.org/install.sh  
    2. chmod +x ./install.sh  
    3. ./install.sh  
原文地址:https://www.cnblogs.com/youlechang123/p/4811290.html