[SSH] Ubuntu18.04安装openssh-server

安装步骤

1 安装openssh-client

sudo apt-get install openssh-client

2 安装openssh-server

sudo apt-get install openssh-service

3 启动ssh服务

sudo service ssh start

然后可以查看ssh服务是否开启成功。

sudo ps -e | grep ssh

然后要远程登陆,可以查看用ipconfig查看地址,如果出现command not found,则说明没有安装这个包。

sudo apt install net-tools

apt-get install与apt install的区别前者是老版的用法,后者是新版的用法。apt与apt-get有一些类似的命令选项,但是apt并不能向下兼容apt-get。

花絮踩坑记

1 第一个坑:ubuntu 18.04: Unable to locate package openssh-service

sudo apt-get update
sudo apt-get upgrade
sudo apt-get update

2 第二个坑:openssh-client版本问题

执行sudo apt-get install -y openssh-server,出现问题
在这里插入图片描述 这是因为,openssh-server是依赖于openssh-clien的,ubuntu自带了openssh-client,自带的openssh-clien与所要安装的openssh-server所依赖的版本不同。
要安装合适的版本,可以sudo apt-get install openssh-client=1:7.2p2-4ubuntu2.8.
然后再安装openssh-server即可。

发布了10 篇原创文章 · 获赞 0 · 访问量 3878

猜你喜欢

转载自blog.csdn.net/coolljp21/article/details/104090258