macOS系统虚拟机安装centos7(命令行模式)
文章目录
一、准备软件和系统
二、安装centos7系统
三、配置固定IP便于远程管理
一、准备软件和系统
1、下载MAC虚拟机软件VMware Fusion Pro 11 :https://www.newasp.net/soft/462096.html
2、下载centos7系统镜像:http://mirror.bit.edu.cn/centos/7.8.2003/isos/x86_64/
(下载标准版的)
二、安装centos7系统
1、打开虚拟机软件,选择创建自定虚拟机,点击继续。

2、选择Linux,CentOS 7 64 位,点击继续。

3、选择传统BIOS,点击继续。

4、选择新建虚拟磁盘,点击继续。

5、选择自定设置。

6、选择虚拟机存储位置,点击存储。

7、点击CD\DVD(IDE)。(此界面可修改cpu、内存、硬盘大小,修改网络连接方式等)

8、选中连接CD/DVD驱动器,选择系统安装镜像,点击左上角关闭此界面。

9、点击启动图标。

10、向上方向键选择Install CentOS 7,回车开始安装系统。

11、选择安装过程中使用的语言,这里选择中文、简体中文(中国),点击继续。

12、点击网络和主机名,设置网络。

13、首先打开网卡开关,然后查看是否能获取到IP地址(虚拟机网络适配器默认使用NAT模式),更改主机名,点击应用,点击完成。

14、点击日期和时间(T),设置系统日期时间。

15、时区选择亚洲、上海,设置正确的日期和时间,打开网路时间开关(如果宿主主机已经连接互联网,则会自动校准时间),然后点击完成。

16、点击软件选择(S),选择需要安装的软件系统。

17、此处选择基础设施服务器(安装完成后进入命令行系统)。然后点击完成。(若选择带GUI的服务器或GNOME桌面或KDE Plasma Workspaces,安装完成后都可以进入图形化桌面系统)

18、选择安装位置(此处可进行磁盘划分)。

19、选择我要配置分区,然后点击完成。

20、弹出下图界面,点击加号,选择/boot,给boot分区分200M,最后点击添加挂载点。

21、然后以同样的办法给其他分区分配空间,分配完成后点击完成。

如果你是新手记住:除了SWAP分区外,其他分区的文件系统一律选择ext4类型,设备类型默认选LVM
--------------------------分区方案描述------------------------------
必须的分区
boot分区:(400M)
作用:引导分区,包含了系统启动的必要内核文件,即使根分区顺坏也能正常引导启动 一般这些文件所占空间在200M以下,
分区建议:分区的时候可选100M-500M之间,如果空间足够用,建议分300-500M。避免由于长期使用的冗余文件塞满这个分区。
分区格式:建议ext4,按需求更改
/分区(根分区):(15G)
作用:所有的文件都从这里开始,你可以比喻为Windows的C盘,但其实有区别。如果你有大量的数据在根目录下(比如FTP等)可以划分大一点的空间
分区建议:建议15G以上。看需求,根分区和home分区的大小就类似C盘和D盘的空间分布一样,主要占空间在哪儿就在那里分大容量
分区格式:建议ext4,按需求更改
swap分区:(4G)
作用:类似于Windows的虚拟内存,在内存不够用时占用硬盘的虚拟内存来进行临时数据的存放,而对于linux就是swap分区
分区建议:建议是物理内存大小的2倍,比如你电脑是4G的物理内存,swap分区可以是8G
分区格式:swap格式
可选的分区
home分区
作用:存放用户数据,HOME的结构一般是 HOME/userName/userFile,如果不分则默认在/目录下
分区建议:如果用户数据多可以将此分区适当增大,请参考“根分区”分区建议;一般硬盘的主要容量几乎都在Home分区和根分区下
分区格式:建议ext4,按需求更改
var分区
作用:用于log日志的文件的存放,如果不分则默认在/目录下
分区建议:如果你安装的linux是用于服务器或者经常做日志分析,请划分var分区,避免日志文件不断膨胀塞满导致根分区而引发问题。
分区格式:建议ext4,按需求更改
22、弹出更改摘要界面,点击接受更改。

23、选择开始安装。

24、点击ROOT密码。

25、设置完ROOT密码后点击完成。

26、点击创建用户。

27、输入用户名密码后点击完成(可以设置此账户为管理员)。(因为可能有密码策略,此处密码设置需符合密码策略才可进行下一步安装)

28、等待系统安装完毕重启系统。

29、等待系统安装完毕重启系统,系统命令行界面如下。

三、配置固定IP便于远程管理
1、编辑文件/etc/sysconfig/network-scripts/ifcfg-ens33,配置ip地址等信息,修改下图红框内容。
vi /etc/sysconfig/network-scripts/ifcfg-ens33
BOOTPROTO=“static” # 设置为手动分配IP地址
IPADDR=“192.168.31.200” # 配置为局域网固定IP
GATEWAY=“192.168.31.1” # 配置局域网网关
NETMASK=“255.255.255.0” # 配置子网掩码
DNS1=“8.8.8.8” # 配置首选DNS,8.8.8.8或114.114.114.114为免费DNS服务器的IP地址
备注:需要修改才能连接到网络;详情见
2、选中连接网络适配器,选中桥接模式网络连接自动检测(我使用WiFi联网),点击关闭。

3、重启网络服务,即可使用固定IP远程登录和联网了(前提宿主主机已经联网)。
service network restart
或
systemctl restart network

资料:
https://blog.csdn.net/renfeigui0/article/details/102655383