前言
因为怕自己以后想要装linux的时候忘记具体的步骤,所以这次写一个详细的安装步骤,做个备忘;以及给想要安装LInux的小白们一个详细的教程
1.创建新的虚拟机
2.选择系统和版本
这里使用CentOS 7
3.自定义名字和安装位置
4.根据电脑配置选择核心与线程
5.根据电脑配置选择内存大小
6.选择网络类型
这里选择NAT模式,文章的后面会分别介绍一下三种模式的不同
7.选择I/O控制器类型
按推荐设置就行
8.选择何种磁盘
一般都是选SCSI,根据推荐来就行
9.创建新虚拟磁盘
10.根据电脑配置设置磁盘大小
11.自定义硬件
12.添加镜像
13.开启虚拟机
14.选择直接安装
第一个选项是直接安装 第二个为验证镜像完整性 鼠标左键点一下就可以操控虚拟机,Ctrl+Alt呼出光标 这里选择第一个直接安装,回车
15.选择语言
16.选择日期和时间
17.选择预安装软件
作为一个初学者可以选择桌面熟悉熟悉,生产环境中都是使用最小安装
18.配置分区
boot为启动配置文件 swap是交换空间 设置完,点完成
19.设置密码
20.创建用户名
21.接受许可
22.安装完成
23.三种网络设置
1.桥接模式
1.作用
将主机网卡与虚拟机虚拟的网卡利用虚拟网桥进行通信
2.配置
选择桥接模式 打开终端
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
ether 00:0c:29:b3:c4:de txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 20 bytes 2044 (1.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 20 bytes 2044 (1.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:b5:7e:24 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost ~]# cd /etc/sysconfig/network-scripts/
[root@localhost network-scripts]# ls
ifcfg-ens33 ifdown-eth ifdown-isdn ifdown-sit ifup ifup-ib ifup-plip ifup-routes ifup-tunnel network-functions-ipv6
ifcfg-lo ifdown-ib ifdown-post ifdown-Team ifup-aliases ifup-ippp ifup-plusb ifup-sit ifup-wireless
ifdown ifdown-ippp ifdown-ppp ifdown-TeamPort ifup-bnep ifup-ipv6 ifup-post ifup-Team init.ipv6-global
ifdown-bnep ifdown-ipv6 ifdown-routes ifdown-tunnel ifup-eth ifup-isdn ifup-ppp ifup-TeamPort network-functions
[root@localhost network-scripts]# vim ifcfg-ens33
ens33配置如下 手动打开ONBOOT
[root@localhost network-scripts]# systemctl restart network
[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.130 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::a729:556c:6b93:4813 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:b3:c4:de txqueuelen 1000 (Ethernet)
RX packets 119 bytes 12207 (11.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 37 bytes 5495 (5.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 68 bytes 6932 (6.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 68 bytes 6932 (6.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:b5:7e:24 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ping 百度 成功
2.NAT模式
1.作用
NAT的作用是将私网地址转换为公网地址
2.配置
选择NAT模式 打开终端
root@localhost network-scripts]# systemctl restart network
[root@localhost network-scripts]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.129 netmask 255.255.255.0 broadcast 192.168.43.255
inet6 fe80::a729:556c:6b93:4813 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:b3:c4:de txqueuelen 1000 (Ethernet)
RX packets 5441 bytes 419427 (409.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1702 bytes 172109 (168.0 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 168 bytes 17792 (17.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 168 bytes 17792 (17.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:b5:7e:24 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@localhost network-scripts]# ping baidu.com
PING baidu.com (39.156.69.79) 56(84) bytes of data.
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=1 ttl=128 time=27.5 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=2 ttl=128 time=26.9 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=3 ttl=128 time=26.9 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=4 ttl=128 time=26.2 ms
64 bytes from 39.156.69.79 (39.156.69.79): icmp_seq=5 ttl=128 time=26.4 ms
3.仅主机模式
1.作用
仅主机模式实现远程控制,相当于一个内网
2.配置
查看IP地址和子网掩码
打开终端
[root@localhost network-scripts]# vim ifcfg-ens33
[root@localhost network-scripts]# systemctl restart network
总结
三种网络设置,一般采用NAT模式
|