Ubuntu18.04 更换阿里云源

  1. # 备份
  2. sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
  3. # 修改
  4. sudo vim /etc/apt/sources.list

文件内容:

  1. ## Note, this file is written by cloud-init on first boot of an instance
  2. ## modifications made here will not survive a re-bundle.
  3. ## if you wish to make changes you can:
  4. ## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg
  5. ## or do the same in user-data
  6. ## b.) add sources in /etc/apt/sources.list.d
  7. ## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl
  8. # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
  9. # newer versions of the distribution.
  10. deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic main
  11. deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic main
  12. ## Major bug fix updates produced after the final release of the
  13. ## distribution.
  14. deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates main
  15. deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates main
  16. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  17. ## team. Also, please note that software in universe WILL NOT receive any
  18. ## review or updates from the Ubuntu security team.
  19. deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic universe
  20. deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic universe
  21. deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates universe
  22. deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates universe
  23. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  24. ## team, and may not be under a free licence. Please satisfy yourself as to
  25. ## your rights to use the software. Also, please note that software in
  26. ## multiverse WILL NOT receive any review or updates from the Ubuntu
  27. ## security team.
  28. # deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic multiverse
  29. # deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic multiverse
  30. # deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates multiverse
  31. # deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-updates multiverse
  32. ## Uncomment the following two lines to add software from the 'backports'
  33. ## repository.
  34. ## N.B. software from this repository may not have been tested as
  35. ## extensively as that contained in the main release, although it includes
  36. ## newer versions of some applications which may provide useful features.
  37. ## Also, please note that software in backports WILL NOT receive any review
  38. ## or updates from the Ubuntu security team.
  39. # deb http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-backports main restricted universe multiverse
  40. # deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ bionic-backports main restricted universe multiverse
  41. ## Uncomment the following two lines to add software from Canonical's
  42. ## 'partner' repository.
  43. ## This software is not part of Ubuntu, but is offered by Canonical and the
  44. ## respective vendors as a service to Ubuntu users.
  45. # deb http://archive.canonical.com/ubuntu bionic partner
  46. # deb-src http://archive.canonical.com/ubuntu bionic partner
  47. deb http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security main
  48. deb-src http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security main
  49. deb http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security universe
  50. deb-src http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security universe
  51. # deb http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security multiverse
  52. # deb-src http://mirrors.cloud.aliyuncs.com/ubuntu bionic-security multiverse
  1. # 更新
  2. sudo apt update

华为云源

  1. sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak
  2. wget -O /etc/apt/sources.list http://mirrors.myhuaweicloud.com/repo/sources.list.bionic
  3. sudo apt update