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


相关推荐

  • python替换文件的某个字符串_用Python替换文件中的字符串

    python替换文件的某个字符串_用Python替换文件中的字符串将所有这些代码放入一个名为mass_replace的文件中.在Linux或MacOSX下,您可以执行chmodxmass_replace,然后运行此操作.在Windows下,您可以使用pythonmass_replace后跟相应的参数来运行它.#!/usr/bin/pythonimportosimportreimportsys#listofextensionstorepl…

    2022年5月23日
    151
  • 国内教育邮箱有什么用_学校教育网邮箱

    国内教育邮箱有什么用_学校教育网邮箱教育优惠,是一项针对于在校大学生和教职员工推出的特殊优惠活动。一些公司会将旗下产品或服务以一定的折扣,甚至免费提供给高校师生。想想自己上大学的时候啥都不知道,毕业后才发现浪费了这么多优秀的资源.如果你还是一名在校大学生,那么就不要错过以下的这些教育优惠了,不然真的是失去后才会追悔莫及.申请教育优惠一般有一个前提,那就是要有一个学校提供的「校园邮箱」.在国内,也就是@xxx.edu.cn结尾……

    2022年9月23日
    3
  • 前端缓存方案「建议收藏」

    前端缓存方案「建议收藏」前端几种本地缓存机制_蜗牛小前的博客-CSDN博客_前端本地缓存在漫长的前端开发过程中,我们常用的几种本地缓存机制:Cookie,LocalStorge,SessionStorge1.Cookie的特点1)cookie的大小受限制,cookie大小被限制在4KB,不能接受像大文件或邮件那样的大数据。2)只要有请求涉及cookie,cookie就要在服务器和浏览器之间来回传送(这解释为什么本地文件不能测试cookie)。而且coo…https://blog.csdn.net/weixin_397170..

    2025年7月10日
    2
  • AAA认证及RADIUS配置「建议收藏」

    AAA认证及RADIUS配置「建议收藏」AAA认证及RADIUS配置AAA简介AAA是Authentication,AuthorizationandAccounting(认证、授权和计费)的简称,它提供了一个对认证、授权和计费这三种安全功能进行配置的一致性框架,实际上是对网络安全的一种管理。这里的网络安全主要是指访问控制,包括:.哪些用户可以访问网络服务器。.具有访问权的用户可以得到…

    2022年5月25日
    63
  • SpringBoot整合Swagger2「建议收藏」

    SpringBoot整合Swagger2「建议收藏」SpringBoot整合Swagger2

    2022年4月23日
    42
  • sql第九章简答题_sql语句declare用法

    sql第九章简答题_sql语句declare用法文章目录第二十六章SQL命令DECLARE大纲参数描述游标名称通过游标更新示例第二十六章SQL命令DECLARE声明游标大纲DECLAREcursor-nameCURSORFORquery参数cursor-name-游标的名称,必须以字母开头,并且仅包含字母和数字。(游标名称不遵循SQL标识符约定)。游标名称区分大小写。它们受其他命名限制的约束,如下所述。query-定义游标结果集的标准SELECT语句。此选择可以包括%NOFPLAN关键字,以指定应忽略此查询的

    2022年8月20日
    4

发表回复

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

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