
CentOS ( Community Enterprise Operating System ,中文意思是社区企业操作系统)是 Linux 发行版之一,它是来自于 Red Hat Enterprise Linux 依照开放源代码规定释出的源代码所编译而成 。 由于出自同样的源代码,因此有些要求高度稳定性的服务器以 CentOS 替代商业版的 Red Hat Enterprise Linux 使用 。 两者的不同,在于 CentOS 完全开源 。
1 下载
首先到官网下载 ISO 格式的安装文件:

2 加载光驱
选中指定的虚拟机,然后依次选择设置→存储→添加光盘到光驱→选择 ISO 文件:

加载成功后,会出现 CentOS-xx.iso 字符串:

3 启动 CentOS 安装程序
3.1 启动
启动之前配置了安装光盘的虚拟机,点击“启动”,就会进入如下画面:

我们可以在此选择不同的操作模式:
- 安装 CentOS 7。
- 测试此光盘后再开始安装 CentOS 7。
- 除错模式。
3.2 除错模式

选择除错模式会出现更多的选项,他们分别是:
- 以基本图形模式安装 CentOS 7;
- 救援 CentOS 系统;
- 执行内存测试;
- 由本机磁盘正常开机,而不是由光盘开机。
除非硬件系统拥有比较特别的图形显示器等情况,一般来说,直接使用第一项来安装就可以啦O(∩_∩)O~
3.3 使用 GPT 分区表
注意: 如果磁盘容量小于 2TB ,系统是会默认使用 MBR 模式来安装 CentOS。我们也可以对其进行配置。
- 使用箭头键,将光标移动到『Install CentOS 7 』。
- 按下键盘的 [Tab] 键,让光标跑到画面最下方,在此可以输入额外的核心参数。
- 空格后,输入
inst.gpt
。注意: 各个参数之间要有空格,最后一个是游标本身而非底线!
回车后,就会进入检查画面,检查结束,就进入正式的安装流程啦O(∩_∩)O~
4 CentOS 安装流程
4.1 选择语系
首先选择系统的语系(简体中文):

4.2 设置安装信息

这里有很多选项,我们一个一个来设置。
如果不小心点开了 “帮助”,那么可以使用 CTRL+ N,来关闭它:

注意:在 Virtual Box 中安装 CentOS,有时候会出现鼠标按键失效的情况,这时可以使用键盘快捷键来操作。比如:如果取消按钮无反应,那么可以使用 ESC 键来关闭窗口。
4.2.1 日期和时间
接着,设置时区(亚洲、上海)、日期与时间:


4.2.2 键盘布局
因为打字时,会经常在中/英文之间来回切换,所以这里需要设置切换快捷键:

4.2.3 安装源

因为我们使用的是光盘开机,并且还没有设定好网络,因此就会默认选择光盘片 (sr0 所在的装置)。如果已经预先设定好网络,那么就可以直接从网络上下载安装啦O(∩_∩)O~
4.2.4 软件选择

默认是『最小型安装』模式,没有图形界面。我们可以选择含有 GUI 的服务器,它搭载了 GNOME 桌面环境。
4.2.5 选择安装目标位置

点选 1 号箭头所指处:『我将配置分页』选项。 点选完毕后按下『完
成』,即可出现磁盘分区窗口。


在此,我们使用『标准分区』来创建一个名为 biosboot 的挂载点,容量为 2M:

设备类型分为三种:

- 标准分区。
- LVM - 可以弹性增加或削减文件系统容量的类型。
- LVM 简单配置 - 可以使用多少容量就分配给磁盘多少容量,其实是 LVM 的高阶版。所以这个翻译也是醉了O(∩_∩)O~
文件系统分为以下几种:

文件系统类型 | 说明 |
---|---|
ext2/ext3/ext4 | Linux 早期使用的文件系统,现在很少用啦。 |
swap | 内存不足时,系统会把数据临时放入此空间,即把此空间当作内存。 |
BIOS Boot | GPT 分区表会用到。 |
xfs | CentOS 预设的文件系统。它很适合大容量的磁盘管理(T级容量),而且格式化速度很快。 |
vfat | 同时被 Linux 与 Windows 所支持的文件系统类型。如果主机硬盘内同时存在 Windows 与 Linux操作系统,为了实现两者之间的数据交换,可以建立一个 vfat 的文件系统。 |

接着,新建 /boot 挂载点,容量为 1G。

然后,新建根目录 『/』,容量为 10 G。

注意: 之后新建的挂载点( /, /home, swap) 都希望使用 LVM 设备类型,所以我们在『新增挂载点』之后,要回到详细设定页面,修改下设备类型。
接下来修改 LVM 设备的容量策略,点击 Volume Group 之下的『修改』按钮:

打开 Volume Group 配置页面,改变策略为『固定大小』,设定为 30 G:

接着,建立 /home 装载点,容量为 5 G:

把 /home 装载点的设备类型也改为 LVM,然后『更新设置』,就会发现 Volumn Group 只剩下 15 G 空间(总共 30G,根目录占用 10G,/home 占用 5G,30-10-5=15G)可用啦:

最后建立 /swap 挂载点:

同样,更新其设备类型为 LVM:

分区结果如下:

点击『完成』,就可以看到下面的『更改摘要』啦:

4.2.6 KDUMP

当 Linux 系统因为核心问题导致当机时, 会将当机事件发生时的内存数据转储出来。这里不用设置,直接使用默认值即可。
4.2.7 网络与主机名

点击箭头 2 处的『打开』,然后点击『配置』按钮,点击『常规』选项卡,勾选『可用时自动链接到这个网络』,让 CentOS 7 开机时,启动网络:

选择 IPv4 设置标签,然后调整方法为手动,接下来按下Add 新建 IP 地址与子网掩码,最后保存:

网络设置结果:

主机名称可以改为自己喜欢的名字:

最后,回到安装信息界面,点击『开始安装』:

终于开始安装啦O(∩_∩)O~
4.3 创建账号与设定密码
可以一边安装一边创建账号与设定密码哦:

4.3.1 修改 root 密码
在此可以修改系统管理员的密码:

4.3.2 创建日常使用账号
安全起见,我们一般会建立一个日常登入系统的账号,只有在必要时,才用使用特殊指令 (如 su, sudo 等等), 切换为 root 管理员身份。

看到此画面,就说明安装成功了!重启吧:

5 同意授权协议
第一次启动,必须先接受许可证:

勾选同意:

完成配置后,就会看到登陆账号列表啦:

输入账号、密码,就可以进入 CentOS 系统啦:

网友评论