大道至简

学必求其心得,业必贵于专精。

0%

修改时区

方式一:

1
2
3
4
5
date
ll /usr/share/zoneinfo/Asia/Shanghai
rm -f /etc/localtime
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
date

方式二:

1
2
3
4
5
6
7
8
修改为上海时区
timedatectl
timedatectl set-timezone Asia/Shanghai
timedatectl

yum install -y chrony
chronyc -n sources -v
chronyc tracking

方式三:

1
2
3
yum install -y ntpdate
ntpdate -u ntp.api.bz
timedatectl

方式四:和内网某台机器同步:

1
2
3
4
5
6
7
8
9
10
确定是否安装ntpd服务

rpm -qa | grep ntpd

如果没有安装,可以进行在线安装

yum -y install ntpd
查看ntpd的状态

service ntpd status
1
2
3
4
5
6
7
启动服务

service ntpd start

设置服务开机启动

chkconfig ntpd on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
编辑配置文件

vim /etc/ntp.conf

将node01的时间广播到100.0这个网段

restrict 192.168.100.0 mask 255.255.255.0 nomodify notrap

注释四行内容

#server0.centos.pool.ntp.org

#server1.centos.pool.ntp.org

#server2.centos.pool.ntp.org

#server3.centos.pool.ntp.org

去掉以下内容的注释,如果没有这两行注释,那就自己添加上

server 127.127.1.0 # localclock

fudge 127.127.1.0 stratum 10
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

配置以下内容,保证BIOS与系统时间同步

保证node01与外网时间同步

vim /etc/sysconfig/ntpd

添加一行内容

SYNC_HWLOCK=yes

重启ntpd 服务

service ntpd restart

设置另外两台机器与第一台机器时间同步

ntpdate 192.168.100.201