服务器lcentos6.x
rpm -qa |grep ntp 查看是否安装
yum install ntp
Step1、修改时区备份原有文件
cp /etc/localtime /etc/localtime.bak
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
step2、修改clock文件参数
vi /etc/sysconfig/clock
ZONE=”Asia/Shanghai”
UTC=false
ARC=false
Step3、修改ntp服务并备份原有文件
cp /etc/ntp.conf /etc/ntp.conf.bak
Step4、修改ntp.conf文件参数
vi /etc/ntp.conf
#server 0.centos.pool.ntp.org iburst
#server 1.centos.pool.ntp.org iburst
#server 2.centos.pool.ntp.org iburst
#server 3.centos.pool.ntp.org iburst
server 10.254.96.101
server time.jtjc.yis.hn
10.254.17.253
Step5、手动同步一次服务器时间
service ntpd stop #停止服务
ntpdate 10.254.17.253 #保持和ntp服务器日期同步
service ntpd start #启动服务
chkconfig ntpd on #保持开机启动
Step6、写入硬件BIOS
hwclock -w
手动改
date -s 16:03:00
date -s “2022-01-06 16:03:00”
hwclock -w
查看日志
tail -100f /var/log/ntp.log #查看最近100条运行日志