Table of Contents
System Clock Configuration to use UTC/GMT Timezone
For CentOS 7:
CentOS 7 now includes a tool to change the timezone, to view your current timezone run the following command
To change this to UTC (or to any other timezone) run the following:
timedatectl set-timezone UTC
For previous RedHat/CentOS releases:
On linux systems the system clock time zone should be set to UTC and ntpd should be running to keep the system clock synchronized. Proper configuration is described below (you must have root access to perform these procedures)
Setting time zone to UTC
- Edit /etc/syconfig/clock. It should look like this:
ZONE="UTC" UTC=true ARC=false
The ZONE line is the important line and it should be UTC or GMT.
- Check for the existence of /etc/localtime. If /etc/localtime is present, delete it.
Setting up network time protocol for clock synchronization
- Edit /etc/ntp.conf to set the time server. You can use any trusted time server (pool.ntp.org, time.nist.gov). My ntp.conf looks like this:
- Restart the ntpd service:
<root@machine>service restart ntpd
It may take a while for the clock to sync up.
- You can use ntpq -p to check connectivity to the time server and ntp's sync progress
- If the clock is off by a lot, you may need to use ntpdate to force a clock sync initially (ntpd must be stopped in order to use the ntp port)
[root@machine]# service ntpd stop Shutting down ntpd: [ OK ] [root@machine]# ntpdate time.nist.gov 29 Nov 18:37:26 ntpdate: adjust time server XXX.XXX.XXX.XXX offset 0.003698 sec [root@machine]# service ntpd start ntpd: Synchronizing with time server: [ OK ] Starting ntpd: [ OK ]