Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


setting_system_clock_to_utc_gmt_timezone

System Clock Configuration to use UTC/GMT Timezone

For CentOS 7:

http://8086.support/content/12/76/en/how-do-i-change-the-timezone-on-centos-7-to-utc.html

CentOS 7 now includes a tool to change the timezone, to view your current timezone run the following command

timedatectl

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

  1. 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.

  2. Check for the existence of /etc/localtime. If /etc/localtime is present, delete it.

Setting up network time protocol for clock synchronization

  1. 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:
    server pool.ntp.org
  2. Restart the ntpd service:
    <root@machine>service restart ntpd

    It may take a while for the clock to sync up.

  3. You can use ntpq -p to check connectivity to the time server and ntp's sync progress
  4. 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[17670]: 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  ]
setting_system_clock_to_utc_gmt_timezone.txt · Last modified: 2017/04/05 20:11 by juckins