Wednesday, December 9, 2009

CentOS / Linux: Change Timezone

I'm posting this for future reference and in the hopes that it might help somebody.  This works for CentOS5 (works on 3 and 4 as well).  I assume it works on RHEL as well since CentOS is just the open source version of that.


1. Go to the time zone directory


#cd /usr/share/zoneinfo


2. Find the timezone you want (in my case I prefer to run everything in UTC)
3. Copy the timezone you want to the localtime zone for the server.  In this case, we're going to switch the server to use UTC:


#cp UTC /etc/localtime


4. Type "y" to overwrite the current timezone.
5. The imezone should be changed automatically. Check the time by running:


#date


The "#" is the character for the command line prompt. Do not type this into your terminal.

No comments:

Post a Comment