How do you set the local timezone on a CentOS Linux server?

Though installations will vary, this is usually done via a file named timezone in the /etc directory.

By default, there’s probably already a file there set to the utc timezone.

So if you do a

cat /etc/timezone

you will see


Fortunately you don’t have to decipher all that. Your install probably has files for every timezone imaginable in the /usr/share/zoneinfo directory. You just have to create a symbolic link to one of those files. Then when Linux asks for the timezone, it returns the file you’ve linked to.

For example for the eastern time zone, EST, you could get away with something like this:

ln -sf /usr/share/zoneinfo/EST localtime

However, what would be even better is if you could specify a city near you that shares your timezone.

For example, I would chose cities from the America directory. Specifically I would choose New_York. So my timezone files link with

ln -sf /usr/share/zoneinfo/America/New_York localtime

The directories can be very specific… as we have some very specific people – like those crazy Indianans. People in the state of Indiana can be really whacky about timezones. So you can be even more specific like:

ln -sf /usr/share/zoneinfo/America/Indiana/Winamac localtime

In the end, you look around, chose the file that is best, remove the existing localtime file and create a link. Pretty simple really.

Add a Comment

Your email address will not be published. Required fields are marked *