How to Change the Timezone in AlmaLinux 8 and AlmaLinux 9: A Step-by-Step Guide

Category : Linux/ Unix

change-timezone-in-almalinux-8-9

AlmaLinux is a free and open source Linux distribution that provides a stable and secure platform for servers and workstations. It is a community-driven project that aims to fill the gap left by the discontinuation of CentOS. AlmaLinux 8 and 9 are based on Red Hat Enterprise Linux (RHEL) 8 and 9 respectively, ensuring binary compatibility with RHEL and offering a smooth migration path for CentOS users. One important aspect of managing your AlmaLinux system is configuring the correct timezone. In this guide, we will walk you through the process of changing the timezone on AlmaLinux 8 and 9 using the timedatectl command.

Check the Current TimeZone

Before making any changes, it’s a good practice to check the current timezone settings on your AlmaLinux system. You can do this by running the timedatectl command without any arguments:

timedatectl

The output will display detailed information about the current date, time, and timezone configuration. Look for the “Time zone” field to see the currently set timezone.

For example:

Time zone: UTC (UTC, +0000)

List Available TimeZones

To see a list of all available timezones in AlmaLinux, use the timedatectl command with the list-timezones option:

timedatectl list-timezones

This will display an extensive list of timezones in a formatted manner. You can scroll through the list to find the desired timezone. In our case, we are looking for “Asia/Calcutta”.

Change the TimeZone

Once you have identified the timezone from the list, you can set it using the timedatectl set-timezone command followed by the timezone name(In our case Asia/Calcutta):

sudo timedatectl set-timezone Asia/Calcutta

Note that you need to have superuser privileges to change the system timezone, so make sure to use sudo or run the command as the root user.

After executing the command, you can verify that the changes have been applied by running timedatectl again:

timedatectl

The output should now show the updated timezone information:

Time zone: Asia/Calcutta (IST, +0530)

Congratulations! You have successfully changed the timezone on your AlmaLinux 8 or 9 system.

Additional Configuration Options

The timedatectl command provides several other configuration options that you may find useful. Here are a few examples:

Setting the Hardware Clock

By default, AlmaLinux maintains the hardware clock (RTC) in UTC. If you want to change it to maintain the RTC in local time instead, you can use the set-local-rtc option:

sudo timedatectl set-local-rtc true

Enabling NTP Synchronization

Network Time Protocol (NTP) allows your system to synchronize its clock with a remote time server. To enable NTP synchronization, use the set-ntp option:

sudo timedatectl set-ntp true

Conclusion

In this guide, we have learned how to change the timezone on AlmaLinux 8 and 9 using the timedatectl command. By following the step-by-step instructions, you can easily configure the timezone settings to ensure accurate timekeeping on your system.

Remember to always double-check the timezone settings after making any changes to avoid potential issues with time-sensitive applications or scheduled tasks.

AlmaLinux provides a stable and reliable platform for your server and workstation needs. With its commitment to open source and community-driven development, AlmaLinux ensures a smooth transition from CentOS and offers long-term support for your critical workloads.