ubuntu18.04 换源
时间: 2023-10-20 17:32:11 浏览: 106
要将Ubuntu 18.04更换为国内的软件源,可以按照以下步骤进行操作:
1. 打开终端,使用管理员权限运行以下命令备份原来的软件源列表:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2. 编辑软件源列表文件:
```
sudo nano /etc/apt/sources.list
```
3. 将原来的内容注释掉(在每一行前面添加“#”),然后粘贴下面的内容到文件中:
```
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
# deb-src http://archive.ubuntu.com/ubuntu/ bionic main restricted
# 默认注释了官方源码镜像以提高 apt update 速度,如有需要可自行取消注释
# deb-src http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
## 国内源
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb 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 main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
# 预发布软件源,不建议启用
# deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
# Canonical 合作伙伴和附加
deb http://archive.canonical.com/ubuntu/ bionic partner
deb-src http://archive.canonical.com/ubuntu/ bionic partner
```
4. 保存并退出编辑器(按Ctrl + X,然后按Y键,最后按Enter键)。
5. 更新软件源并升级软件包:
```
sudo apt update
sudo apt upgrade
```
现在,你的Ubuntu 18.04系统已经更换为国内的软件源。
阅读全文