• ubuntu更换apt-get为国内镜像


    ubuntu更换apt为国内下载

    新操作

    参考 :https://blog.csdn.net/qq_21095573/article/details/99736630

    最近发现...不同版本的Ubuntu的镜像地址还是有区别的,比如阿里云就进行了区分

    阿里云官方镜像站
    进去里面,找到Ubuntu的

    #备份
    sudo mv /etc/apt/sources.list /etc/apt/sources.list.back
    sudo vim /etc/apt/sources.list
    进入之后,输入 i,或者点击insert 进入插入模式
    复制对应版本的镜像地址,贴入
    保存:按esc 键,然后输入 :wq  (:不能忽略),回车即可
    刷新镜像
    
    sudo apt-get update
    #这个命令,会访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑。
    #我们在新立得软件包管理器里看到的软件列表,都是通过update命令更新的。
    sudo apt-get upgrade
    #这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,如果发现已安装的软件版本太低,
    #就会提示你更新。如果你的软件都是最新版本,会提示:
    #    升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
    

    旧操作

    #进入文件夹:
    cd /etc/apt
    #将文件重命名为sources.list.backup--备份
    sudo mv sources.list sources.list.backup
    #新建sources.list文件。(这样目的是以防出问题时候,还可以把sources.list改回来)
    sudo vim sources.list
    
    #设置国内源
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
    deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
    deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
    
    
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
    deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
    # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
    
    deb http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
    deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
    deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
    deb http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
    deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty main multiverse restricted universe
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main multiverse restricted universe
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main multiverse restricted universe
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main multiverse restricted universe
    deb [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
    # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
    # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
    deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main multiverse restricted universe
    # deb-src [arch=amd64] https://download.docker.com/linux/ubuntu xenial stable
    
    #更新
    sudo apt-get update
    

    测试

    # 下载nginx,瞬间下载
    sudo apt-get install -y nginx
    
  • 相关阅读:
    性能学习笔记2-20150129
    Go语言版黑白棋
    Go语言图形界面开发:Go版GTK
    Go入门教程
    本人录制的视频资源(C/C++、Go、Qt、Linux等)
    C++11新特性学习
    protobuf入门教程
    一步步学习Linux多任务编程
    Linux 网络编程系列教程
    一步一步学习GTK+
  • 原文地址:https://www.cnblogs.com/ziyue7575/p/13897839.html
Copyright © 2020-2023  润新知