温馨提示×

如何部署CentOS Minimal

小樊
53
2026-07-19 10:08:28
栏目: 智能运维

部署 CentOS Minimal 通常包括 下载镜像 → 制作启动盘 → 安装系统 → 基础配置 几个步骤。下面以 CentOS 7 MinimalCentOS Stream 9 Minimal 为例,给你一套完整、可操作的部署流程。


一、准备阶段

1. 下载 CentOS Minimal 镜像

  • CentOS 7(传统稳定)
    https://vault.centos.org/7.9.2009/isos/x86_64/

    • 选择:CentOS-7-x86_64-Minimal-2009.iso
  • CentOS Stream 9(推荐新环境)
    https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/iso/

    • 选择:CentOS-Stream-9-latest-x86_64-minimal.iso

2. 制作启动盘(U 盘)

Windows

  • 使用 Rufus
  • 镜像类型:ISO
  • 分区方案:
    • BIOS → MBR
    • UEFI → GPT

Linux / macOS

lsblk
sudo dd if=CentOS-Stream-9-latest-x86_64-minimal.iso of=/dev/sdX bs=4M status=progress

⚠️ 注意:/dev/sdX 是你的 U 盘,别写错!


二、安装 CentOS Minimal

1. 启动服务器

  • 插入 U 盘
  • 进入 BIOS / UEFI
  • 设置 U 盘优先启动

2. 安装过程(重点)

(1)语言

  • 推荐:English(United States)

(2)关键配置项

Installation Destination

  • 选择磁盘
  • 自动分区(LVM)即可

Network & Hostname

  • 打开网卡
  • 设置主机名,例如:
    centos-minimal
    

Time Zone

  • Asia / Shanghai

Software Selection

  • 选择:
    Minimal Install
    

Root 密码

  • 设置强密码
  • 若提示“密码太弱”,点两次 Done

用户(可选)

  • 建议创建一个普通用户并加入 wheel

3. 开始安装

  • 点击 Begin Installation
  • 等待完成
  • 重启并拔出 U 盘

三、首次启动后的基础配置

1. 登录系统

login: root

2. 配置网络(如果未自动获取 IP)

查看网卡

ip a

启用 DHCP

nmcli device
nmcli con up eth0

或编辑配置文件(CentOS 7):

vi /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=dhcp
ONBOOT=yes

重启网络:

systemctl restart network

3. 更新系统

yum update -y

或(CentOS Stream 9):

dnf update -y

4. 安装常用基础工具

yum install -y \
vim wget curl net-tools \
bash-completion rsync lsof

四、推荐安全与运维配置

1. 配置 SSH

vim /etc/ssh/sshd_config

建议:

PermitRootLogin no
PasswordAuthentication no
systemctl restart sshd

2. 配置防火墙

systemctl enable firewalld
systemctl start firewalld
firewall-cmd --add-service=ssh --permanent
firewall-cmd --reload

3. 配置时间同步

yum install -y chrony
systemctl enable chronyd
systemctl start chronyd

五、常见部署场景

场景 建议
服务器 CentOS Stream 9
老硬件 CentOS 7
Docker / K8s Minimal + 关闭 SELinux
云服务器 直接用云厂商 Minimal 镜像

六、常见问题

1. 没有 ifconfig?

yum install -y net-tools

2. 没有图形界面?

Minimal 就是 无 GUI,如需:

dnf groupinstall "Server with GUI"

3. 安装特别快?

✅ 正常,Minimal 只有几百 MB。


如果你愿意,我可以:

  • ✅ 帮你 做一套 CentOS Minimal 自动化安装(Kickstart)
  • ✅ 给你 生产环境标准基线配置
  • ✅ 针对 虚拟机 / 物理机 / 云服务器 单独说明

告诉我你的 使用场景 即可。

0