Home / Tips / Web and Server / Change timezone in Centos 6

Change timezone in Centos 6

Please note that you have to have root access to be able to make the changes detailed below.

There are a series of time zone files located at /usr/share/zoneinfo. Select the appropriate named timezone for your location. For my location, Oklahoma, USA, I actually have two that I can select from: America/Chicago or US/Central. Make note of the appropriate folder and file for your timezone.

The active timezone used on your system is in the /etc/localtime file. The default will vary depending on your server host but often seems to be EST or EDT (depending on the time of year you are checking). We simply need to replace this file with the file we selected in the previous step.

If your server has an automated process to update these files when daylight savings calculations change, your/usr/share/zoneinfo files will be updated but the /etc/localtime file will not be. So, if you simply made a copy of the file, you’ll have to know when these updates come out and manually copy the file over. If you create a link, everything will take care of itself.

First, make a backup of the existing localtime file. It’s always good practice to make backups of original config files.

[[email protected] ~]$ sudo mv /etc/localtime /etc/localtime.bak

Next, create the link:

[[email protected] ~]$ sudo ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime

Make sure to replace America/Chicago with the directory (if your zone has one) and filename of the timezone you wish to use.

Now you just need to test your change. Run date from the command line, and ensure that the appropriate time, date, and timezone are reported.

Like Love Haha Wow Sad Angry

Check Also

How to achieve the best KVM performance?

KVM VPS can have additional performance by applying a few tweaks. These tweaks are only …

Come on join the discussion

You can contribute by commenting

Notify of