本文适用于初学者,帮助初学者学习如何创建虚拟机,了解在创建过程中各个选项的含义。
环境如下:
CentOS版本: CentOS 7.9(2009)
软件: VMware® Workstation 17 Pro 17.5.0 build-22583795
1.配置虚拟机硬件
1.1 新建
点击新建虚拟机
1.2 自定义
选择自定义安装,有助于更好的学习,了解虚拟机。
1.3 硬件
点击下一步。无特殊需要不用改动。
1.4 安装来源
选择稍后安装。
如果选择安装光盘文件,VMware 可能会自动使用 Easy Install(简易安装),这会跳过手动配置的步骤,自动设置:
root 用户名和密码(有时可能默认设置,导致忘记密码)
磁盘分区方案(可能与你的需求不符)
默认的软件包(可能少了你需要的软件)
1.5 操作
操作系统选择linux,版本选择CentOS 7 64位。
1.6 名称
名称可以随意更改,但注意不要于其他虚拟机重名。
位置自己选择,占内存较大,一般不要放在C盘。
1.7 处理器
处理器数量会影响虚拟机的计算能力。必须根据计算机的自身性能来选择。
首先打开任务管理器,选择性能->CPU,查看计算机的内核数。
一般低配为2+2,也可以根据自身情况修改,我这里选择4+2。
1.8 内存
内存关乎虚拟机的性能,内存越大,系统运行越流畅。
打开任务管理器,点击性能->内存,这里同样不要超过实际内存。
一般2G够学习用,我这里出于企业学习,选择较大内存。
1.9 网络
NAT模式允许虚拟机通过宿主机访问外部网络,而不需要直接分配物理网络 IP。
使用于大多学习环境。
1.10 I/O控制器
这里直接选择推荐即可。
1.11 磁盘类型
这里同样按推荐。
1.12 磁盘
1.13 磁盘容量
50G足够学习使用,并非直接占用50G,而是规定了一个最大的限度,实际使用上使用了多少内存就占用多少。
1.14 命名
可根据自己意愿修改,一般直接下一步。
1.14 完成
1.15 配置镜像文件
以上步骤相当于已经配置完成虚拟机硬件,接下来配置软件。
右击新建的虚拟机,点击设置。
点击CD,选择使用ISO映像文件,点击浏览,找到事先准备好的镜像文件。
最后点击下一步。
2.配置虚拟机软件
2.1 开启
点击开启此虚拟机。
2.2 安装
这里有两个选项
1.直接安装linux。
2.测试并安装linux。(此选项是为了测试镜像文件是否有问题,如果确保无误,直接选择第一个)
鼠标点击虚拟机中黑屏部分,会进入虚拟机,此时鼠标箭头会消失,点击键盘中的向上箭头,第一行的选项会变为白色,此时点击Enter即可开始运行。
同时按Ctrl和Alt即可返回自己的计算机。
2.3 语言
在语言这一栏的最下面,选择中文。点击继续。
2.5 配置
等待这些配置加载完成
直到成为这样。
2.6 软件选择
点击软件选择,选择GNOME桌面,然后点击完成。返回后等待加载完成。
2.7 KDUMP
点击KDUMP
将启用KDUMP选项的勾选取消。再点击完成。
2.7 安装位置
点击安装位置,进入之后什么也不用做,点击完成。
2.8 网络
点击关闭按钮,把他打开,再点击完成。
2.9 开始安装
点击开始安装。
2.10 ROOT密码设置
设置root密码,密码不能是回文数,强度不能太弱。
2.11 等待
此时只需静静等待虚拟机安装完毕。
安装完成后,点击重启。
2.12 进入
点击enter进入
2.12 许可证
点击我同样,然后点完成。
最后点击完成配置
2.12 基本配置
选择汉语,然后前进
前进
一直前进,选择时区
填写用户名。
设置密码
3.基础配置的修改
3.1修改root密码
在学习linux时,简单的密码可以方便我们的学习。
可以通过以下方式修改为简单的密码,比如111111。
3.2修改镜像源文件
CentOS 7.9(2009)是 CentOS 7 的最终版本,官方已经 停止维护,最好把其自带的镜像文件替换。
可以进行手动替换。
vi /etc/yum.repos.d/CentOS-Base.repo
以下为阿里云的镜像文件:
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
http://mirrors.cloud.aliyuncs.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
替换后输入以下语句,如果可以正常获取软件包,说明替换成功
yum clean all
yum makecache
现在可以,配置好了linux的基本配置,可以开始学习linux了。