Ubuntu官方源里面带的nodejs版本过低,使用tar包安装又麻烦。其实配置一下软件源就可以直接使用apt
命令安装官方NodeJs。
APT源
Debian、Ubuntu、Deepin、RaspberryPI等使用apt命令安装软件的系统使用APT源
Node.js LTS(长期支持版)
# As root
curl -sL https://deb.nodesource.com/setup_lts.x | bash -
# No root privileges
curl -sL https://deb.nodesource.com/setup_lts.x | sudo bash -
Node.js 当前版本
# As root
curl -sL https://deb.nodesource.com/setup_current.x | bash -
# No root privileges
curl -sL https://deb.nodesource.com/setup_current.x | sudo bash -
Node.js v15.x
# As root
curl -sL https://deb.nodesource.com/setup_15.x | bash -
# No root privileges
curl -sL https://deb.nodesource.com/setup_15.x | sudo bash -
Node.js v14.x
# As root
curl -sL https://deb.nodesource.com/setup_14.x | bash -
# No root privileges
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash -
Node.js v12.x
# As root
curl -sL https://deb.nodesource.com/setup_12.x | bash -
# No root privileges
curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
Node.js v10.x
# As root
curl -sL https://deb.nodesource.com/setup_10.x | bash -
# No root privileges
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
YUM源
CentOS、RedHat等使用yum命令安装软件的系统使用yum源。
Node.js LTS(长期支持版)
# As root
curl -sL https://rpm.nodesource.com/setup_lts.x | bash -
# No root privileges
curl -sL https://rpm.nodesource.com/setup_lts.x | sudo bash -
Node.js 当前版本
# As root
curl -sL https://rpm.nodesource.com/setup_current.x | bash -
# No root privileges
curl -sL https://rpm.nodesource.com/setup_current.x | sudo bash -
Node.js v15.x
# As root
curl -sL https://rpm.nodesource.com/setup_15.x | bash -
# No root privileges
curl -sL https://rpm.nodesource.com/setup_15.x | sudo bash -
Node.js v14.x
# As root
curl -sL https://rpm.nodesource.com/setup_14.x | bash -
# No root privileges
curl -sL https://rpm.nodesource.com/setup_14.x | sudo bash -
Node.js v12.x
# As root
curl -sL https://rpm.nodesource.com/setup_12.x | bash -
# No root privileges
curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
Node.js v10.x
# As root
curl -sL https://rpm.nodesource.com/setup_10.x | bash -
# No root privileges
curl -sL https://rpm.nodesource.com/setup_10.x | sudo bash -