Install and use the ntp time synchronization server of ubuntu server
I. Server
1 apt-get install ntp
2. The service is started by default after installation. if the service is not started, start it.
/Etc/init. d/ntp start
3 change vi/etc/ntp. conf to the following
Restrict default nomodify notrap noquery
Restrict 127.0.0.1
Restrict 10.91.0.0 mask 255.255.255.0 nomodify
Server 0.pool.ntp.org
Server 1.pool.ntp.org
Server 2.pool.ntp.org
Server 127.127.1.0 # local clock
Fudge 127.127.1.0 stratum 10
Driftfile/var/lib/ntp/drift
Broadcastdelay 0.008
Keys/etc/ntp/keys
4. Restart the ntp service.
/Etc/init. d/ntp restart
Ii. Client
1. Use the ntpdate command. If this command does not exist, install apt-get install ntp first.
/Usr/sbin/ntpdate 10.91.0.10 // that is, the synchronization time of the ntp server with the ip address 10.91.0.10
2. Set timed synchronization.
Vi/etc/crontab
30 01 ***/usr/sbin/ntpdate 10.91.0.10
The system automatically synchronizes the system time to the ntp server At 01:30 every morning.
Of course, the crontab time here refers to the client time, which is equivalent to the ntp server time after synchronization.
Gg296231363 Column