錯誤信息
root@DESKTOP-QT1PCA1:/mnt/c/Users/micoc/Desktop/wrk# sudo apt-get install gcc-multilib
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
gcc-multilib : Depends: gcc-5-multilib (>= 5.3.1-3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
看下souces.list:
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
好像不太對勁,之前隨便搜了個ubuntu的國內軟件源,咋安裝不上包呢?
源文件備份
我們要修改的文件是sources.list,它在目錄/etc/apt/下,sources.list是包管理工具apt所用的記錄軟件包倉庫位置的配置文件,同樣類型的還有位于 同目錄下sources.list.d文件下的各種.list后綴的各文件。命令如下:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
查看系統代號
使用如下命令:
root@DESKTOP-QT1PCA1:/mnt/c/Users/micoc/Desktop/wrk# lsb_release -c
Codename: bionic
我們可以看到新版本的Ubuntu系統代號為bionic
同樣的我們也可以得到之前任意版本的系統代號:
Ubuntu 12.04 (LTS)代號為precise。
Ubuntu 14.04 (LTS)代號為trusty。
Ubuntu 15.04 代號為vivid。
Ubuntu 15.10 代號為wily。
Ubuntu 16.04 (LTS)代號為xenial。
所以這也就解釋了為什么我們百度出來的那么多方案里面內容不盡相同的原因,因為他們更改apt安裝源時用的系統不一樣。
4.將原有的內容刪除,添加以下內容
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 multiverse
值得注意的是sources.list文件的條目都是有格式的,后面幾個參數是對軟件包的分類(Ubuntu下是main, restricted,universe ,multiverse這四個)
更新軟件列表
sudo apt-get update
更新軟件包
sudo apt-get upgrade