建议向 Ubuntu 镜像中添加 nodesource 镜像源-问答-阿里云开发者社区-阿里云

开发者社区> 问答> 正文

建议向 Ubuntu 镜像中添加 nodesource 镜像源

邓超1183570 2020-06-14 11:38:54 1115

目前阿里云镜像上的 Nodejs 与 npm 版本过旧.

根据 Nodejs 官方的指导, Ubuntu 用户可以通过更新 apt 源来下载最新版的 nodejs:

https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions-enterprise-linux-fedora-and-snap-packages

https://github.com/nodesource/distributions/blob/master/README.md#installation-instructions

使用官方推荐的源后安装非常的慢, 建议阿里云能够将 nodesource 列入 ubuntu 镜像列表.

Ubuntu JavaScript
分享到
取消 提交回答
全部回答(2)
  • heguopei
    2020-09-03 10:00:05
    • 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
  • 迪科斯彻
    2020-06-19 10:13:09

    收到

    0 0
添加回答
+ 订阅

阿里巴巴镜像站技术社区

推荐文章
相似问题
推荐课程
相关链接