Linux centos 7 更换 nodejs 源

分类 记录 557阅读阅读模式

默认的,通过 yum install -g nodejs 安装 nodejs 为 0.1x 版本的。

如果需要其他版本,则需要指定 nodejs 源。

6.x

  1. curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -

5.x

  1. curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -

4.x

  1. curl --silent --location https://rpm.nodesource.com/setup_5.x | bash -

0.1x

  1. curl --silent --location https://rpm.nodesource.com/setup | bash -

 

指定 6.x 版本以后,如下提示,表示成功

  1. ## Installing the NodeSource Node.js 6.x repo...
  2. ## Inspecting system...
  3. + rpm -q --whatprovides redhat-release || rpm -q --whatprovides centos-release || rpm -q --whatprovides cloudlinux-release || rpm -q --whatprovides sl-release
  4. + uname -m
  5. ## Confirming "el6-x86_64" is supported...
  6. + curl -sLf -o /dev/null 'https://rpm.nodesource.com/pub_6.x/el/6/x86_64/nodesource-release-el6-1.noarch.rpm'
  7. ## Downloading release setup RPM...
  8. + mktemp
  9. + curl -sL -o '/tmp/tmp.CQ0Pv3MA10' 'https://rpm.nodesource.com/pub_6.x/el/6/x86_64/nodesource-release-el6-1.noarch.rpm'
  10. ## Installing release setup RPM...
  11. + rpm -i --nosignature --force '/tmp/tmp.CQ0Pv3MA10'
  12. ## Cleaning up...
  13. + rm -f '/tmp/tmp.CQ0Pv3MA10'
  14. ## Checking for existing installations...
  15. + rpm -qa 'node|npm' | grep -v nodesource
  16. ## Run `yum install -y nodejs` (as root) to install Node.js 6.x and npm.
  17. ## You may also need development tools to build native addons:
  18. ## `yum install -y gcc-c++ make`

 

然后执行全局安装

  1. yum install -y nodejs

 

完毕!

 

 

相关文章

给我留言

  • 有人回复时邮件通知我