How To Change TimeZone on AlmaLinux 9
In this tutorial, we will show you how to change TimeZone on AlmaLinux 9. AlmaLinux 9, a stable and reliable Linux distribution, offers users the flexibility to customize their system settings, including the timezone. Setting the correct timezone is crucial for maintaining accurate system logs, scheduling tasks, and ensuring the proper functioning of time-sensitive applications.
Before diving into the process of changing the timezone, it’s essential to understand how AlmaLinux 9 manages timezone configuration. The system stores the timezone information in the /etc/localtime
file, which is a symbolic link pointing to the actual timezone file located in the /usr/share/zoneinfo
directory. This symbolic link determines the current timezone setting for your AlmaLinux 9 system.
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 to change TimeZone on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux or RHEL-based.
Prerequisites
- A server running one of the following operating systems: AlmaLinux 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).
- You’ll need an internet connection to download the necessary packages and dependencies.
- You’ll need root or sudo privileges to change TimeZone and make system-wide changes. Make sure you have the necessary permissions before starting the installation process.
Change TimeZone on AlmaLinux 9
Step 1. Checking the Current TimeZone
To begin, let’s check the current timezone setting on your AlmaLinux 9 system. Open the terminal and execute the following command:
timedatectl
The output will display detailed information about the current date, time, and timezone configuration. Look for the “Time zone” line, which indicates the currently set timezone. For example:
Time zone: Europe/Amsterdam (CEST, +0200)
This output shows that the system is currently set to the Europe/Amsterdam timezone.
Step 2. Listing Available TimeZones.
AlmaLinux 9 provides a wide range of time zones to choose from. To view the list of available timezones, use the timedatectl
command with the list-timezones
option:
timedatectl list-timezones
This command will display an extensive list of time zones, organized by continent and city. Some examples include:
-
- Africa/Abidjan
- Africa/Accra
- Africa/Addis_Ababa
- Africa/Algiers
- Africa/Asmara
- …
- Europe/Amsterdam
- Europe/Andorra
- Europe/Astrakhan
- …
- US/Alaska
- US/Aleutian
- US/Arizona
- …
Browse through the list to find the timezone that matches your location.
Step 3. Changing the TimeZone.
Once you have identified the desired timezone, you can change the system’s timezone using the timedatectl set-timezone
command followed by the timezone name. For example, to set the timezone to “Africa/Malabo”, execute the following command:
sudo timedatectl set-timezone Africa/Malabo
Note that you need to have superuser privileges (using sudo) to modify the system’s timezone setting.
To verify that the timezone change has taken effect, run the timedatectl
command again:
timedatectl
The output should now reflect the updated timezone:
Time zone: Africa/Malabo (WAT, +0100)
Step 4. Troubleshooting Common Issues
- Timezone Changes Not Persisting After Reboot
In some cases, you may notice that the timezone changes do not persist after a system reboot. This issue can occur if the hardware clock (RTC) is set to UTC time instead of the local timezone. To resolve this, you can configure the RTC to use the local timezone by executing the following command:
sudo timedatectl set-local-rtc 1
This command sets the RTC to the local timezone, ensuring that the timezone changes remain in effect even after a reboot.
- System Clock Drift
Over time, the system clock may drift away from the actual time due to hardware limitations or other factors. To mitigate this issue, you can enable Network Time Protocol (NTP) synchronization, which automatically adjusts the system clock based on time servers on the internet. To enable NTP synchronization, use the following command:
sudo timedatectl set-ntp true
AlmaLinux 9 will now periodically synchronize the system clock with NTP servers, maintaining accurate timekeeping.
Congratulations! You have successfully changed the Timezone. Thanks for using this tutorial to change the Timezone on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official AlmaLinux website.