1.问题:ubuntu 通过apt-get install命令安装openssh-server服务时,报错:“E: Package 'openssh-server' has no installation candidate”ubuntu 通过apt-get install命令安装openssh-server服务时,报错:“E: Package 'openssh-server' has no installation candidate”
2.解决办法:更换软件更新源
(1)先执行sudo apt-get update,会生成/etc/qpt/sources.list文件
(2)备份/etc/apt/sources.list
sudo cp -i /etc/apt/sources.list /etc/apt/sources.list.backup
(3)更改文件权限使其可编辑
sudo chmod 777 /etc/apt/source.list
(4)打开souces.list文件,将软件更新源替换为国内源:
vim /etc/apt/source.list
添加如下内容:
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
(5)执行安装命令:
sudo apt-get update
sudo apt-get install openssh-server
(6)安装完成后手动开启服务
sudo /etc/init.d/ssh start
(7)查看安装版本

