1. 添加epel源:
(1)查看机器位数 file /sbin/init 或者 file /bin/ls
(2)X64:
rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
X32:
rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
2. 导入key:
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
3. 添加remi源:
1 rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 2 rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
4. 升级源:
sudo yum upgrade ca-certificates --disablerepo=epel
5. 安装nodeJS
1 yum install gcc-c++ 2 yum -y install nodejs
问题破冰:
1. Cannot retrieve metalink for repository: epel.
1 vi /etc/yum.repos.d/epel.repo 2 3 #baseurl 4 mirrorlist 5 改成 6 baseurl 7 #mirrorlist
2. Cannot retrieve repository metadata (repomd.xml) for repository: epel.
1 vi /etc/yum.repos.d/epel.repo 2 #baseurl全部改为baseurl=http://centos.ustc.edu.cn/centos/5/os/i386/ 3 (执行替换命令):%s#baseurl=(原来的url)#baseurl=http://centos.ustc.edu.cn/centos/5/os/i386/#g 4 yum clean all
3. 一定要注意,gcc-c++一定要被安装
yum install gcc-c++
另外附带编译安装:
1 yum install gcc-c++ openssl-devel 2 cd /usr/local/src 3 wget http://nodejs.org/dist/node-latest.tar.gz 4 tar zxvf node-latest.tar.gz 5 ./configure 6 Make 7 Make install 8 npm install restify