虚拟机配置CentOS7的超详细流程
<div id="navCategory"><h5 class="catalogue">目录</h5><ul class="first_class_ul"><li>一、镜像文件下载<ul class="second_class_ul"><li>1.地址</li><ul class="third_class_ul"><li>1.1 CentOS</li><li>1.2 Ubuntu</li></ul><li>2.下载</li><ul class="third_class_ul"></ul></ul></li><li>二、新建虚拟机<ul class="second_class_ul"></ul></li><li>三、启动配置<ul class="second_class_ul"><li>1.日期和时间——时区(DATE & TIME)</li><ul class="third_class_ul"></ul><li>2.键盘</li><ul class="third_class_ul"></ul><li>3.语言支持</li><ul class="third_class_ul"></ul><li>4.INSTALLATION SOURCE 安装资源</li><ul class="third_class_ul"></ul><li>5.SOFTWARE SELECTION软件安装选择</li><ul class="third_class_ul"></ul><li>6.磁盘分区</li><ul class="third_class_ul"><li>6.1 分区介绍</li><li>6.2 自定义分区</li><li>6.3 添加/boot</li><li>6.4 添加swap</li><li>6.5 保存配置</li></ul><li>7.网络和主机配置 NETWORK & HOST NAME</li><ul class="third_class_ul"></ul><li>8.KDUMP</li><ul class="third_class_ul"></ul><li>9.密码设置和新用户创建</li><ul class="third_class_ul"><li>9.1 ROOT 密码设置</li><li>9.2 USER 创建</li></ul><li>10.重启</li><ul class="third_class_ul"></ul><li>11.登录</li><ul class="third_class_ul"></ul></ul></li><li>总结<ul class="second_class_ul"></ul></li></ul></div><p class="maodian"></p><h2>一、镜像文件下载</h2><p class="maodian"></p><h3>1.地址</h3>
<p class="maodian"></p><h4>1.1 CentOS</h4>
<table><thead><tr><th>操作系统</th><th>网站名称</th><th>链接</th><th>特点</th></tr></thead><tbody><tr><td>CentOS</td><td>官方网站</td><td>https://www.centos.org/</td><td>提供下载、文档和社区支持,包括 CentOS Stream 和旧版本(如 CentOS 7)</td></tr><tr><td style="height:44px">CentOS</td><td style="height:44px">阿里云镜像</td><td style="height:44px">https://mirrors.aliyun.com/centos/</td><td style="height:44px">速度极快,尤其适合中国用户,提供所有版本(包括 Stream 和旧版)</td></tr><tr><td>CentOS</td><td>清华大学镜像</td><td>https://mirrors.tuna.tsinghua.edu.cn/centos/</td><td>版本齐全,更新及时,支持 HTTP/HTTPS 下载。</td></tr><tr><td>CentOS</td><td>华为云镜像</td><td>https://mirrors.huaweicloud.com/centos/</td><td>全球覆盖好,下载稳定,提供完整 ISO 和软件包</td></tr><tr><td>CentOS</td><td>网易镜像</td><td>https://mirrors.163.com/centos/</td><td>国内优化,下载速度快,历史版本完整</td></tr></tbody></table>
<p class="maodian"></p><h4>1.2 Ubuntu</h4>
<table><thead><tr><th>操作系统</th><th>网站名称</th><th>链接</th><th>特点</th></tr></thead><tbody><tr><td>Ubuntu</td><td>官方网站</td><td>https://ubuntu.com/</td><td>提供最新 LTS(长期支持版)和标准版下载,以及文档和社区资源</td></tr><tr><td>Ubuntu</td><td>阿里云镜像</td><td>https://mirrors.aliyun.com/ubuntu-releases/</td><td>亚洲区域优化,速度领先,版本更新快(覆盖旧版到最新版)</td></tr><tr><td>Ubuntu</td><td>清华大学镜像</td><td>https://mirrors.tuna.tsinghua.edu.cn/ubuntu-releases/</td><td>资源丰富,支持多协议下载,ISO 文件完整。</td></tr><tr><td>Ubuntu</td><td>华为云镜像</td><td>https://mirrors.huaweicloud.com/ubuntu-releases/</td><td>全球节点多,下载稳定,适合企业用户</td></tr><tr><td>Ubuntu</td><td>网易镜像</td><td>https://mirrors.163.com/ubuntu-releases/</td><td>国内访问速度快,历史版本齐全</td></tr></tbody></table>
<table><tbody><tr></tr></tbody></table>
<p class="maodian"></p><h3>2.下载</h3>
<p>这里以<code>阿里云</code>下载<code>CentOS</code>镜像文件按为例,流程如下:</p>
<ul><li>点击网址进入首页</li><li>选择对应版本号,点击</li><li>找到<code>isos</code>,点击</li><li>点击<code>X86_64</code></li><li>进入下载页面,选择对应需求的版本文件进行下载</li></ul>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115553320.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115553231.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P51155551b.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115556416.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P51155564J.png" /></p>
<table><thead><tr><th>文件类型</th><th>含义与作用</th></tr></thead><tbody><tr><td><code>.txt</code></td><td>文本说明文件,例如:<br />- <code>0_README.txt</code> :介绍镜像信息<br />- <code>sha256sum.txt</code> :存储镜像文件的哈希值,用于校验文件完整性</td></tr><tr><td><code>.asc</code></td><td><code>sha256sum.txt.asc</code> 是 <code>sha256sum.txt</code> 的签名文件,用于验证哈希值文件本身的真实性和完整性</td></tr><tr><td><code>.iso</code></td><td>CentOS 7 系统镜像文件,不同前缀对应不同安装场景:<br />- <code>DVD</code>:标准完整安装镜像<br />- <code>Everything</code>:包含几乎所有软件包的全量镜像<br />- <code>Minimal</code>:仅含基础组件的最小化镜像<br />- <code>NetInstall</code>:需联网补充软件包的网络安装镜像</td></tr><tr><td><code>.torrent</code></td><td>BT 下载种子文件,可使用 BT 下载工具(如迅雷),基于种子文件从多个节点加速下载对应的 <code>.iso</code> 镜像文件</td></tr></tbody></table>
<p class="maodian"></p><h2>二、新建虚拟机</h2>
<p>创建虚拟机我们使用<code>VMware Workstation Pro</code>这个工具(没有这个工具的可以自行搜索下载的教程),流程如下:</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511555H22.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511555GC.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511555V02.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115559246.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P51155594Z.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115600462.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115600301.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P51156014Y.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P51156013R.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115601L1.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115603254.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115603937.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511560D35.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115606349.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511560OO.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511560L37.png" /></p>
<p>点击完成,如果勾选了创建后开启虚拟机,那么会自动运行,没有勾选也可以通过绿色的倒置三角新手动运行,然后静静等待虚拟机完成安装。<br />补充说明一下,通过下面图片的编辑虚拟机设置也可以对虚拟机的配置进行更改:</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511560WV.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115614Y3.png" /></p>
<p>PS: 配置参数说明</p>
<table><thead><tr><th>网络模式</th><th>原理</th><th>优点</th><th>缺点</th><th>适用场景</th></tr></thead><tbody><tr><td>NAT</td><td>虚拟机借主机 IP 连外网,主机做网关转发</td><td>配置简单、隔离性好、省 IP</td><td>外部无法主动连虚拟机、有性能损耗</td><td>虚拟机仅访问外网(如浏览、测试)</td></tr><tr><td>桥接</td><td>虚拟机直连外网,等同局域网独立设备</td><td>功能完整、性能好</td><td>配置复杂、安全风险高、占 IP</td><td>虚拟机需对外提供服务(如搭网站、连局域网设备)</td></tr></tbody></table>
<table><thead><tr><th><strong>磁盘选项</strong></th><th><strong>含义</strong></th><th><strong>优点</strong></th><th><strong>缺点</strong></th><th><strong>适用场景</strong></th></tr></thead><tbody><tr><td><strong>创建新虚拟磁盘</strong></td><td>在主机文件系统上生成一个或多个文件,模拟硬盘供虚拟机使用</td><td>可按需分配磁盘大小,方便迁移和复制;能灵活调整资源,满足不同虚拟机需求</td><td>初始创建时,若设置较大容量,可能占用较多主机磁盘空间</td><td>首次创建虚拟机,或需要为不同虚拟机分配独立、定制化磁盘空间的情况</td></tr><tr><td><strong>使用现有虚拟磁盘</strong></td><td>复用之前已配置好的虚拟磁盘文件</td><td>节省磁盘空间,无需重新配置磁盘;对于配置复杂的磁盘,可快速部署虚拟机</td><td>受限于现有磁盘的配置和数据,可能无法满足新虚拟机的个性化需求;若原磁盘损坏,新虚拟机受影响</td><td>需要快速部署虚拟机,且现有磁盘配置能满足新虚拟机使用需求,如测试环境中复用相同配置的虚拟机</td></tr><tr><td><strong>使用物理磁盘(高级)</strong></td><td>让虚拟机直接访问本地物理硬盘</td><td>虚拟机可充分利用物理磁盘性能,能访问物理磁盘上的所有数据;可用于特定的高级应用,如磁盘数据的直接读写测试</td><td>操作复杂,需管理员权限,有一定风险,可能导致物理磁盘数据丢失或损坏;不同虚拟机使用同一物理磁盘时,管理难度大</td><td>对磁盘性能要求极高,或有特殊需求,如直接访问物理磁盘特定分区数据的专业测试、数据恢复测试等</td></tr></tbody></table>
<p class="maodian"></p><h2>三、启动配置</h2>
<p>安装完成后,进行初始化启动配置:</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115615K4.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511561JX.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511561T02.png" /></p>
<p class="maodian"></p><h3>1.日期和时间——时区(DATE & TIME)</h3>
<p class="maodian"></p><h3>2.键盘</h3>
<p>KEYBOARD 键盘就默认是English(US)</p>
<p class="maodian"></p><h3>3.语言支持</h3>
<p>可以是默认的English,也可以自行添加Chinese简体中文的支持</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511561b14.png" /></p>
<p class="maodian"></p><h3>4.INSTALLATION SOURCE 安装资源</h3>
<p>默认选择–Local media 本地媒体文件</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115619D1.png" /></p>
<p class="maodian"></p><h3>5.SOFTWARE SELECTION软件安装选择</h3>
<p>字符界面安装–<code>Minimal install</code> 或者 <code>Basic Web Server</code><br />图形化界面安装–<code>GNOME Desktop</code></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115619106.png" /></p>
<p class="maodian"></p><h3>6.磁盘分区</h3>
<p class="maodian"></p><h4>6.1 分区介绍</h4>
<p>必选分区(核心分区)—— 这些分区是系统安装时必须创建的,用于基础运行</p>
<table><tbody><tr><th>分区</th><th>推荐大小</th><th>文件系统</th><th>作用说明</th><th>是否必需</th></tr><tr><td>/boot</td><td>512MB</td><td>ext4</td><td>存放内核、引导文件</td><td>是</td></tr><tr><td>/ (根)</td><td>15-18GB</td><td>XFS/ext4</td><td>系统核心、软件、所有未挂载目录</td><td>是</td></tr><tr><td>swap</td><td>2GB</td><td>swap</td><td>虚拟内存(休眠/内存溢出缓冲)</td><td>是</td></tr></tbody></table>
<p>可选分区(按需添加)—— 这些分区根据实际需求选择性创建,用于优化特定场景</p>
<table><tbody><tr><th>分区</th><th>推荐大小</th><th>作用说明</th><th>推荐场景</th></tr><tr><td>/home</td><td>剩余空间</td><td>用户数据独立存储</td><td>多用户/重数据存储</td></tr><tr><td>/var</td><td>2-4GB</td><td>日志、缓存、数据库</td><td>服务器/频繁写操作</td></tr></tbody></table>
<p class="maodian"></p><h4>6.2 自定义分区</h4>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115620120.png" /></p>
<p class="maodian"></p><h4>6.3 添加/boot</h4>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115623Y0.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P51156244P.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115625K7.png" /></p>
<p class="maodian"></p><h4>6.4 添加swap</h4>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511562B01.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511562J22.png" /></p>
<p class="maodian"></p><h4>6.5 保存配置</h4>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511562H14.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511562TF.png" /></p>
<p class="maodian"></p><h3>7.网络和主机配置 NETWORK & HOST NAME</h3>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511562Wb.png" /></p>
<p>注意主机名字修改后要点击后面的<code>apply</code>进行应用,不然不会修改</p>
<p class="maodian"></p><h3>8.KDUMP</h3>
<p>Kdump 是 Linux 内核的重要故障诊断工具,它的核心作用是 在内核崩溃时自动捕获内存快照(即 vmcore 文件),帮助开发者或运维人员分析崩溃原因。但是Kdump 需要预留一部分内存(通常 几十MB ~ 1GB+)给备用内核。</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115629362.png" /></p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511562a45.png" /></p>
<p class="maodian"></p><h3>9.密码设置和新用户创建</h3>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P511562aY.png" /></p>
<p class="maodian"></p><h4>9.1 ROOT 密码设置</h4>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115630X4.png" /></p>
<p class="maodian"></p><h4>9.2 USER 创建</h4>
<p>可以直接用ROOT进行登录(不创建,看喜好)</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115631S7.png" /></p>
<p class="maodian"></p><h3>10.重启</h3>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115631L3.png" /></p>
<p class="maodian"></p><h3>11.登录</h3>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115632b1.png" /></p>
<p>查看IP</p>
<p style="text-align:center"><img style="max-width:100%!important;height:auto!important;"alt="" src="https://zhuji.jb51.net/uploads/allimg/20250805/2-250P5115633291.png" /></p>
<p>至此,成功创建!!!</p>
<p class="maodian"></p><h2>总结</h2>
<p>安装 CentOS 虚拟机的核心步骤为:</p>
<ul><li>下载合适的镜像文件(推荐国内镜像站提升速度)</li><li>通过 VMware 创建虚拟机并配置硬件参数(重点关注网络模式和磁盘选择</li><li>启动虚拟机后完成时区、分区、网络等初始化设置</li></ul>
<p>以上就是虚拟机配置CentOS7全流程(超详细)的详细内容,更多相关资料请阅读琼殿技术社区其它文章!</p>
頁:
[1]