1. 硬件环境要求
在安装Debian 12之前,需要确保硬件环境满足最低要求。更多学习教程www.fgedu.net.cn
2. VMware Workstation配置
本文以VMware Workstation 17 Pro为例,创建虚拟机用于安装Debian 12。
– 虚拟机名称:Debian12
– 操作系统:Debian 12 64位
– 内存:4GB
– 处理器:2核心
– 网络:桥接模式
– 磁盘:40GB(SCSI)
– CD/DVD:debian-12.5.0-amd64-netinst.iso
3. Debian 12安装过程
启动虚拟机,开始Debian 12的安装过程。
3.1 启动安装
1. 选择”Graphical install”选项并按Enter键。
2. 选择安装语言为”中文(简体)”,点击”继续”。
3. 选择所在地区,点击”继续”。
4. 选择键盘布局,点击”继续”。
3.2 网络配置
1. 配置主机名为”fgedu.net.cn”,点击”继续”。
2. 配置域名,点击”继续”。
3. 配置root密码,点击”继续”。
4. 创建普通用户,点击”继续”。学习交流加群风哥微信: itpux-com
3.3 分区配置
选择”使用整个磁盘并配置LVM”,点击”继续”。
– /boot:1GB,Ext4
– 剩余空间:LVM卷组
– /:20GB,Ext4
– /var:10GB,Ext4
– /home:5GB,Ext4
– swap:4GB
3.4 软件选择
选择需要安装的软件包,建议选择”SSH服务器”和”标准系统工具”,点击”继续”。
3.5 安装GRUB引导
选择安装GRUB到主引导记录,点击”继续”。
3.6 完成安装
安装完成后,点击”继续”重启系统。
4. 安装后配置
系统安装完成后,需要进行一些基本配置。
4.1 系统更新
# apt update
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
All packages are up to date.
# apt upgrade
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Calculating upgrade… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4.2 基本工具安装
# apt install -y vim net-tools telnet wget curl rsync tar gzip bzip2 zip unzip
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following additional packages will be installed:
libcurl4 libgpm2 libksba8 libnpth0 libzip4
Suggested packages:
gpm
The following NEW packages will be installed:
bzip2 curl gzip libcurl4 libgpm2 libksba8 libnpth0 libzip4 net-tools rsync telnet unzip wget zip
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,123 kB of archives.
After this operation, 11.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
5. 网络配置
详细配置网络设置,确保系统网络连接正常。学习交流加群风哥QQ113257174
# ip addr
1: lo:
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: eth0:
link/ether 00:0c:29:12:34:56 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.51/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
# 测试网络连接
# ping -c 4 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=12.3 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=11.9 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=118 time=12.1 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=118 time=11.8 ms
— 8.8.8.8 ping statistics —
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 11.811/12.047/12.333/0.214 ms
6. 存储配置
配置存储系统,包括磁盘分区和文件系统优化。
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.5M 1.9G 1% /run
/dev/mapper/debian–vg-root 20G 2.1G 17G 11% /
/dev/sda1 1022M 174M 786M 18% /boot
tmpfs 384M 0 384M 0% /run/user/0
# 查看磁盘I/O性能
# iostat -x 1 3
Linux 6.1.0-18-amd64 (fgedu.net.cn) 03/31/2026 _x86_64_ (2 CPU)
avg-cpu: %user %nice %system %iowait %steal %idle
0.00 0.00 0.50 0.00 0.00 99.50
device r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util
sda 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
7. 软件仓库配置
配置Debian 12的软件仓库,确保可以安装和更新软件包。
# cat /etc/apt/sources.list
deb http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
# 刷新仓库
# apt update
Hit:1 http://deb.debian.org/debian bookworm InRelease
Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
All packages are up to date.
8. 安全配置
配置系统安全,包括防火墙和SSH设置。更多学习教程公众号风哥教程itpux_com
# apt install -y ufw
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following NEW packages will be installed:
ufw
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 144 kB of archives.
After this operation, 564 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
# 启用防火墙
# ufw enable
Command may disrupt existing ssh connections. Proceed with operation (y|n)? y
Firewall is active and enabled on system startup
# 开放SSH端口
# ufw allow ssh
Rules updated
Rules updated (v6)
# 查看防火墙状态
# ufw status
Status: active
To Action From
— —— —-
22/tcp ALLOW Anywhere
22/tcp (v6) ALLOW Anywhere (v6)
9. 性能调优
优化系统性能,包括内核参数和内存管理。
# vi /etc/sysctl.conf
# 添加以下内核参数
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
vm.swappiness = 10
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
# 使内核参数生效
# sysctl -p
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
vm.swappiness = 10
vm.dirty_background_ratio = 5
vm.dirty_ratio = 10
9.1 内存管理优化
# free -h
total used free shared buff/cache available
Mem: 3.8G 1.1G 2.1G 8.5M 580M 2.5G
Swap: 4.0G 0B 4.0G
# 配置大内存页
# vi /etc/sysctl.conf
vm.nr_hugepages = 512
# 使配置生效
# sysctl -p
# 验证大内存页配置
# grep HugePages /proc/meminfo
HugePages_Total: 512
HugePages_Free: 512
HugePages_Rsvd: 0
HugePages_Surp: 0
10. 故障排除
常见问题及解决方案。
10.1 网络连接问题
# ip link show eth0
2: eth0:
link/ether 00:0c:29:12:34:56 brd ff:ff:ff:ff:ff:ff
# 检查网络服务状态
# systemctl status networking
● networking.service – Raise network interfaces
Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
Active: active (exited) since Fri 2026-03-31 10:00:00 CST; 1h ago
Docs: man:interfaces(5)
Process: 1234 ExecStart=/sbin/ifup -a –read-environment (code=exited, status=0/SUCCESS)
Main PID: 1234 (code=exited, status=0/SUCCESS)
Tasks: 0
Memory: 1.1M
CPU: 33ms
10.2 系统启动问题
# journalctl -b | grep error
# 检查文件系统
# fsck -f /dev/sda1
fsck from util-linux 2.38.1
e2fsck 1.46.2 (28-Feb-2021)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/boot: 223/262144 files (0.0% non-contiguous), 29451/1048576 blocks
from:www.itpux.com
本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html
