Ubuntu 20.04 更换国内apt源

编程教程 > Linux (2331) 2025-01-27 10:29:56

Ubuntu 20.04 更换国内apt源

第一步:备份源文件:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

第二步:编辑/etc/apt/sources.list文件

在文件最前面添加以下条目(操作前请做好相应备份):

sudo vi /etc/apt/sources.list

清华源

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse

第三步:执行更新命令:

sudo apt-get update

sudo apt-get upgrade

 

常用国内源:

阿里云源

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


中科大源

deb https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse


网易163源

deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse




 


评论
User Image
提示:请评论与当前内容相关的回复,广告、推广或无关内容将被删除。

相关文章
Ubuntu 20.04 更换国内apt源第一步:备份源文件:sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup第二步:编辑/e...
Ubuntu 20.04 安装netstat工具sudo apt install net-tools安装完成后即可使用netstat命令ubuntu@test-1:~$ sudo netstat...
Ubuntu 20.04 安装jdk8sudo apt-get install openjdk-8-jdk安装完成后查看版本java -version
PVE 7.x更换国内源备份之前的cp /etc/apt/sources.list.d/pve-install-repo.list /root删除企业源rm /etc/apt/sources.l...
ubuntu 禁用/启用防火墙iptablesUbuntu查看防火墙状态命令sudo ufw status Status: activeactive  -  启用inactive - 停用Ub...
一、ubuntu14.04版本1、配置静态IP地址:ubuntu(乌班图)各版本(14、16、18、20、22、23)网卡静态IP地址及DNS设置大全 - 哔哩
Ubuntu系统或者Linux系统都应该保证软件更新到最新,以减少软件漏洞导致服务器风险。Ubuntu系统更新软件主要分两步。第一步:更新软件源信息该操作只会更新软件最新的信息到本地,不会下载和安装。
更新包源索引sudo apt update查找某个软件可用版本通过apt search命令 apt search 通过apt show 命令apt show f
Ubuntu 硬盘分区扩容命令进行磁盘操作时请务必备份数据!!!事情是这样的,服务器系统盘是块 120GB 的 SSD,当时装系统的时候只给了 50GB,还剩下
ubuntu 配置sudo不需要输入密码Ubuntu单用用户配置sudo vi /etc/sudoers在打开文件的最下方添加以下行内容:ubuntu ALL=
PVE软件源更换禁用pve企业源mv/etc/apt/sources.list.d/pve-enterprise.list/etc/apt/sources.list.d/pve-enterpri...
警告描述W: https://mirrors.aliyun.com/docker-ce/linux/ubuntu/dists/jammy/InRelease: Key is stored in ...
Ubuntu禁用独立显卡方法
ubuntu / centos 高版本 均可参考临时生效命令sudo hostname your-hostname重启失效 永久生效 sudo hostname
snap 简介如果你在使用 Ubuntu 18.04/20.04 LTS 版本的 Ubuntu 系统,会发现系统里面多了一个应用格式包—— .snap 包。 S