准备命令:
yum -y install gcc make gcc-c++ openssl-devel wget
下载源码及解压:
wget http://nodejs.org/dist/v0.10.26/node-v0.10.26.tar.gz
tar -zvxf node-v0.10.26.tar.gz
编译及安装:make && make install
验证是否安装配置成功:
node -v
官方文档:https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
Run as root on RHEL, CentOS or Fedora:
curl -sL https://rpm.nodesource.com/setup | bash -Then install, as root:
yum install -y nodejs
中间遇到一个错误
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
解决方法:
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
解决办法编辑/etc/yum.repos.d/epel.repo,把基础的恢复,镜像的地址注释掉#baseurlmirrorlist改成baseurl#mirrorlist
然后就安装成功了。