问题
今天在WSL Ubuntu中下载软件,下载总是失败,提示找不到软件包,经查找是软件源的问题. Linux系统中都有一个软件源的一个东西,就是下载软件的时候从哪个地方去找,跟window上的store一样,window只能从固定的地方下载,Linux可以改,也很方便的.
更换软件源
sudo vim /etc/apt/sources.list
打开软件源的列表 (不会vim可替换成gedit)-
添加数据源(这是我扒拉的阿里云软件源)
deb http://mirrors.aliyun.com/ubuntu/ xenial main deb-src http://mirrors.aliyun.com/ubuntu/ xenial main deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main deb http://mirrors.aliyun.com/ubuntu/ xenial universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial universe deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates universe deb http://mirrors.aliyun.com/ubuntu/ xenial-security main deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security universe
sudo apt update
更新源,改完之后更新一下才能用sudo apt upgrade
更新软件
还有好多数据源,有内部的有外部的,需要的话可自行查找。内部源可以下载内部才有的软件,比如学校内的软件源,可以下载学校自己出品的软件.
新问题
我把自带的源给删除了结果下载gcc和clang的时候不能下载,有些东西国内源里是没有的。。。
- 下边是Ubuntu 18.04 自带的(带#号的都是注释或隐藏源)
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://cn.archive.ubuntu.com/ubuntu bionic main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://cn.archive.ubuntu.com/ubuntu bionic-updates main restricted
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu bionic universe
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-updates universe
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://cn.archive.ubuntu.com/ubuntu bionic multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic multiverse
deb http://cn.archive.ubuntu.com/ubuntu bionic-updates multiverse
# deb-src http://cn.archive.ubuntu.com/ubuntu bionic-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://cn.archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse