The perfect solution to the openssh server dependency error under ubuntu16.04 is very good

  • 2020-05-13 04:18:04
  • OfStack

Problem: after system reinstallation, install and configure SSH, firewall configuration


# The installation install openssh-server
sudo apt install openssh-server -y

Problems encountered:


sudo apt install openssh-server -y

Reading package list... complete

Analyzing the software package's dependency tree

Reading status information... complete

Some packages could not be installed. If you are using the unstable distribution, this may be the case

Because the system is not in the state you want it to be. There may be some software you need in this release

Packages have not been created or they have been moved from the (Incoming) directory.

The following information may be helpful in solving the problem:

The following packages have unsatisfied dependencies:


openssh-server :  Rely on : openssh-client (= 1:7.1p1-4)

Dependency: openssh-sftp-server but it will not be installed

Recommended: ssh-import-id but it will not be installed

E: you can't fix bugs because you're asking some packages to stay the same, because they break dependencies between software packages.

Solutions:

ubuntu comes with openssh-client, so it can pass

ssh username@host

To remotely connect to linux

However, in order to be connected via ssh, the ubuntu system needs to have openssh-server, which can be accessed


ps -e | grep ssh

If sshd is not displayed, openssh-server is not installed

through


sudo apt-get install openssh-server

To install openssh-server, if it goes well, the installation will be successful, if encountered


$ sudo apt install openssh-server -y

Reading package list... complete

Analyzing the software package's dependency tree

Reading status information... complete

Some packages could not be installed. If you are using the unstable distribution, this may be the case

Because the system is not in the state you want it to be. There may be some software you need in this release

Packages have not been created or they have been moved from the (Incoming) directory.

The following information may be helpful in solving the problem:

The following packages have unsatisfied dependencies:

openssh-server: dependency: openssh-client (= 1:7.1p1-4)

Dependency: openssh-sftp-server but it will not be installed

Recommended: ssh-import-id but it will not be installed

E: you cannot fix bugs because you require some packages to remain as they are, because they break dependencies between software packages.

This is because openssh-server is dependent on openssh-clien, so doesn't ubuntu come with openssh-client? The reason is that the built-in openssh-clien is different from the version on which the installed openssh-server relies

1:7.1p1-4

So install the corresponding version of openssh-clien to override ubuntu's own

PS: see below how ubuntu failed to install openssh-server

Use the ubuntu installation command


sudo apt-get install openssh-server

The following error occurred

There is no available package openssh-server, but it is referenced by other packages.

This may mean that the missing package may have been discarded or found only in the labor insurance distribution source.

E: the software package openssh-server is not yet available for installation

The solution

Command:


sudo apt-get update

Download openssh-server with the following command

Command:


sudo apt-get install openssh-server

Thus OK

Check the ssh service startup status


ps -s | grep ssh
# To enable the ssh The instruction of 
 Start the ssh Services: 
#sudo /etc/init.d/ssh start
 stop ssh Services: 
#sudo /etc/init.d/ssh stop
 restart ssh Services: 
#sudo /etc/init.d/ssh restart

The above is a perfect solution to the ubuntu16.04 installation of openssh-server dependency error (very good), I hope to help you, if you have any questions please leave me a message, this site will timely reply to you!


Related articles: