当前位置:   article > 正文

ubuntu 更换国内镜像源_ubuntu改用国内的镜像

ubuntu改用国内的镜像

备份源文件

cp /etc/apt/sources.list /etc/apt/sources.list.bak

查询镜像源

原则对应的版本进行安装

清华源

Index of /ubuntu/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror

中科大源

Index of /ubuntu-releases/ (ustc.edu.cn)

网易镜像源

Index of /ubuntu-releases/

阿里云镜像源

ubuntu-releases安装包下载_开源镜像站-阿里云 (aliyun.com)

编辑替换镜像源

这里以阿里云为例

sed -i "s#http://archive.ubuntu.com/ubuntu/#http://mirrors.aliyun.com/ubuntu-releases/20.04/#g" /etc/apt/sources.list

查看替换好的源文件

cat sources.list
  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/ jammy main restricted
  4. # deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted
  5. ## Major bug fix updates produced after the final release of the
  6. ## distribution.
  7. deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
  8. # deb-src http://archive.ubuntu.com/ubuntu/ jammy-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/ jammy universe
  13. # deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
  14. deb http://archive.ubuntu.com/ubuntu/ jammy-updates universe
  15. # deb-src http://archive.ubuntu.com/ubuntu/ jammy-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/ jammy multiverse
  22. # deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse
  23. deb http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
  24. # deb-src http://archive.ubuntu.com/ubuntu/ jammy-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/ jammy-backports main restricted universe multiverse
  31. # deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
  32. deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted
  33. # deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted
  34. deb http://security.ubuntu.com/ubuntu/ jammy-security universe
  35. # deb-src http://security.ubuntu.com/ubuntu/ jammy-security universe
  36. deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse
  37. # deb-src http://security.ubuntu.com/ubuntu/ jammy-security multiverse
  38. root@da9676fe8449:/etc/apt# sed -i "s/http://archive.ubuntu.com/ubuntu//http://mirrors.ustc.edu.cn/ubuntu-releases/20.04//g" /etc/apt/sources.list;
  39. sed: -e expression #1, char 10: unknown option to `s'
  40. root@da9676fe8449:/etc/apt# sed -i "s#http://archive.ubuntu.com/ubuntu/#http://mirrors.aliyun.com/ubuntu-releases/20.04/#g" /etc/apt/sources.list
  41. root@da9676fe8449:/etc/apt# cat sources.list
  42. # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
  43. # newer versions of the distribution.
  44. deb http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy main restricted
  45. # deb-src http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy main restricted
  46. ## Major bug fix updates produced after the final release of the
  47. ## distribution.
  48. deb http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy-updates main restricted
  49. # deb-src http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy-updates main restricted
  50. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  51. ## team. Also, please note that software in universe WILL NOT receive any
  52. ## review or updates from the Ubuntu security team.
  53. deb http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy universe
  54. # deb-src http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy universe
  55. deb http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy-updates universe
  56. # deb-src http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy-updates universe
  57. ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
  58. ## team, and may not be under a free licence. Please satisfy yourself as to
  59. ## your rights to use the software. Also, please note that software in
  60. ## multiverse WILL NOT receive any review or updates from the Ubuntu
  61. ## security team.
  62. deb http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy multiverse
  63. # deb-src http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy multiverse
  64. deb http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy-updates multiverse
  65. # deb-src http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy-updates multiverse
  66. ## N.B. software from this repository may not have been tested as
  67. ## extensively as that contained in the main release, although it includes
  68. ## newer versions of some applications which may provide useful features.
  69. ## Also, please note that software in backports WILL NOT receive any review
  70. ## or updates from the Ubuntu security team.
  71. deb http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy-backports main restricted universe multiverse
  72. # deb-src http://mirrors.aliyun.com/ubuntu-releases/20.04/ jammy-backports main restricted universe multiverse
  73. deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted
  74. # deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted
  75. deb http://security.ubuntu.com/ubuntu/ jammy-security universe
  76. # deb-src http://security.ubuntu.com/ubuntu/ jammy-security universe
  77. deb http://security.ubuntu.com/ubuntu/ jammy-security multiverse
  78. # deb-src http://security.ubuntu.com/ubuntu/ jammy-security multiverse

这样镜像源就更换成功了!

最后,更新软件源

apt-get update
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号