ubuntu18.04如何更换华为云的源
时间: 2023-06-13 18:05:23 浏览: 278
在Ubuntu 18.04(AGX板)部署ros2_foxy
你可以按照以下步骤更换华为云的源:
1.备份原有的源列表
首先,备份你的源列表文件,以便出现问题时可以恢复。在终端中输入以下命令备份:
```
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
```
2.编辑源列表文件
使用编辑器打开源列表文件。在终端中输入以下命令:
```
sudo nano /etc/apt/sources.list
```
3.替换为华为云源
将源列表文件中的所有内容替换为华为云的源,可以从华为云官网获取。例如,对于 Ubuntu 18.04,可以使用以下命令替换:
```
deb http://mirrors.huaweicloud.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.huaweicloud.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.huaweicloud.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.huaweicloud.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.huaweicloud.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.huaweicloud.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.huaweicloud.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.huaweicloud.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.huaweicloud.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.huaweicloud.com/ubuntu/ bionic-backports main restricted universe multiverse
```
4.更新源列表
保存更改并退出编辑器。在终端中输入以下命令,更新源列表:
```
sudo apt-get update
```
至此,你已经成功更换为华为云的源。
阅读全文