Ubuntu 18.04无法安装Openssh-Server解决办法

作者在安装openssh-server时遇到依赖问题,尝试多种方法未果,最终通过更换源并更新解决了问题,强调了检查配置文件的重要性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

背景

作者在自己的一台笔记本电脑上面使用apt安装openssh-server总是出现依赖问题,作者就很纳闷了,计算机什么时候能难到这个程度,我装个ssh都不会装了?作者放下了使用openssh-server的念头,但是几天后作者又有了使用openssh-server的必要,于是折腾安装openssh-server不得不被提上日程。

操作

➜  ~ sudo apt 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:7.6p1-4)
                  Depends: openssh-sftp-server 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.

作者尝试手动修复依赖,但是两个依赖貌似陷入了死循环,作者尝试用aptitude来自动修复,结果也是无法给出解决办法。于是在非常心累的情况下作者去看了下程序员都爱的搜索引擎,发现大家都通过apt update来解决的,作者就纳闷了阿,我都update无数回了,怎么还不行呢?后来经验丰富(练习时长两月半)的作者想到很可能是源的问题,虽然我换过阿里的源,并且对换源了如指掌,但是不排除这个机器的源有问题,于是作者前往阿里镜像官网一顿复制粘贴然后update然后再一条安装命令解决问题,折腾到此结束。

总结

对任何时候的任何操作不要有百分百的信心,既然大家都说update然后你update无效那就要想想update为什么无效然后再去检查一下配置文件。道理要学会通用到其他地方。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值