Here is the output of my date
command:
[root@r1304 ~]# date
Wed Apr 18 15:43:28 GST 2012
I want to change the default system timezone to Asia/Dubai. I've followed a tutorial and did this:
ln -sf /usr/share/zoneinfo/Asia/Dubai /etc/localtime
But with no effect. Seems that this is done differently in CentOS 6. How do I change the timezone?
It looks like that CentOS 6.2 doesn't have any hwclock line in it
/etc/rc.sysinit
, so changing/etc/sysconfig/clock
will not work.Try
tzselect
or useln -s /usr/share/zoneinfo/xxxx /etc/localtime
First use tzselect to find out which is your timezone. The final output of tzselect will be something like:
The very last line is the name of your zoneinfo file.
Now create a symlink from /etc/localtime to the correct zoneinfo file, e.g.:
The -f flag is needed to overwrite the existing /etc/localtime.
Note: running tzselect won't touch anything on your system, it will just output some text. The "or" in the answer by caojun is misleading. You must use tzselect AND ln. From the tzselect manpage: "[tzselect] outputs the resulting timezone description to standard output".
Edit the file
/etc/sysconfig/clock
to suit your needs.One should restart rsyslogd after changing the timezone so that the new timezone is reflected in the logs.
Do this with: service rsyslog restart
Simple tutorial, try this..