ubuntu默认连接外网,下载速度慢,替换为国内的网络,速度快

    1. #1. 源配置文件是/etc/apt/sources.list文件
    2. # 备份源文件
    3. cp sources.list sources.list.bak
    4. # 编辑源
    5. vim sources.list

    源文件配置如下
    #开头的是注释
    focal是ubuntu版本,替换前边的网址即可

    1. # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
    2. # newer versions of the distribution.
    3. deb http://archive.ubuntu.com/ubuntu/ focal main restricted
    4. # deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted
    5. ## Major bug fix updates produced after the final release of the
    6. ## distribution.
    7. deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
    8. # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted
    9. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    10. ## team. Also, please note that software in universe WILL NOT receive any
    11. ## review or updates from the Ubuntu security team.
    12. deb http://archive.ubuntu.com/ubuntu/ focal universe
    13. # deb-src http://archive.ubuntu.com/ubuntu/ focal universe
    14. deb http://archive.ubuntu.com/ubuntu/ focal-updates universe
    15. # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe
    16. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
    17. ## team, and may not be under a free licence. Please satisfy yourself as to
    18. ## your rights to use the software. Also, please note that software in
    19. ## multiverse WILL NOT receive any review or updates from the Ubuntu
    20. ## security team.
    21. deb http://archive.ubuntu.com/ubuntu/ focal multiverse
    22. # deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse
    23. deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
    24. # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse
    25. ## N.B. software from this repository may not have been tested as
    26. ## extensively as that contained in the main release, although it includes
    27. ## newer versions of some applications which may provide useful features.
    28. ## Also, please note that software in backports WILL NOT receive any review
    29. ## or updates from the Ubuntu security team.
    30. deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    31. # deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse
    32. ## Uncomment the following two lines to add software from Canonical's
    33. ## 'partner' repository.
    34. ## This software is not part of Ubuntu, but is offered by Canonical and the
    35. ## respective vendors as a service to Ubuntu users.
    36. # deb http://archive.canonical.com/ubuntu focal partner
    37. # deb-src http://archive.canonical.com/ubuntu focal partner
    38. deb http://security.ubuntu.com/ubuntu/ focal-security main restricted
    39. # deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted
    40. deb http://security.ubuntu.com/ubuntu/ focal-security universe
    41. # deb-src http://security.ubuntu.com/ubuntu/ focal-security universe
    42. deb http://security.ubuntu.com/ubuntu/ focal-security multiverse
    43. # deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse

    例如换成阿里云的源

    1. deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    2. deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    3. deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    4. deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
    5. deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
    6. deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
    7. deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
    8. deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
    9. deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
    10. deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse