问题描述
实验课需要用到SSH,命令是apt-get install ssh
,结果出现了错误信息:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package ssh 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
However the following packages replace it:
openssh-client
E: Package 'ssh' has no installation candidate
网上寻找解决办法发现可以用apt-get update
解决,遂执行之,然后在超长的等待之后还是不能用,这是因为ubuntu中默认使用的是官网的源,需要翻墙,这里可以用国内的源去替代,通过修改/etc/apt/sources.list来修改源。
解决方案
- 打开源列表文件
sudo gedit /etc/apt/sources.list
; - 打开清华大学开源软件镜像站;
- 将源列表替换成清华源,我这里是Ubuntu 16.04;
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse
- 再执行
sudo apt-get update
; - 再安装SSH
apt-get install ssh
就完全没有问题了;