服务器时间的手动设置
查看时刻:
[root@localhost ~]# date
2011年 02月 26日 星期六 21:45:09 CST
修改时间:
[root@localhost ~]# date -s 2011/02/28
2011年 02月 28日 星期一 00:00:00 CST
[root@localhost ~]# date -s 08:31:15
2011年 02月 28日 星期一 08:31:15 CST
or
[root@localhost ~]# date -s "2011/02/28 08:31:15"
ntp服务的安装
安装:
[root@localhost ~]# yum install ntp
[root@localhost ~]# rpm -qa|grep ntp
ntp-4.2.2p1-9.el5.centos.2
ntp时间服务器的设置:
[root@localhost ~]# vi /etc/ntp.conf
server 0.centos.pool.ntp.org
server 1.centos.pool.ntp.org
server 2.centos.pool.ntp.org
server 130.69.251.23 #可以在此处添加
ntp服务启动/关闭/重启:
[root@localhost ~]# service ntpd start
[root@localhost ~]# service ntpd stop
[root@localhost ~]# service ntpd restart
开机自动启动设置:
[root@localhost ~]# chkconfig ntpd on
[root@localhost ~]# chkconfig --list ntpd
ntpd 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
手动同步时间:
[root@localhost ~]# ntpdate time.windows.com
22 Mar 09:45:14 ntpdate[31325]: step time server 207.46.232.182 offset -29409.044121 sec
如若转载,请注明出处:https://www.ozabc.com/jianzhan/24396.html