ubuntu更换国内源

ubuntu更换国内源ubuntu16.04和18.04更换国内源写在前面:安装好ubuntu双系统后,默认的软件更新源是国外的,在国内使用速度很慢,用”aptinstallxxx”安装软件时可能出现”网络不可达”、”你的网络需要认证吗”、”无法定位软件包”等错误,所以我们需要更换成国内的源,这样才能正常安装和更新软件。一、ubuntu16.04更换国内源1.备份原始源文件source.list桌面…

大家好,又见面了,我是你们的朋友全栈君。

写在前面:安装好ubuntu双系统后,默认的软件更新源是国外的,在国内使用速度很慢,用”apt install xxx”安装软件时可能出现”网络不可达”、”你的网络需要认证吗”、”无法定位软件包”等错误,所以我们需要更换成国内的源,这样才能正常安装和更新软件。

下面这些是国内主要的镜像源网站。

———————————————————————

阿里源     https://developer.aliyun.com/mirror/
清华源     https://mirrors.tuna.tsinghua.edu.cn/
华科源     http://mirrors.ustc.edu.cn/
网易源     http://mirrors.163.com/
———————————————————————

1.备份原始源文件source.list

打开终端,执行命令:sudo  cp   /etc/apt/sources.list   /etc/apt/sources.list.bak

2.修改源文件sources.list

(1)终端执行命令:sudo  chmod  777  /etc/apt/sources.list   更改文件权限使其可编辑;

(2)执行命令:       sudo  gedit   /etc/apt/sources.list             打开文件进行编辑;

(3)删除原来的文件内容,根据系统版本复制下面的任意一个到其中并保存(常用的是阿里源和清华源,推荐阿里源);

阿里源:

ubuntu 16

deb http://mirrors.aliyun.com/ubuntu/ xenial main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main

deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main

deb http://mirrors.aliyun.com/ubuntu/ xenial universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe

deb http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main
deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe

 unbuntu 18

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

ubuntu 20

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

3.更新源

终端执行命令:

sudo apt update。  更新软件列表,换源完成。update 是同步 /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,这样才能获取到最新的软件包。

复损坏的软件包,尝试卸载出错的包,重新安装正确版本的  sudo  apt-get   install  -f

更新软件  sudo apt-get upgrade。  upgrade 是升级已安装的所有软件包,升级之后的版本就是本地索引里的,因此,在执行 upgrade 之前一定要执行 update, 这样才能是最新的。




其他换源方法

还有一种更简单的方法,打开”软件更新器”,依次点击”设置”,”Ubuntu软件”,在”下载自”后面的窗口选择 “其它站点”在其中找到清华大学镜像站选择即可。
修改完软件源后,更新软件列表和软件

sudo apt update
sudo apt upgrade

如果在软件更新器里修改源,会自动刷新软件列表并检查更新,依据向导来即可。

—————————————————————————–

|  大家还有什么好的方法或者建议,不妨留言分享出来!  |

—————————————————————————–


debian

方法:

1,先备份源:sudo  cp    /etc/apt/sources.list    /etc/apt/sources.list.bak

2,增加国内的新源  sudo  gedit   /etc/apt/sources.list

输入以下的源地址

deb http://mirrors.ustc.edu.cn/debian/ buster main
deb-src http://mirrors.ustc.edu.cn/debian/ buster main

deb http://mirrors.ustc.edu.cn/debian-security buster/updates main
deb-src http://mirrors.ustc.edu.cn/debian-security buster/updates main

deb http://mirrors.ustc.edu.cn/debian/ buster-updates main
deb-src http://mirrors.ustc.edu.cn/debian/ buster-updates main

3,更新

apt-get update

Debian 镜像

简介

Debian GNU/Linux ,是一个操作系统及自由软件的发行版,由一群自愿付出时间和精力的用户来维护并更新。它附带了超过 59000 个软件包,这些预先编译好的软件被打包成一种良好的格式以便于用户安装和使用。

下载地址: 阿里云开源镜像站资源目录

阿里云开源镜像站资源目录

配置方法

debian 7.x (wheezy)

编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)

deb http://mirrors.aliyun.com/debian-archive/debian/ wheezy main non-free contrib
deb http://mirrors.aliyun.com/debian-archive/debian/ wheezy-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian-archive/debian/ wheezy main non-free contrib
deb-src http://mirrors.aliyun.com/debian-archive/debian/ wheezy-proposed-updates main non-free contrib

debian 8.x (jessie)

编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)

deb http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ jessie-proposed-updates main non-free contrib

debian 9.x (stretch)

编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)

deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
deb http://mirrors.aliyun.com/debian-security stretch/updates main
deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib

debian 10.x (buster)

编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)

deb http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster main non-free contrib
deb http://mirrors.aliyun.com/debian-security buster/updates main
deb-src http://mirrors.aliyun.com/debian-security buster/updates main
deb http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ buster-backports main non-free contrib

debian 11.x (bullseye)

编辑/etc/apt/sources.list文件(需要使用sudo), 在文件最前面添加以下条目(操作前请做好相应备份)

deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb-src http://mirrors.aliyun.com/debian-security/ bullseye-security main
deb http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib
deb http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
deb-src http://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/135909.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 机器学习方法:回归(三):最小角回归Least Angle Regression(LARS),forward stagewise selection

    机器学习方法:回归(三):最小角回归Least Angle Regression(LARS),forward stagewise selection前面两篇回归(一)(二)复习了线性回归,以及L1与L2正则——lasso和ridgeregression。特别描述了lasso的稀疏性是如何产生的。在本篇中介绍一下和lasso可以产生差不多效果的两种方法:stagewise和LARS

    2022年6月29日
    43
  • python基础语法记录

    python基础语法记录1 代码中包含中文 就需要在头部指定编码 Python3 源码文件默认使用 utf 8 编码 所以可以正常解析中文 无需指定 UTF 8 编码 注意 如果你使用编辑器 同时需要设置 py 文件存储的格式为 UTF 8 coding utf 8 coding UTF 8 2 实例缩进为四个空格如输入 table 键或非四空格报错 IndentationE unindentdoes

    2025年9月7日
    3
  • hadoop namenode热备切换过程和secondarynamenode的作用

    hadoop namenode热备切换过程和secondarynamenode的作用hadoop namenode热备切换过程和secondarynamenode的作用

    2022年4月23日
    60
  • Python学习(十一)Python标识符命名规范

    Python学习(十一)Python标识符命名规范简单地理解,标识符就是一个名字,就好像我们每个人都有属于自己的名字,它的主要作用就是作为变量、函数、类、模块以及其他对象的名称。Python中标识符的命名不是随意的,而是要遵守一定的命令规则,比如说:1.标识符是由字符(A~Z和a~z)、下划线和数字组成,但第一个字符不能是数字。2.标识符不能和Python中的保留字相同。有关保留字,后续章节会详细介绍。3.Python中的标…

    2025年10月15日
    4
  • javac 与 java的区别[通俗易懂]

    javac 与 java的区别[通俗易懂]java编译器名称是javac,是将源文件编译为字节码文件的程序,而java是java解释器的名称,也就是解释和执行字节码文件的程序。注意:::java源文件必须是具有  .java 扩展名java字节码文件必须具有  .class 扩展名 javac可以将java源文件编译为class字节码文件如javacHelloWorld.java运行javac命令后,如果成功编译没有错误的话…

    2022年5月15日
    58
  • 单片机指令周期_PIC单片机每MHZ多少指令

    单片机指令周期_PIC单片机每MHZ多少指令单片机指令周期传统的经典51单片机有,时钟周期、机器周期、指令周期,意义各不相同,下文做以分析。时钟周期:单片机外接晶振的震荡周期就是时钟周期,时钟周期=晶振震荡周期。例如,外接11.0592MHz的晶振那么时钟周期就是1/11.0592M。机器周期:MCU执行指令所消耗的最小时间单位。51单片机采用精简指令集(多嵌入式微处理器都是RISC,例如常用的ARM,MIPS,POWERPC等),部分指令所消耗的机器周期个数不一样,但必须是机器周期的整倍数。再此基础上,机器周期又划分为6个状态周期,S

    2022年10月13日
    4

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号