切换ubuntu server的apt-get下载源为阿里云国内地址

    xiaoxiao2021-03-25  75

    最近开始学习用ubuntu server,使用apt-get的时候,用的是us的源。

    想改成国内阿里云的源,找了一圈,没找到具体的内容。我有装桌面版的ubuntu,所以把桌面版的sources.list拷贝下来,然后上传到server里面去,实现了切换ubuntu的源到阿里云了。

    ubuntu sources.list内容:

    # deb cdrom:[Ubuntu 16.04.1 LTS _Xenial Xerus_ - Release amd64 (20160719)]/ xenial main restricted # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## universe WILL NOT receive any review or updates from the Ubuntu security ## team. deb http://mirrors.aliyun.com/ubuntu/ xenial universe # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial multiverse deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse # deb-src http://cn.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu xenial partner # deb-src http://archive.canonical.com/ubuntu xenial partner deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted # deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe # deb-src http://security.ubuntu.com/ubuntu xenial-security universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse # deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse 使用方法:

    1、把上面内容保存为文件sources.list

    2、进入ubuntu server,cd /etc/apt

    3、把当前的源配置文件备份一下:sudo cp sources.list sources.list_backup

    4、上传刚才保存的sources.list文件到ubuntu server的/etc/apt目录下,覆盖旧文件。

    5、更新源:sudo apt-get update,可以看到下载源已经切换到aliyun了。

    如不知道如何上传文件,搜索ubuntu ftp上传。

    转载请注明原文地址: https://ju.6miu.com/read-33126.html

    最新回复(0)