可以,CentOS 完全能够运行 Node.js。
# CentOS 7/8
sudo yum install -y nodejs npm
或(CentOS 8+)
sudo dnf install -y nodejs
查看版本:
node -v
npm -v
curl -fsSL https://rpm.nodesource.com/setup_18.x | sudo bash -
sudo yum install -y nodejs
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install 18
从 https://nodejs.org 下载 linux-x64.tar.xz,解压并配置 PATH 即可。
pm2 或 systemd 管理 Node 进程如果你有具体 CentOS 版本或用途(开发 / 生产 / 容器),我可以给你更精确的方案。