centos7.3上yum install nodejs

用yum在centos7.3上安装node.js

 

node.js用起来很方便,在centos上用源码安装参考这里:
先介绍yum安装

yum安装node.js

官方文档:
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

网上看到的解决办法是:
http://www.netpc.com.cn/593.html

Error: Cannot retrieve metalink for repository: epel. 
Please verify its path and try again
在网上查了查,解决办法都是编辑/etc/yum.repos.d/epel.repo,把基础的恢复,镜像的地址注释掉
#baseurl
mirrorlist
改成
baseurl
#mirrorlist

然后就安装成功了。

附:源码安装node.js

准备命令:
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

 

posted @ 2017-02-19 03:32  爱博子  阅读(1689)  评论(0编辑  收藏  举报