How To Change Timezone on a CentOS 6 and 7

htt‮sp‬://www.lautturi.com
How To Change Timezone on a CentOS 6 and 7

To change the timezone on a CentOS 6 or 7 system, you can use the timedatectl command or the tzdata package.

  1. To change the timezone using the timedatectl command, use the set-timezone option and specify the timezone that you want to use. For example, to set the timezone to "Europe/Paris":
sudo timedatectl set-timezone Europe/Paris

This will change the timezone for the system and update the system clock.

  1. To change the timezone using the tzdata package, you will need to install the tzdata package and copy the desired timezone file to the /etc/localtime file.

First, install the tzdata package using the yum or dnf package manager:

sudo yum install tzdata

or

sudo dnf install tzdata

Next, copy the desired timezone file to the /etc/localtime file. For example, to set the timezone to "Europe/Paris", you can use the following command:

sudo cp /usr/share/zoneinfo/Europe/Paris /etc/localtime

This will change the timezone for the system and update the system clock.

Note: You will need to log out and log back in for the changes to take effect. You may also need to restart some services for the changes to be applied.

You can use the timedatectl command or the date command to verify the current timezone and system clock. For example:

timedatectl
date

These commands will show the current timezone and system clock.

It's a good idea to periodically review and update the timezone and system clock to ensure that they are accurate. This is especially important if you are using services that rely on accurate time, such as email or network services.

Created Time:2017-10-16 14:38:42  Author:lautturi