Ubuntu15.1安装openssh-server

版权声明:本文为博主原创文章,转载请注明出处 https://blog.csdn.net/jingshuiliushen_zj/article/details/83473729

客户端电脑通过SSH访问Ubuntu服务器,服务器上必须得安装SSH-server才可以。
1、如果Ubuntu系统不是最新系统,需要更新apt-get:sudo apt-get update,如果更新失败,可能需要换源,即修改/etc/apt/sources.list文件:
(1)备份:sudo cp sources.list sources.list.bak
(2)sudo gedit /etc/apt/sources.list 修改文件内容,把原来文件内容删掉,替换成下面的:

# deb cdrom:[Ubuntu 15.10 _Wily Werewolf_ - Release amd64 (20151021)]/ wily main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ wily main restricted #Added by software-properties
 
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://old-releases.ubuntu.com/ubuntu/ wily main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ wily multiverse universe #Added by software-properties
 
## Major bug fix updates produced after the final release of the
## distribution.
deb http://old-releases.ubuntu.com/ubuntu/ wily-updates main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ wily-updates restricted multiverse main universe #Added by software-properties
 
## 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://old-releases.ubuntu.com/ubuntu/ wily universe
deb http://old-releases.ubuntu.com/ubuntu/ wily-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://old-releases.ubuntu.com/ubuntu/ wily multiverse
deb http://old-releases.ubuntu.com/ubuntu/ wily-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://old-releases.ubuntu.com/ubuntu/ wily-backports main restricted universe multiverse
deb-src http://old-releases.ubuntu.com/ubuntu/ wily-backports main restricted universe multiverse #Added by software-properties
 
deb http://old-releases.ubuntu.com/ubuntu/ wily-security main restricted
deb-src http://old-releases.ubuntu.com/ubuntu/ wily-security restricted multiverse main universe #Added by software-properties
deb http://old-releases.ubuntu.com/ubuntu/ wily-security universe
deb http://old-releases.ubuntu.com/ubuntu/ wily-security multiverse
 
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu wily partner
# deb-src http://archive.canonical.com/ubuntu wily partner

之前用别的源一直不好使,通过https://askubuntu.com/questions/848427/wily-old-release-repositories找到了问题,貌似是wily has been moved.

2、换源之后,执行sudo apt-get update,更新。
3、安装ssh:sudo apt-get install openssh-server。
4、用xshell连接虚拟机的ssh:
在这里插入图片描述
ssh的相关命令:
1、检查虚拟机ssh服务是否开启:service sshd status
2、启动SSH服务:service sshd start
重启:/etc/init.d/ssh restart

附:ubuntu镜像下载地址

ubuntu 14.04:
http://mirrors.aliyun.com/ubuntu-releases/14.04/
ubuntu 16.04:
http://mirrors.aliyun.com/ubuntu-releases/16.04/
ubuntu 18.04:
http://mirrors.aliyun.com/ubuntu-releases/18.04/

猜你喜欢

转载自blog.csdn.net/jingshuiliushen_zj/article/details/83473729