一、系统环境配置
1、配置固定IP地址
# 修改网络配置文件
[root@localhost /]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static #此处修改为static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
UUID=8babe976-5931-41fa-bf6f-d0a653318335
DEVICE=eth0
ONBOOT=yes #此处修改为yes
# 增加以下固定IP配置
IPADDR=192.168.1.201
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=223.5.5.5
DNS2=223.6.6.6
DNS建议使用阿里云DNS(223.5.5.5,223.6.6.6),114DNS(114.114.114.114,114.114.115.115),谷歌DNS(8.8.8.8,8.8.4.4)
2、重启系统网络服务
# 重启网络
[root@localhost /]# service network restart
Restarting network (via systemctl): [ OK ]
# 检查网络
[root@localhost /]# ping www.baidu.com
PING www.a.shifen.com (183.2.172.42) 56(84) bytes of data.
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=1 ttl=52 time=5.73 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=2 ttl=52 time=5.80 ms
64 bytes from 183.2.172.42 (183.2.172.42): icmp_seq=3 ttl=52 time=5.78 ms
^C
--- www.a.shifen.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 5.732/5.772/5.803/0.068 ms
[root@localhost /]#
3、更新系统版本
# 执行yum更新
[root@localhost /]# yum update
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* extras: mirrors.ustc.edu.cn
* updates: mirrors.ustc.edu.cn
No packages marked for update
#检查更新后的版本
[root@localhost /]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
[root@localhost /]#
4、同步系统时间
# 安装ntpdate服务
[root@localhost /]# yum install ntpdate -y
# 同步系统时间
[root@localhost /]# ntpdate time.nist.gov
15 May 10:43:55 ntpdate[10644]: step time server 132.163.97.2 offset 1.284436 sec
# 查看同步时间
[root@localhost /]# date
Wed May 15 10:44:00 CST 2024
[root@localhost /]#