解决Ubuntu安装vim的Package vim has no installation candidate问题

当输入sudo apt-get install vim-gtk
出现了下面问题:

1
2
3
4
5
6
7
8
nigel@yq-ubuntu:~/worksp$ sudo apt-get install vim-gtk
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package vim-gtk 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-gtk' has no installation candidate

解决办法就是修改软件源设置

  1. 备份源文件,cp -i /etc/apt/sources.list /etc/apt/sources.list_backup
  2. 打开sources.list,root@ubuntu:/etc/apt# gedit sources.list
  3. 在源文件中加入如下阿里巴巴的阿里云服务器的地址并保存。(当然也可以是其他公司的地址)
1
2
3
4
5
6
7
8
9
10
11
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
  1. 更新:apt-get update
  2. 更新后,再安装vim,sudo apt-get install vim

这样问题就解决了。


163源

1
2
3
4
5
6
7
8
9
10
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ trusty-backports main restricted universe multiverse