跳转到内容

设置Debian服务器

linux-prepare-debian

本教程中Debian系统默认为13,不建议使用以前的版本。更多debian相关资料推荐访问debian club

默认的Debian官方源在国内下载可能会比较慢,建议配置中科大镜像源

一行命令替换官方源

Terminal window
sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/debian.sources

或手动设置/etc/apt/sources.list.d/debian.sources文件内容如下

Types: deb
URIs: http://mirrors.ustc.edu.cn/debian
Suites: trixie trixie-updates
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: http://mirrors.ustc.edu.cn/debian-security
Suites: trixie-security
Components: main contrib non-free non-free-firmware
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg

修改完成后需要执行apt update使新镜像源生效

一般系统自带VI,为了获得更好的编辑体验,建议安装VIM

Terminal window
apt install vim

一般云厂商提供的网页版终端并不好用,所以都会选择xshell等终端工具连接,这就需要修改sshd配置。

Terminal window
vim /etc/ssh/sshd_config
# 端口和IP配置。主要用来更换连接端口,注释就是默认值
#Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# 是否允许root用户远程登录。默认禁止,具体看企业安全要求
PermitRootLogin yes
# 是否启用密码登录。有些环境可能需要通过密钥登录
PasswordAuthentication yes

系统默认时区可能不是东八区,这会导致应用部署时定时任务、日志等遇见一些问题,可通过下方命令调整

Terminal window
# 查看当前时间
date
# 修改时区
timedatectl set-timezone Asia/Shanghai