CentOS 7系统安装教程最小化安装与软件包选择
以下是针对 CentOS 7 最小化安装 的详细教程,涵盖安装前准备、安装过程及后续软件包配置,适合需要精简系统或服务器的用户。
2. 制作启动介质
- 使用工具如 `Rufus`(Windows)或 `dd`(Linux)将ISO写入U盘: ```bash sudo dd if=CentOS-7-x86_64-Minimal-XX.iso of=/dev/sdX bs=4M status=progress ```
3. BIOS设置
- 确保服务器/PC从U盘启动,并设置BIOS为 UEFI或Legacy模式(根据硬件支持)。
2. 安装配置 日期与时间:设置时区为 Asia/Shanghai(或其他地区),启用NTP同步。 键盘布局:默认 English (US)。 安装源:自动检测本地ISO,无需修改。 软件选择: 勾选 Minimal Install(仅基础系统,无图形界面)。 可选添加 Compatibility Libraries(兼容库)或 Development Tools(开发工具)。
3. 分区方案 自动分区(推荐新手): 选择 I will configure partitioning → Done → Click here to create them automatically。 系统会生成 `/`(根分区)和 `swap`(交换分区)。 手动分区(高级用户): 创建 `/boot`(1GB)、`/`(剩余空间)、`swap`(内存的1-2倍)。 文件系统类型选择 xfs(默认)或 ext4。
4. 网络配置 启用网卡: 点击 Network & Host Name,打开对应网卡(如 `ens33`)。 设置主机名(如 `centos7-min`),点击 Apply。 手动配置IP(可选): 点击 Configure,设置静态IP、子网掩码、网关和DNS。
5. 开始安装 设置 root密码(务必牢记)。 创建普通用户(可选),勾选 Make this user administrator 赋予sudo权限。 点击 Begin Installation,等待安装完成(约10-20分钟)。
2. 更新系统 ```bash yum update -y # 更新所有软件包 yum clean all # 清理缓存 ```
3. 安装常用工具 ```bash yum install -y wget curl vim net-tools tree lsof # 网络和文件工具 yum install -y epel-release # 启用EPEL仓库(额外软件) ```
4. 配置SSH(可选) 修改SSH端口(增强安全): ```bash vim /etc/ssh/sshd_config # 修改 Port 22 为其他端口(如 2222) systemctl restart sshd ``` 禁用root远程登录(推荐): ```bash vim /etc/ssh/sshd_config # 修改 PermitRootLogin yes 为 no systemctl restart sshd ```
5. 防火墙配置 ```bash systemctl start firewalld systemctl enable firewalld firewall-cmd --permanent --add-service=http # 开放HTTP服务 firewall-cmd --reload ```
2. YUM更新慢
- 修改 `/etc/yum.repos.d/CentOS-Base.repo`,替换为阿里云或腾讯云镜像源。
3. 忘记root密码
- 重启系统,在GRUB菜单按 `e` 编辑内核参数,在 `linux16` 行末尾添加 `rd.break`,按 `Ctrl+X` 启动。
- 执行: ```bash mount -o remount,rw /sysroot chroot /sysroot passwd root touch /.autorelabel exit reboot ```
通过以上步骤,您可获得一个干净、高效的CentOS 7系统。如需图形界面,可后续安装 `GNOME` 或 `KDE` 包组。
END
云服务器活动(最新)

扫码添加站长好友
文章投稿、业务合作、咨询等
技术交流、问题反馈等