常常需要获取工具,因为系统自带的下载源是国外的,这就导致下载失败了,在查找失败原因的时候,各位大佬的帖子都说换个国内的源就好了。下面就是更换下载源的步骤及遇到的问题,记录一下,也分享给大家,如有不足,请各位大佬指点指点。
更换下载源应该备份下载源文件更保险;
cp /etc/apt/sources.list /etc/apt/sources.list.bak
修改源地址:
vim /etc/apt/sources.list
进入之后只需要把原来的源加‘#’注释掉就好,我这边用的是清华的源,里面可以选择ubantu版本获得下载源链接:
https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
进入网址里面的内容,复制红色框起来的下载源的文字去Linux修改源的文件sources.list里。
修改好之后我们需要运行更新源指令
sudo apt-get update
我这边一致报404错误,如下:
Err:17 http://ppa.launchpad.net/fcitx-team/nightly/ubuntu bionic Release
404 Not Found [IP: 91.189.95.83 80]
Reading package lists... Done
E: The repository 'http://ppa.launchpad.net/fcitx-team/nightly/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
实际上,每次update的过程就是在遍历/etc/apt/sources.list.d 下的所有list,只要删除相应报错的list文件,update将正常完成。以我的报错为例:
进入到sources.list.d目录
cd /etc/apt/sources.list.d
会有两个文件,只要把这两个删除掉就可以了
这两个文件
fcitx-team-ubuntu-nightly-bionic.list
fcitx-team-ubuntu-nightly-bionic.list.save
删除这两个lish文件
sudo rm fcitx-team-ubuntu-nightly-bionic.list
sudo rm fcitx-team-ubuntu-nightly-bionic.list.save
然后我们在运行update更新源指令就可以正常完成了。