在Ubuntu中ssh报错: connect to host localhost port 22: Connection refused 解决办法

     本人最近在Ubuntu 14.04上搭建Hadoop 2.5伪分布集群时偶然遇见ssh: connect to host localhost port 22: Connection refused 问题,尝试多种办法,最终得以解决,下面由我细细道来~~
      安装既定步骤进行完hadoop相关配置后,运行$ ./sbin/start-dfs.sh命令时终端显示如下:

➜  hadoop  ./sbin/start-dfs.sh 
Starting namenodes on [localhost]
localhost: ssh: connect to host localhost port 22: Connection refused
localhost: ssh: connect to host localhost port 22: Connection refused
Starting secondary namenodes [0.0.0.0]
0.0.0.0: ssh: connect to host 0.0.0.0 port 22: Connection refused
  

      怀疑ssh服务未启动,于是$ service sshd restart

➜  hadoop  service sshd restart
sshd: unrecognized service

      居然没有sshd服务,于是查了一下,本机初始状态安装的是openssh, 也不存在/etc/init.d/ssh这玩意儿,不能忍。于是怀疑本机22端口未开启,于是:

➜  hadoop  sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
➜  hadoop  ssh localhost                                      
ssh: connect to host localhost port 22: Connection refused

       还是不行!果断Google了一番(嘿嘿,个人热衷Google搜索,某度不敢恭维,在天朝当然得翻墙),当然搜了一圈,很多博客或论坛上的答复基本都是ps看是否启动ssh服务,然后重启。本人ssh登录公司服务器一点问题没有,登录localhost居然报错,于是怀疑子openssh安装可能出现问题,可能是openssh-server或者openssh-client,于是一股脑全部重装试试:

➜  hadoop  sudo apt-get install openssh-client openssh-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
openssh-client is already the newest version.
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 openssh-server : Depends: openssh-client (= 
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值