ubantu系统安装ssh

ssh连接ubantu系统

描述:新安装的ubantu系统,ssh连接发现22端口拒绝,登陆服务器发现没有ssh

1.安装ssh服务

1  apt-get install openssh-server

报错:

1 # apt-get install opens-server
2 Reading package lists... Done
3 Building dependency tree... Done
4 Package aptitude is not available, but is referred to by another package.
5 This may mean that the package is missing, has been obsoleted, or
6 is only available from another source
7 E: Package has no installation candidate

2.解决

2.1 update && upgrade

1 apt-get update #如果提示失败,执行下一条命令
2 apt-get upgrade 
update和upgrade区别:
  • update的作用是从/etc/apt/source.list文件中定义的源中去同步包的索引文件,即运行这个命令其实并没有更新软件,而是相当于windows下面的检查更新,获取的是软件的状态。
  • 而upgrade则是更据update命令同步好了的包的索引文件,去真正地更新软件。

此时重新安装安装,成功

1 apt-get install openssh-server

2.2 更换源

如果还是失败,可以尝试更换源:

1 vim /etc/apt/sources.list

参考:

  163源地址:http://mirrors.163.com/.help/ubuntu.html

 

posted @ 2018-05-25 13:02  杨佳楠丶  阅读(487)  评论(0编辑  收藏  举报