本项目使用 "Debian bullseye" 作底层操作系统,在系统部署完成后的具体的配置情况如下:

1. 基础软件部署

1.1. 部署 Bash Completion

Bash Completion 可为 Shell 添加 TAB 补全功能,建议部署。

1
apt-get install -y  bash-completion

1.2. 部署 OpenSSH Server

OpenSSH 能极大的方便远程调试,建议部署。

1
2
# 部署 OpenSSH 软件包
apt-get -y install openssh-server

1.3. 部署 VM tools (可选)

KVM 虚拟机环境下,某些工具包能极大提升部署效率,建议部署。

1
2
# 部署虚拟化相关的软件包
apt-get -y install qemu-guest-agent cloud-init

2. 基础环境配置

2.1. 修改 APT 远程仓库地址 (可选)

受地域影响,默认的 APT 下载可能会非常慢,可根据实际需求更改为合适的地址,例如:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# 备份旧的配置
mv /etc/apt/sources.list /etc/apt/sources.list.bak
# 覆盖新的配置文件
cat << EOF > /etc/apt/sources.list
deb https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.ustc.edu.cn/debian-security/ bullseye-security main contrib non-free
EOF
apt-get update

2.2. 修改OpenSSH 配置 (可选)

关闭密码登陆可提高服务器安全性, 如果没有使用需求则可以跳过。

在关闭密码登陆之前请 务必 将公钥复制到目标服务器,否则可能会导致无法使用SSH远程登陆。可以使用 ssh-copy-id <user>@<address> 快速复制本机的公钥到目标服务器下。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 更新OpenSSH 配置文件
cat << "EOF" > /etc/ssh/sshd_config.d/security.conf
# 修改默认SSH端口
Port 2222
# 开启公钥登陆
PubkeyAuthentication yes
# 指定公钥位置
AuthorizedKeysFile     .ssh/authorized_keys
# 关闭密码登陆
PasswordAuthentication no
EOF

# 重加载配置文件
systemctl restart ssh