一看就会的Linux系统安装教程及网络配置问题

编程入门 行业动态 更新时间:2024-10-27 08:31:05

文章目录

  • 前言
  • 一.安装流程
    • 1.创建新的虚拟机
    • 2.选择系统和版本
    • 3.自定义名字和安装位置
    • 4.根据电脑配置选择核心与线程
    • 5.根据电脑配置选择内存大小
    • 6.选择网络类型
    • 7.选择I/O控制器类型
    • 8.选择何种磁盘
    • 9.创建新虚拟磁盘
    • 10.根据电脑配置设置磁盘大小
    • 11.自定义硬件
    • 12.添加镜像
    • 13.开启虚拟机
    • 14.选择直接安装
    • 15.选择语言
    • 16.选择日期和时间
    • 17.选择预安装软件
    • 18.配置分区
    • 19.设置密码
    • 20.创建用户名
    • 21.接受许可
    • 22.安装完成
    • 二.3种网络设置
    • 1.桥接模式
      • 1.作用
      • 2.配置
    • 2.NAT模式
      • 1.作用
      • 2.配置
    • 3.仅主机模式
      • 1.作用
      • 2.配置
  • 三.关闭防火墙
  • 四.关闭防火墙开机自启
  • 五.关闭Selinux
  • 六.ping命令
  • 总结


前言

前两天突然一个项目要装linux,好久不装,一时之间竟有点生疏,所以怕自己以后想要装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.安装完成

二.3种网络设置

1.桥接模式

1.作用

将主机网卡与虚拟机虚拟的网卡利用虚拟网桥进行通信

2.配置

选择桥接模式


打开终端

[root@localhost ~]# ifconfig
//查看ip地址
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 
//编辑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

三.关闭防火墙

四.关闭防火墙开机自启

五.关闭Selinux

改为disable

六.ping命令

ping -c
//表示指定ping几次

ping -i
//秒数:设定间隔几秒钟,送一个网络封包给一台机器,预设1S1次

ping -w
//表示超时时间为5S,意思只为ping5s,5s后结束

总结

三种网络设置,一般采用NAT模式

更多推荐

一看就会的Linux系统安装教程及网络配置问题

本文发布于:2023-06-14 02:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1427965.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:就会   系统安装   教程   网络   Linux

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!