用NTPconfigurationCentos

我想configuration我的服务器使用NTP。 我希望他们都使用GMT时区。 我想使用公共NTP服务器,我该怎么做?

要将时区链接/etc/localtime/usr/share/zoneinfo中与您想要的时区相匹配的文件

 date Mon May 9 09:18:22 BST 2011 sudo mv /etc/localtime /etc/localtime.old sudo ln -s /usr/share/zoneinfo/GMT /etc/localtime date Mon May 9 08:19:42 GMT 2011 

要安装ntp(如果它尚未)

 sudo yum install ntp sudo chkconfig ntpd on sudo service ntpd start 

编辑:

据我所知,默认的/etc/ntp.conf将包含您需要的所有公共服务器。 但是,如果您需要,您可以添加以下serverconfiguration

 server 0.centos.pool.ntp.org server 1.centos.pool.ntp.org server 2.centos.pool.ntp.org 

你可以使用ntpq命令来查看它是否工作。

 /usr/sbin/ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== *time.nist.gov .ACTS. 1 u 397 1024 357 147.843 1.518 4.840 

偏移值告诉你多远不同步你

要将时区设置为GMT,请使用:

$ sudo rm / etc / localtime

$ sudo ln -s / usr / share / zoneinfo / GMT / etc / localtime


要安装NTP使用:

$ sudo yum -y安装ntp

并使其活跃于:

$ sudo chkconfig ntpd on

$ sudo service ntpd start