ubuntu20.04更换国内源
时间: 2023-04-12 21:00:24 浏览: 594
可以使用以下命令更换Ubuntu 20.04的国内源:
1.备份原有的源列表文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.编辑源列表文件
sudo gedit /etc/apt/sources.list
3.将原有的源地址替换为国内源地址,例如:
deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
4.更新源列表
sudo apt-get update
5.升级系统
sudo apt-get upgrade
请注意,更换源可能会影响系统的稳定性和安全性,请谨慎操作。
相关问题
ubuntu20.04 更换国内源
Ubuntu 20.04 是一款流行的 Linux 操作系统,为了提高软件包下载速度,很多用户会选择更换国内源。以下是更换 Ubuntu 20.04 国内源的步骤:
1.备份原有的源文件
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2.打开源文件
```
sudo gedit /etc/apt/sources.list
```
3.将文件中的内容全部替换为以下内容:
```
# 中科大源
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
```
4.保存并退出。
5.更新源列表
```
sudo apt-get update
```
6.测试新源是否生效
```
sudo apt-get install htop
```
如果可以正常安装,说明新源已经生效。
ubuntu20.04更换国内源 apt
您好!要在Ubuntu 20.04更换为国内的软件源,可以按照以下步骤操作:
1. 打开终端,可以使用快捷键Ctrl+Alt+T。
2. 备份当前的软件源列表,以防出现问题:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
```
3. 编辑软件源列表文件:
```
sudo nano /etc/apt/sources.list
```
4. 在打开的文件中,将原有的内容全部删除,然后将下面的内容粘贴进去:
对于阿里云源:
```
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# deb-src http://archive.ubuntu.com/ubuntu focal main restricted #Added by software-properties
# 阿里云源
deb https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
## Not recommended
# deb https://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
阅读全文