CentOS Minimal 启动慢,通常不是因为“装的东西少”,而是因为 Minimal 本身缺少一些默认优化/组件,反而容易踩到某些坑。下面按最常见原因 → 排查方法 → 解决建议说明。
Minimal 默认会启用网卡并尝试 DHCP 获取 IP,如果:
系统会 卡在网卡激活阶段几十秒甚至更久
现象
A start job is running for Network Manager Wait Online
解决
systemctl disable NetworkManager-wait-online.service
或编辑网卡:
/etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=static
ONBOOT=yes
并配置 IP
Minimal 没装 GUI,但:
/etc/hosts 没写本机主机名会导致:
解决
hostnamectl set-hostname centos
并编辑:
/etc/hosts
127.0.0.1 centos localhost
Minimal 不代表快,如果是:
启动明显慢
检查
systemd-analyze blame
systemd-analyze
systemd-analyze blame
systemd-analyze critical-chain
虽然不算主因,但在:
会拖慢
getenforce
临时:
setenforce 0
Minimal 启动也需要:
否则 systemd 并发度低
Minimal 默认 XFS,但:
noatimediscard(SSD)mount | grep ' / '
✅ 关掉网卡等待
✅ 配置静态 IP 或禁用无用网卡
✅ 写好 /etc/hosts
✅ systemd-analyze blame 查元凶
✅ 云服务器用 SSD + 2CPU
你可以贴一下:
systemd-analyze blame
或启动卡住的 具体文字提示
我可以直接帮你指出是哪一行在拖慢。