Setting timezone and synchronizing time with NTP

Check available timezones in your server by executing the command below.

ls /usr/share/zoneinfo/

Then simply delete the current timezone:

rm /etc/localtime

Create a symbolic link to /etc/localtime.

ln –s /usr/share/zoneinfo/Asia/Singapore /etc/localtime

If symblolic link not working, then you may use a copy command.

cp /usr/share/zoneinfo/Asia/Singapore /etc/localtime

Install NTP

yum install ntp

See all the timezones at this website http://www.pool.ntp.org/zone/asia. in the example below I will use Singapore timezone.

ntpdate sg.pool.ntp.org

Also keep in mind that ntp only affects the system time. The hardware clock on your server will not reflect that. So you want to set it as well so that the correct time is maintained after reboot

hwclock --systohc

Leave a Reply