请告诉我这里该怎么做。我正在尝试在 Ubuntu 中安装 Hadoop。ssh 连接出现错误
$ sudo apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
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:6.6p1-2ubuntu1) but 1:6.6p1-2ubuntu2 is to be installed
Recommends: ncurses-term but it is not going to be installed
Recommends: ssh-import-id but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:3a:a6:f3
inet addr:192.168.0.112 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe3a:a6f3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:15543 errors:0 dropped:0 overruns:0 frame:0
TX packets:10845 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:11839138 (11.8 MB) TX bytes:1448354 (1.4 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:2175 errors:0 dropped:0 overruns:0 frame:0
TX packets:2175 errors:0 dropped:0 overruns:0
carrier:0 collisions:0 txqueuelen:0
RX bytes:217643 (217.6 KB) TX bytes:217643 (217.6 KB)
$ sudo apt-get install openssh-server
Some packages could not be installed.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
openssh-server :
Depends: openssh-client (= 1:6.6p1-2ubuntu1) but 1:6.6p1-2ubuntu2 is to be installed
Recommends: ncurses-term but it is not going to be installed
Recommends: ssh-import-id but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo iptables -L
Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination
$ sudo iptables -A INPUT -p tcp --dport ssh -j ACCEPT
$ ssh localhost ssh: connect to host localhost port 22: Connection refused
答案1
问题:
openssh-server : Depends: openssh-client (= 1:6.6p1-2ubuntu1) but 1:6.6p1-2ubuntu2 is installed.
尝试运行:
sudo aptitude install openssh-client=1:6.6p1-2ubuntu1
这将恢复到此版本
然后我这样做了:
sudo apt-get install openssh-server
然后 ssh localhost 就可以工作了。
答案2
sudo aptitude install openssh-client=1:6.6p1-2ubuntu1
对我来说效果最好。但是,我没有aptitude
安装该命令,因此出现错误:
没有用户‘aptitude’的密码条目
我需要aptitude
使用以下命令安装:
sudo apt-get install aptitude
安装完成后,我就可以使用上述命令:
sudo aptitude install openssh-client=1:6.6p1-2ubuntu1
一旦openssh-client=1:6.6p1-2ubuntu1
安装了,它是的依赖项openssh-server
,我就可以安装ssh
。
答案3
版本依赖项不匹配。删除并重新安装以获取正确的版本
apt remove openssh-client
sudo apt-get install opensssh-server
答案4
我已按照@ADITYA SINHA 上述步骤操作...但是,我再次遇到同样的错误。
(base) bandham@BANDHAM:~$ sudo apt-get install aptitude
Reading package lists... Done
Building dependency tree
Reading state information... Done
aptitude is already the newest version (0.8.10-6ubuntu1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
uget : Depends: libcurl3 (>= 7.16.2) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
所以,我必须sudo apt-get install -f
修复未满足的错误。它修复了几个类似的包curl,libcurl4,etc
。
然后,我只需运行命令sudo apt-get install PACKAGENAME
。
快乐学习...