参考官方文档https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
Node.js and npm are available from the Extra Packages for Enterprise Linux (EPEL) repository.
To check if you have EPEL registered, run: 检查是否安装了epel
yum repolist
If you don't see EPEL, install it via yum
: 如果没有在结果中看到epel则通过yum命令安装
For Enterprise Linux version 6 (EPEL version 6.8 at the time of writing): 如果你的版本是centos6.x请使用以下命令
yum install \
http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
For Enterprise Linux version 7 Beta:如果你的版本是centos7.x请使用以下命令
yum install \
http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
Then install the nodejs and npm packages: 安装好以上环境之后就安装nodejs以及npm
sudo yum install nodejs npm --enablerepo=epel
安装成功
使用编译源码的形式安装。 以下安装失败
首先要安装gcc, # yum install gcc
1.下载nodejs ,nodejs官网下载:http://nodejs.org/download/
# wget http://nodejs.org/dist/v0.10.30/node-v0.10.30-linux-x64.tar.gz
2.解压安装包
# tar zxvf node-v0.10.30-linux-x64.tar.gz
3.查看需要配置的环境和安装文档
# cd node-v0.10.30-linux-x64
# vi README.md
4.