Thursday, October 30, 2008

How to change the Time Zone on your Redhat / Centos system

cp /usr/share/zoneinfo/Africa/Johannesburg /etc/localtime

will set your time zone to SAST

you can simply use Tab auto completion to find the exact time zone you want by choosing the continent and city of your choice for example to change your timezone to London's time

cp /usr/share/zoneinfo/Europe/London /etc/localtime

to change to universal time type

cp /usr/share/zoneinfo/Universal /etc/localtime

to change to GMT time type

cp /usr/share/zoneinfo/GMT /etc/localtime

if asked if you want to overwrite the localtime file answer yes.

Tab auto completion is very useful in finding the exact time zone you want.


George Makande said...

well i have been trying all the commands to change time on my centos server but it seems the time is always changing. it kinder moves faster 1min-30sec How do i fix this?

George Makande said...
This comment has been removed by a blog administrator.
CG said...

Hi, George, what time zone are you trying to set your mail server too ?

CG said...

If you want your server to keep time in sync with an NTP server over the internet. you need to install NTP server, yum install ntp then chkconfig ntpd on (to make sure it starts after reboot and then service ntpd start to start it, by default your server will sync with the centos ntp servers, you can change these by editing the /etc/ntp.conf file