在之前安装系统的时候有一个安装 SSH 服务的,结果没点上,导致系统完成后,ssh无法连接上啊,于是要安装sshd 服务。使用命令:apt-get install openssh-server 结果就出现问题了:
网上搜索说是要更新源,于是把网上列的一些源都更新了,结果还是不行。加了网易的源地址还是不行,最后是加了阿里云的源才可以的:
看到这些似乎就有希望了,我的 /etc/apt/sources.list 是这样的:
root@debian-ytian:/etc/ssh# cat /etc/apt/sources.list
#deb cdrom:[Debian GNU/Linux 12.0.0 _Bookworm_ - Official amd64 DVD Binary-1 with firmware 20230610-10:23]/ bookworm main non-free-firmware
deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
deb http://mirrors.163.com/debian/ wheezy main non-free contrib
deb http://mirrors.163.com/debian/ wheezy main non-free contrib
deb https://mirror.bjtu.edu.cn/debian/ wheezy main non-free contrib
deb http://mirrors.163.com/debian/ wheezy-proposed-updates main non-free contrib
deb-src http://mirrors.163.com/debian/ wheezy main non-free contrib
deb-src http://mirrors.163.com/debian/ wheezy-proposed-updates main non-free contrib
似乎只有阿里云的有用:deb http://mirrors.aliyun.com/debian/ bullseye main non-free contrib
文件保存后,需要执行:apt-get update; apt-get upgrade
然后再安装openssh-server: apt-get install openssh-server,结果还是没有安装成功:
好像又依赖两个安装包,结果又网上一翻搜索,使用:apt-get install openssh-client=1:8.4p1-5+deb11ul 结果安装没有出错,似乎连刚才提示的 openssh-sftp-server 也一并安装了:
安装完成后,重启,查看一下sshd服务的状态,似乎已经跑起来了: