建议向 Ubuntu 镜像中添加 nodesource 镜像源
mirrors.tuna.tsinghua.edu.cn 仓库倒是有
echo 'deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse' > /etc/apt/sources.list
echo 'deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-security main restricted universe multiverse' >> /etc/apt/sources.list
echo 'deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-updates main restricted universe multiverse' >> /etc/apt/sources.list
echo 'deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-proposed main restricted universe multiverse' >> /etc/apt/sources.list
echo 'deb http://mirrors.aliyun.com/ubuntu/ $(lsb_release -cs)-backports main restricted universe multiverse' >> /etc/apt/sources.list
# 下面这句一定要运行,否则会认为nodejs的仓库地址是不可信,导致不能下载安装nodejs软件
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
# 安装 10.X版本
echo 'deb https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_10.x $(lsb_release -cs) main' > /etc/apt/sources.list.d/nodesource.list
echo 'deb-src https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_10.x $(lsb_release -cs) main' >> /etc/apt/sources.list.d/nodesource.list
apt-get update
apt-get install -y nodejs
# 安装 11.X版本
# echo 'deb https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_11.x $(lsb_release -cs) main' > /etc/apt/sources.list.d/nodesource.list
# echo 'deb-src https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_11.x $(lsb_release -cs) main' >> /etc/apt/sources.list.d/nodesource.list
# apt-get update
# apt-get install -y nodejs
# 安装 12.X版本
# echo 'deb https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_12.x $(lsb_release -cs) main' > /etc/apt/sources.list.d/nodesource.list
# echo 'deb-src https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_12.x $(lsb_release -cs) main' >> /etc/apt/sources.list.d/nodesource.list
# apt-get update
# apt-get install -y nodejs
# 安装 13.X版本
# echo 'deb https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_13.x $(lsb_release -cs) main' > /etc/apt/sources.list.d/nodesource.list
# echo 'deb-src https://mirrors.tuna.tsinghua.edu.cn/nodesource/deb_13.x $(lsb_release -cs) main' >> /etc/apt/sources.list.d/nodesource.list
# apt-get update
# apt-get install -y nodejs
赞0
踩0