1.背景
新装Ubuntu16.04系统,修改apt安装包的源地址,加快访问。
2.问题现象
输入sudo apt-get install vim
显示如下报错信息:
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package vim is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package ‘vim’ has no installation candidate
3.解决方法
解决办法就是修改软件源设置
1.备份源文件,cp -i /etc/apt/sources.list /etc/apt/sources.list_backup
2.打开sources.list:
sudo gedit /etc/apt/sources.list
3.在源文件中加入如下阿里巴巴的阿里云服务器的地址并保存。(当然也可以是其他公司的地址)
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
4.更新命令:sudo apt-get update
5.更新后,再安装vim,例如sudo apt-get install vim
4.感谢
内容源自博文https://blog.youkuaiyun.com/sinat_33363493/article/details/51284358 感谢博主分享。