开发者社区> 问答> 正文

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

目前阿里云镜像上的 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 镜像列表.

展开
收起
DevDengChao 2020-06-14 11:38:54 7538 0
来自:镜像站
2 条回答
写回答
取消 提交回答
    • 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
    
    2020-09-03 10:00:05
    赞同 展开评论 打赏
  • 收到

    2020-06-19 10:13:09
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
来源圈子
更多
收录在圈子:
+ 订阅
问答排行榜
最热
最新

相关电子书

更多
我的Docker:Docker插件机制详解 立即下载
我的Docker-Docker插件机制详解 立即下载
4天实战 轻松玩转docker 立即下载