zoukankan      html  css  js  c++  java
  • ubuntu16.04更改源为阿里源

    一、通过系统更换源

    第一步:备份原来的源文件
    cd /etc/apt/  
    然后会显示下面的源文件sources.list
    输入命令
    sudo cp sources.list sources.list.bak
    就是将sources.list备份到sources.list.bak
    第二步:替换源
    阿里云源的文件
        deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse  
        deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse  
        deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse  
        deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse  
        ##测试版源  
        deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse  
        # 源码  
        deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse  
        deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse  
        deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse  
        deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse  
        ##测试版源  
        deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse  
        # Canonical 合作伙伴和附加  
        deb http://archive.canonical.com/ubuntu/ xenial partner  
        deb http://extras.ubuntu.com/ubuntu/ xenial main  
    替换并保存
    sudo gedit sources.list打开文件,替换成阿里云文件即可
    第三步:更新源和软件
       sudo apt-get update 更新源  
       sudo apt-get upgrade 更新软件

    二、通过dockerfile更换ubuntu镜像中的源为阿里源

    在dockerfile中增加如下步骤:

    RUN sed -i s/archive.ubuntu.com/mirrors.aliyun.com/g /etc/apt/sources.list
        && sed -i s/security.ubuntu.com/mirrors.aliyun.com/g /etc/apt/sources.list
        && apt-get update && apt-get upgrade

  • 相关阅读:
    使用 virtualenv/venv 和 pip 管理虚拟环境
    Python:virtualenv 和 venv 的区别
    Python | Get unique values from a list
    Python ORM 框架 Peewee 知识点
    python之配置日志的几种方式
    python 中的 None,知识点
    Gunicorn 知识点
    gunicorn部署flask的log处理
    Python 逻辑运算符(and、or、not)、成员运算符(in、not in)、身份运算符(is、is not)
    Python 中没有 null,用 None 表示
  • 原文地址:https://www.cnblogs.com/web424/p/7483454.html
Copyright © 2011-2022 走看看