In this article, we will have explained the necessary steps to change time zone on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.
The time zone is often set during the installation of an operating system. There are some possibilities you might have chosen the wrong time zone or you want to change the time zone post the installation of an operating system.
Change Time Zone on CentOS
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo yum update
Step 2. Checking the Current Time Zone.
Command ‘timedatectl’ is a command-line utility that allows you to view and change the system’s time and date. It is available on all modern systemd-based Linux systems:
$ timedatectl Local time: Tue 2019-12-05 16:46:22 UTC Universal time: Tue 2019-12-05 16:46:22 UTC RTC time: Tue 2019-12-05 16:46:22 Time zone: Etc/UTC (UTC, +0000) System clock synchronized: no systemd-timesyncd.service active: yes RTC in local TZ: no
Step 3. Change Time zone on CentOS 8.
Use the following command to list all time zones:
$ timedatectl list-timezones ... America/Montserrat America/Nassau America/New_York America/Nipigon America/Nome America/Noronha ...
Now, I will set the system time zone as Central Standard Time (CST) by using America/New_York:
timedatectl set-timezone America/New_York
To verify the change, invoke the timedatectl command again:
$ timedatectl Local time: Tue 2019-12-05 13:33:10 EST Universal time: Tue 2019-12-05 18:33:10 UTC RTC time: Tue 2019-12-05 18:33:46 Time zone: America/New_York (EST, -0500) System clock synchronized: no systemd-timesyncd.service active: yes RTC in local TZ: no
Congratulation, you have learned how to set time zone on CentOS 8. If you have any question, please leave a comment below.