Ubuntu虚拟机更换清华源

参考链接:

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

1、Ubuntu打开终端:
sudo使用gedit修改/etc/apt/sources.list的内容:

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

2、根据链接内修改Ubuntu版本,
文件内修改为:

# 默认注释了源码镜像以提高 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 http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/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

保存后回到终端。

3、终端输入更新指令:

sudo apt-get update
Ubuntu 的软件源设置文件位于 `/etc/apt/sources.list`,我们可以通过修改该文件来更换镜像源。 以下是更换为阿里云镜像源的步骤: 1. 备份原有的软件源设置文件 ```bash sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak ``` 2. 使用文本编辑器打开 `/etc/apt/sources.list` 文件 ```bash sudo nano /etc/apt/sources.list ``` 3. 将原有的内容注释掉,添加阿里云镜像源的内容 ```bash # 以下为原有的内容,注释掉 # deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse # deb-src http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse # deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse # deb-src http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse # deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse # deb-src http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse # deb http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse # deb-src http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse # 以下为阿里云镜像源的内容 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-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-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports 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 ``` 4. 保存并退出编辑器 按下 `Ctrl + X`,然后按下 `Y` 确认保存。 5. 更新软件源 ```bash sudo apt update ``` 现在,你已经成功更换 Ubuntu 的镜像源了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值