Ubuntu 更换软件源的方法如下:1. 首先备份原有源列表:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2. 编辑 sources.list 文件:
sudo vim /etc/apt/sources.list
3. 将默认源地址修改为新的源地址,例如官方源:
deb Index of /ubuntu bionic main restricted deb Index of /ubuntu bionic-updates main restricted deb Index of /ubuntu bionic universe deb Index of /ubuntu bionic-updates universe deb Index of /ubuntu bionic multiverse deb Index of /ubuntu bionic-updates multiverse deb Index of /ubuntu bionic-backports main restricted universe multiverse deb Index of /ubuntu bionic-security main restricted deb Index of /ubuntu bionic-security universe deb Index of /ubuntu bionic-security multiverse
4. 保存并退出。5. 更新软件包索引:
sudo apt update
6. 就可以使用新的软件源了。7. 如果要恢复原来的源,将 sources.list 替换回 sources.list.bak 的备份即可。这样就可以方便地换成官方源或其他可用的源,来解决一些软件包无法找到的问题