1.使用命令 sudo vim /etc/apt/sources.list 编辑源列表中的源地址信息,将其中的地址全部删除或者注释,换成以下下格式
- deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multivers
复制代码
2.更新软件列表
运行如下命令:
这个命令,会访问源列表里的每个网址,并读取软件列表,然后保存在本地电脑。软件包管理器里看到的软件列表,都是通过update命令更新的。
3.更新本地软件包
运行如下命令:
这个命令,会把本地已安装的软件,与刚下载的软件列表里对应软件进行对比,如果发现已安装的软件版本太低,就会提示你更新。
在执行这个命令的时候我收到以下错误提示,没有请忽略
- E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarly unavailable)
- E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is an other process using it?
复制代码 删除锁定文件就可以sudo rm /var/lib/dpkg/lock-frontend
sudo rm /var/lib/dpkg/lock
输入Yes开始更新本地列表,注意如果没出现 0added,0 remove,done. 升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。 那就再执行一次 sudo apt-get upgrade |