CentOS 7 安装Nodejs 16 LTS版
CentOS 7 安装Nodejs 16 LTS版

配置源

以下操作基于root用户

curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash -

安装nodejs16 LTS长期维护版

sudo yum install -y nodejs
安装完成


安装完成后通过命令验证版本


其他长期版本安装参考:
 

Node.js v18.x

# As root
curl -fsSL https://rpm.nodesource.com/setup_18.x | bash -

# No root privileges
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -

Node.js v16.x

# As root
curl -fsSL https://rpm.nodesource.com/setup_16.x | bash -

# No root privileges
curl -fsSL https://rpm.nodesource.com/setup_16.x | sudo bash -

Node.js v14.x

# As root
curl -fsSL https://rpm.nodesource.com/setup_14.x | bash -

# No root privileges
curl -fsSL https://rpm.nodesource.com/setup_14.x | sudo bash -

Node.js LTS (16.x)

# As root
curl -fsSL https://rpm.nodesource.com/setup_lts.x | bash -

# No root privileges
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -

Node.js Current (18.x)

# As root
curl -fsSL https://rpm.nodesource.com/setup_current.x | bash -

# No root privileges
curl -fsSL https://rpm.nodesource.com/setup_current.x | sudo bash -

Nodejs 卸载

# use `sudo` or run this as root
yum remove nodejs
rm -r /etc/yum.repos.d/nodesource*.repo
yum clean all

更多参考:distributions/README.md at master · nodesource/distributions · GitHub

 

评论区域