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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • yum 命令讲解「建议收藏」

    yum 命令讲解「建议收藏」(一)yum介绍Yum(全称为YellowdogUpdater,Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。yum提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。 …

    2022年5月5日
    47
  • SpringMVC之源码分析–ThemeResolver(一)

    SpringMVC之源码分析–ThemeResolver(一)

    2022年4月2日
    53
  • mysql 分区 扩充_mysql分区LVM扩容

    mysql 分区 扩充_mysql分区LVM扩容场景:mysql的数据库目录为/data随着数据量的增加,该分区不够用了,准备添加一块ssd硬盘,扩容该分区!下面是测试环境的整个过程:测试环境:在原有LVM卷标上添加一块50G的新硬盘对LVM进行扩容1、将添加的新硬盘进行分区:fdisk/dev/sdaWARNING:DOS-compatiblemodeisdeprecated.It’sstronglyrecommendedto…

    2022年6月20日
    27
  • 也许有用(也谈VC中ModifyStyle&ModifyStyleEx无法改变控件的Style)[通俗易懂]

    也许有用(也谈VC中ModifyStyle&ModifyStyleEx无法改变控件的Style)[通俗易懂] 一个View中用到了一个CListCtrl,在OnInitialUpdate函数里面他调用了m_listCtrl.ModifyStyleEx(0,LVS_EX_FULLROWSELECT);但是结果是并没有改变View中这个ListCtrl的效果。     仔细的查阅了MSDN的关于ModifyStyleEx的说明,发现没什么可以的地方,调试几遍发现也没异常,最后在网上一搜索Modi…

    2022年7月19日
    20
  • 什么是Promise,我们用它来做什么?[通俗易懂]

    什么是Promise,我们用它来做什么?[通俗易懂]一、什么是Promise?我们用Promise来解决什么问题?Promise是异步编程的一种解决方案:从语法上讲,promise是一个对象,从它可以获取异步操作的消息;从本意上讲,它是承诺,承诺它过一段时间会给你一个结果。promise有三种状态:pending(等待态),fulfiled(成功态),rejected(失败态);状态一旦改变,就不会再变。创造promise实例后,它会立即执行。我…

    2022年6月11日
    35
  • Linux查看MySQL版本的四种方法

    Linux查看MySQL版本的四种方法1在终端下执行mysql-V2在help中查找mysql–help|grepDistrib3在mysql里查看selectversion()4在mysql里查看status欢迎补充~转自:https://www.linuxidc.com/Linux/2016-10/136075.htm…

    2025年7月12日
    2

发表回复

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

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