ubuntu18.04更新源
时间: 2023-12-04 22:31:25 浏览: 77
要更新Ubuntu 18.04的软件源,请按照以下步骤操作:
1. 打开终端。
2. 输入以下命令,备份当前的源列表:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
3. 执行以下命令,打开源列表文件:
```
sudo nano /etc/apt/sources.list
```
4. 在文件中,注释掉原来的源地址,添加新的源地址。具体操作方法如下:
- 注释掉原来的源地址:在每行源地址的前面添加“#”号,表示该行被注释掉了。
```
#deb http://cn.archive.ubuntu.com/ubuntu/ bionic main restricted
#deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
#deb http://cn.archive.ubuntu.com/ubuntu/ bionic universe
#deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates universe
#deb http://cn.archive.ubuntu.com/ubuntu/ bionic multiverse
#deb http://cn.archive.ubuntu.com/ubuntu/ bionic-updates multiverse
#deb http://cn.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
#deb http://security.ubuntu.com/ubuntu bionic-security main restricted
#deb http://security.ubuntu.com/ubuntu bionic-security universe
#deb http://security.ubuntu.com/ubuntu bionic-security multiverse
```
- 添加新的源地址:在文件末尾添加以下源地址(可以根据自己的需要修改):
```
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
```
5. 保存文件并退出编辑器。
6. 输入以下命令,更新源列表并升级软件:
```
sudo apt-get update && sudo apt-get upgrade
```
7. 等待更新完成后,重启计算机。
现在,您的Ubuntu 18.04已经更新到最新的软件源了。
阅读全文