# 1.配置网络 1. 首先进入root模式 2. 打开 ```shell cd /etc/sysconfig/network-scripts/ vim ifcfg-ens33 ``` ```shell TYPE=Ethernet BOOTPROTO=static //这里改一下,默认的是dhcp,改成static表示静态的意思 DEFROUTE=yes PEERDNS=yes PEERROUTES=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_PEERDNS=yes IPV6_PEERROUTES=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens33 UUID=fa3a4df3-e833-410a-9c95-94e3ee645d12 DEVICE=ens33 ONBOOT=yes //这里改成yes,表示网卡设备开机启动 //下边的都是加上的 IPADDR=192.168.133.20 //IP地址自己写,只要和网关处于同一网段就行,如192.168.133.xxx PREFIXO=24 NETMASK=255.255.0.0 //这里是子网掩码 GATEWAY=192.168.133.2 //这里是网关 DNS1=192.168.133.2 //这里是网关 DNS2=8.8.8.8 ``` 3. 配置如下 ![image-20210705094943628](../../照片/image-20210705094943628.png) 4. ![image-20210628154743311](../../照片/image-20210628154743311.png) 5. 重启即可 ```shell systemctl restart network ``` # 2.关闭防火墙 ``` systemctl stop firewalld && systemctl disable firewalld ``` # 3.开启时间同步 ```shell # 0.下载wget,如果没有的话 yum install wget -y # 1.先备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak # 2.下载 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum install -y epel-release # 或者 curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo yum install -y epel-release # 非阿里云ECS用户会出现 Couldn't resolve host 'mirrors.cloud.aliyuncs.com' 信息,不影响使用。用户也可自行修改相关配置: eg: sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo # 3.清理缓存 yum clean all # 清除系统所有的yum缓存 yum makecache # 生成yum缓存 # 4.安装时间同步软件 yum install ntp -y systemctl enable ntpd && systemctl start ntpd timedatectl set-timezone Asia/Shanghai ``` # 4.主机名称 ```shell hostnamectl set-hostname ``` # 5.界面控制 ```shell # 安装界面 yum -y groups install "GNOME Desktop" systemctl set-default multi-user.target //设置成命令模式 systemctl set-default graphical.target //设置成图形模式 # 进入图像模式 startx ``` ## 6.查看版本 ```shell cat /etc/redhat-release ```