This commit is contained in:
144
系统安装文档/Centos7.9系统安装并初始化.md
Normal file
144
系统安装文档/Centos7.9系统安装并初始化.md
Normal file
@@ -0,0 +1,144 @@
|
||||
> 本文作者:丁辉
|
||||
|
||||
# Centos7.9系统安装并初始化
|
||||
|
||||
## 开始安装系统
|
||||
|
||||
1. 进入系统安装界面后选择 Install CentOS 7 开始安装
|
||||
|
||||
### 正常安装
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-1.png" style="zoom:100%;" />
|
||||
|
||||
### 其他场景
|
||||
|
||||
**安装前须知**
|
||||
|
||||
安装 CentOS 7 系统时,如果硬盘容量小于2TB,系统默认会使用 MBR 模式来安装。若需要强制使用 GPT 分区表,可以在刚开机安装第一个界面,当光标位于 Install CentOS 7 时,按tab键在行末尾输入核心参数 `inst.gpt`。
|
||||
|
||||
**介绍**
|
||||
|
||||
传统的 **MBR 分区 + Legacy BIOS 启动**方式 对比 **GPT 分区 + Legacy BIOS 启动**
|
||||
|
||||
| 对比维度 | MBR + Legacy BIOS(传统“正常”安装) | GPT + Legacy BIOS(你当前的安装方式) |
|
||||
| :------------------------- | :---------------------------------- | :------------------------------------------ |
|
||||
| **分区表类型** | MBR(主引导记录) | GPT(GUID 分区表) |
|
||||
| **最大磁盘支持** | 2 TB | 约 9.4 ZB(几乎无上限) |
|
||||
| **主分区数量限制** | 最多 4 个主分区 | 理论上无限制(Windows 限制 128 个) |
|
||||
| **引导方式** | BIOS 读取 MBR 中的引导代码 | BIOS 读取 GPT 磁盘开头的 **BIOS Boot 分区** |
|
||||
| **是否需要 biosboot 分区** | **不需要** | **需要**,大小 1 MiB |
|
||||
| **引导程序存放位置** | MBR 后的空隙(通常 31 KiB 左右) | 专门的 `biosboot` 分区 |
|
||||
| **分区表备份** | 无 | 磁盘首尾各存一份,可恢复 |
|
||||
| **数据校验** | 无 | 有 CRC32 校验,可检测分区表损坏 |
|
||||
| **兼容性** | 极老硬件也支持 | 需要操作系统和工具支持 GPT |
|
||||
| **典型使用场景** | 老服务器、小容量磁盘、追求最简单 | 大容量磁盘(>2TB)、需要更多分区、现代部署 |
|
||||
|
||||
**说明**
|
||||
|
||||
这里安装模式选择 GPT 纯纯是演示,正常来讲我们系统盘往往用不到 2TB 以上的磁盘空间,因为业务盘多数是额外挂载的,所以在我们平常安装系统时,可以在选择 Install CentOS 7 后直接回车安装。
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-17.png" style="zoom:100%;" />
|
||||
|
||||
2. 选择安装语言点击继续
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-2.png" style="zoom:50%;" />
|
||||
|
||||
3. 配置系统时间点击 DATE & TIME
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-3.png" style="zoom:50%;" />
|
||||
|
||||
4. 配置为 Asia/Shanghai 点击完成
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-4.png" style="zoom:50%;" />
|
||||
|
||||
5. 配置系统磁盘点击 INSTALLATION DESTINATION
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-5.png" style="zoom:50%;" />
|
||||
|
||||
6. 选择手动分配
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-6.png" style="zoom:50%;" />
|
||||
|
||||
7. 按需求配置每个磁盘大小与模式
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-7.png" style="zoom:50%;" />
|
||||
|
||||
8. 配置完成后点击完成
|
||||
|
||||
### 正常安装
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-8.png" style="zoom:50%;" />
|
||||
|
||||
### 磁盘 GPT 模式配置不同点
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-18.png" style="zoom:50%;" />
|
||||
|
||||
**关键点解释**
|
||||
|
||||
**1. 为什么 GPT + Legacy BIOS 需要 biosboot 分区?**
|
||||
传统 MBR 磁盘在 MBR 之后、第一个分区之前有一段空闲空间,GRUB 可以把核心代码塞进去。但 GPT 磁盘的这个位置被 **GPT 分区表头**占用了,没有地方放 GRUB 的核心代码。所以必须单独划一个 `biosboot` 分区来存放它。
|
||||
|
||||
**2. 什么情况下不需要 biosboot 分区?**
|
||||
|
||||
- **MBR + Legacy BIOS**:不需要。
|
||||
- **GPT + UEFI**:不需要 `biosboot`,但需要 **EFI 系统分区(ESP)**,通常 200–512 MiB,格式为 FAT32。
|
||||
|
||||
**3. 生产环境怎么选?**
|
||||
现在新服务器基本都推荐 **GPT + UEFI**,这是最现代、最稳妥的组合。如果你因为某些原因必须用 Legacy BIOS 启动,又用了 GPT 分区表,那就老老实实划一个 **1 MiB 的 biosboot 分区**,这是标准做法,不用担心太小。
|
||||
|
||||
9. 点击接受变化
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-9.png" style="zoom:50%;" />
|
||||
|
||||
10. 配置网络点击 NETWORK & HOST NAME
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-10.png" style="zoom:50%;" />
|
||||
|
||||
11. 开启网络并点击配置
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-11.png" style="zoom:50%;" />
|
||||
|
||||
12. 点击配置 IPv4 切换为手动模式,添加 IP 地址策略后保存
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-12.png" style="zoom:50%;" />
|
||||
|
||||
13. 确认网络信息无误后点击完成
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-13.png" style="zoom:50%;" />
|
||||
|
||||
14. 开始安装
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-14.png" style="zoom:50%;" />
|
||||
|
||||
15. 配置管理员密码与其他账户
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-15.png" style="zoom:50%;" />
|
||||
|
||||
16. 重启并进入系统
|
||||
|
||||
<img src="https://rustfs.offends.cn/offends/images/centos7.9-16.png" style="zoom:50%;" />
|
||||
|
||||
|
||||
|
||||
## 基础环境配置
|
||||
|
||||
更改主机名
|
||||
|
||||
```bash
|
||||
hostnamectl set-hostname <主机名>
|
||||
```
|
||||
|
||||
生效
|
||||
|
||||
```bash
|
||||
bash
|
||||
```
|
||||
|
||||
## 配置 YUM 源
|
||||
|
||||
查看此文档: [Centos7更换阿里源](https://gitee.com/offends/Linux/blob/main/Docs/Centos7%E6%9B%B4%E6%8D%A2%E9%98%BF%E9%87%8C%E6%BA%90.md)
|
||||
|
||||
## 升级系统内核
|
||||
|
||||
查看此文档: [Linux内核升级](https://gitee.com/offends/Linux/blob/main/Docs/Linux%E5%86%85%E6%A0%B8%E5%8D%87%E7%BA%A7.md)
|
||||
|
||||
Reference in New Issue
Block a user