How To Change TimeZone on Rocky Linux 9
In this tutorial, we will show you how to install aaPanel on Rocky Linux 9. For those of you who didn’t know, The time zone of a system is the geographic region where the system is located. It determines the local time, which is used to display the date and time on the system. By default, the time zone is set during the installation of the operating system. However, it may be necessary to change the time zone if you move to a new location or if the time zone was set incorrectly during the installation.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you the step-by-step change timezone on Rocky Linux. 9.
Prerequisites
- A server running one of the following operating systems: Rocky Linux 9.
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- SSH access to the server (or just open Terminal if you’re on a desktop).
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Change TimeZone on Rocky Linux 9
Step 1. The first step is to update your system to the latest version of the package list. To do so, run the following commands:
sudo dnf check-update sudo dnf install dnf-utils
Step 2. Check your current TimeZone.
To check your current timezone, display the date and time you use the timedatectl
command:
timedatectl
Output:
[root@idroot.us ~]# timedatectl Local time: Mon 2022-12-17 23:46:36 EDT Universal time: Tue 2022-12-18 03:46:36 UTC RTC time: Tue 2022-12-18 03:46:36 Time zone: America/New_York (EDT, -0400) System clock synchronized: yes NTP service: active RTC in local TZ: no
So, another option to check the timezone is to check the path symlink by using the ls
command:
ls -l /etc/localtime
Output:
[root@idroot.us ~]# ls -l /etc/localtime lrwxrwxrwx. 1 root root 18 Dec 17 03:46 /etc/localtime -> ../usr/share/zoneinfo/America/New_York
Step 3. Change TimeZone on Rocky Linux 9.
Before changing the time zone, you must find out the long name for the time zone you want to use. Time zone naming conventions usually use the “Region/City” format. Using timedatectl
the command to list TimeZones:
timedatectl list-timezones
Output:
[root@idroot.us ~]# timedatectl list-timezones Africa/Abidjan Africa/Accra Africa/Addis_Ababa Africa/Algiers Africa/Asmara Africa/Bamako Africa/Bangui Africa/Banjul Africa/Brazzaville Africa/Bujumbura Africa/Cairo
Scroll through the list and find the time zone that you want to set. For example, to set the time zone to Eastern Standard Time, you would find “America/New_York
” in the list. Set the time zone by entering the following command, replacing “TIMEZONE” with the time zone you want to set:
timedatectl set-timezone TIMEZONE
For example, to set the time zone to Eastern Standard Time, you would enter the following command:
timedatectl set-timezone America/New_York
To verify that the time zone has been set correctly, enter the following command below:
timedatectl
Output:
[root@server ~]# timedatectl Local time: Tue 2022-12-17 23:42:50 GMT Universal time: Tue 2022-12-18 03:46:53 UTC RTC time: Tue 2022-12-18 03:46:53 Time zone: America/New_York (GMT, +0000) System clock synchronized: yes NTP service: active RTC in local TZ: no
Congratulations! You have successfully changed the timezone. Thanks for using this tutorial to change the timezone on your Rocky Linux 9 system. For additional help or useful information, we recommend you check the official Rocky Linux website.