linux设置时间的方法

 0. date -R  中国上海的时区是+8000

1.tzselect

设置时区,依次选择5,9,1,1(如果时区不一样,执行下面的命令得到之后时间是不一样的)

2.sudo ntpdate asia.pool.ntp.org;date

与服务器同步时间

3. date -s "2012-08-27 15:04:00"  命令设置()

---------------------------------------------------------------------------

将时间同步加入开机启动

yum -y install ntp
# cenos6.7使用
#chkconfig ntpd on
systemctl enable ntpd.service
#查看是否加入开机启动
systemctl list-unit-files|grep enabled | grep ntpd

[root@server1 ~]# ntpdate -u ntp1.aliyun.com
10 Aug 09:30:54 ntpdate[2130]: adjust time server 182.92.12.11 offset -0.020472 sec
差距已经很小