ROOT登录
默认情况下,root 的 ssh 远程 shell 访问被拒绝。按照以下说明为 root 帐户启用 SSH 登录。
使用 nano 或您喜欢的任何文本编辑器以管理权限打开 /etc/ssh/sshd_config 文件。
nano /etc/ssh/sshd_config在此文件中,找到并更改以下行:更改自:#PermitRootLogin prohibit-password到PermitRootLogin yes
完成这项工作的快速方法是使用 sed 命令,如下所示:
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config完成此更改后,保存文件,然后重新启动 SSH 服务以使更改生效。
systemctl restart ssh默认情况下,系统未设置 root 密码,当尝试以 root 用户身份进行 SSH 登录时,会出现错误消息Permission returned,please try again。因此我们需要设置root的密码。出现提示时输入当前用户密码,然后输入新的 root 密码:
passwd root
[sudo] password for linuxconfig:
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully确保您的防火墙还允许端口 22(SSH 的默认端口)上的传入连接。
ufw allow ssh最后,您可以使用 root 用户帐户登录 SSH。
$ ssh root@debian安装 Debian 12
Debian 12可以直接下载ISO镜像安装通过Debian 11升级安装。
更新现有的软件至 Debian 11 的最新版本:
apt-get update apt-get upgrade
更换为国内镜像源
把 /etc/apt/sources.list 里面的内容全部注释掉,增加以下 Debian 12 的软件源:
国内常见镜像站点
Debian全球镜像站列表:https://www.debian.org/mirror/list 。
下面列出国内常用的镜像站点及 /etc/apt/sources.list 中的具体对应内容:
阿里云镜像站
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main
deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib腾讯云镜像站
deb https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.tencent.com/debian-security/ bookworm-security main
deb-src https://mirrors.tencent.com/debian-security/ bookworm-security main
deb https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib网易镜像站
deb https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.163.com/debian-security/ bookworm-security main
deb-src https://mirrors.163.com/debian-security/ bookworm-security main
deb https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.163.com/debian/ bookworm-backports main non-free non-free-firmware contrib华为镜像站
deb https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb-src https://mirrors.huaweicloud.com/debian-security/ bookworm-security main
deb https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-updates main non-free non-free-firmware contrib
deb https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib
deb-src https://mirrors.huaweicloud.com/debian/ bookworm-backports main non-free non-free-firmware contrib清华大学镜像站
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free non-free-firmware中科大镜像站
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware设置完成后更新
apt-get update
apt-get upgrade -y设置中文支持
安装语言包: 首先需要确保系统中已经安装了语言包。可以使用 apt 工具来安装:
apt install locales配置 locale: 接下来需要配置系统的 locale 设置。运行以下命令打开 locale 的配置界面:
dpkg-reconfigure locales在出现的列表中选择 zh_CN.UTF-8(使用上下箭头来移动,并使用空格来选择)。然后在下一个界面中选择 zh_CN.UTF-8 作为默认的 locale。
安装中文字体: 你可能还需要安装一些中文字体。以下是一些常用的中文字体包
apt install fonts-wqy-microhei fonts-wqy-zenhei xfonts-wqy配置输入法: 如果你需要输入中文,你还可以安装并配置一个中文输入法。常用的中文输入法包括 Fcitx、IBus 等。以下是安装 Fcitx 和搜狗拼音输入法的示例:
apt install fcitx fcitx-sogoupinyin fcitx-config-gtk安装完成后,你可以通过系统设置来配置输入法,或者运行 fcitx-config-gtk 来打开 Fcitx 的配置界面。
- 确保终端的编码正确: 如果你是使用的终端远程连接到服务器,需要确保终端的编码方式也为 UTF-8 ,否则会出现中文乱码。
- 重启系统或重新登录: 一般来说,在完成以上配置后,重启你的系统或重新登录即可看到中文环境已经生效。
评论