How to set/change time zone on AlmaLinux

The objective of this guide is to show how to set the system time zone on AlmaLinux. This can be done from both GUI and command line, so we’ll be covering both methods in the following instructions.

Setting your system time and time zone is usually done when initially installing AlmaLinux or migrating from CentOS to AlmaLinux. If you skipped that step during installation, have switched time zones, or your system clock has drifted out of sync, we’ll help you get it fixed.

In this tutorial you will learn:

  • How to set time zone on AlmaLinux from GNOME GUI
  • How to set time zone on AlmaLinux from command line
Changing the time zone via command line and GUI on AlmaLinux

Changing the time zone via command line and GUI on AlmaLinux

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System AlmaLinux
Software N/A
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Set time zone via GUI



We’ll assume that you have the GNOME GUI installed on AlmaLinux, which is the default GUI. If you’re using some other desktop environment, the screenshots below are going to look a little different. However, the steps should be very similar.

  1. Start by opening the activities menu and searching for “time”. Click the Date and Time settings menu that shows up.
  2. Open the date and time settings from activities menu

    Open the date and time settings from activities menu

  3. When the Date and Time settings menu opens up, we’ll need to unlock it with our root password before we can make any changes. Click the unlock button and specify your password.
  4. Unlock the settings with the root password

    Unlock the settings with the root password



  5. Now we are able to select from automatic time zone and date settings or we can manually set our time zone. To do so, click on the time zone option near the bottom. Then, search for a major city near your location that shares the same time zone as you.
  6. Search for a nearby major city that shares the same time zone

    Search for a nearby major city that shares the same time zone

  7. Your system clock should now be synchronized to the time zone you selected. You don’t need to fiddle with setting the time and date manually, as AlmaLinux will query online time servers to determine the correct date and time for your configured time zone. But, if you’d like to specify a date manually, you can turn off automatic date and time settings. Then, the option to change your date and time manually is no longer grayed out. Click it to make the desired changes.
  8. Change the date and time manually from GNOME

    Change the date and time manually from GNOME



That’s all there is to it. You can close the Date and Time settings menu after you’re satisfied with the changes.

Set time zone via command line

In most cases, you’ll probably just want to configure your time zone, and we’ll show you how below. But we will also cover the instructions for manually setting your system clock, in case you have a circumstance that requires you to set a different date or time than official time servers.

  1. Open a terminal and type the following command to see what time zone your system is currently configured for.
    $ timedatectl
                   Local time: Fri 2021-01-08 04:33:12 EST  
               Universal time: Fri 2021-01-08 09:33:12 UTC  
                     RTC time: Fri 2021-01-08 09:33:11      
                    Time zone: America/New_York (EST, -0500)
    System clock synchronized: no                           
                  NTP service: n/a                          
              RTC in local TZ: no
    
  2. List available time zones with the following command. Pick one relevant to your location, and we’ll configure your system to that time zone in the next step.
    $ timedatectl list-timezones
    

    Use the grep command to narrow down the search. In the example below this command will produce a list of all available time zones in Australia:

    $ timedatectl list-timezones | grep Australia
    Australia/Adelaide
    Australia/Brisbane
    Australia/Broken_Hill
    Australia/Currie
    Australia/Darwin
    Australia/Eucla
    Australia/Hobart
    Australia/Lindeman
    Australia/Lord_Howe
    Australia/Melbourne
    Australia/Perth
    Australia/Sydney
    


  3. Once you’ve picked the correct time zone from the list, use the following syntax to set your system’s time zone.
    $ sudo timedatectl set-timezone Australia/Sydney
    
  4. Confirm that the changes have been made with the timedatectl command.
    $ timedatectl
                   Local time: Sat 2021-01-09 14:15:11 AEDT  
               Universal time: Sat 2021-01-09 03:15:11 UTC   
                     RTC time: Fri 2021-01-08 09:46:05       
                    Time zone: Australia/Sydney (AEDT, +1100)
    System clock synchronized: no                            
                  NTP service: n/a                           
              RTC in local TZ: no
    
  5. To turn time synchronization on or off, use the respective command below.
    $ sudo timedatectl set-ntp on
    OR
    $ sudo timedatectl set-ntp off
    
  6. If you’d like to set the system clock to some arbitrary date and time, ensure that time synchronization is off (as we’ve shown above) and use the following date command. This command will set the date and time to 10 January 2021, 12:00 PM, but substitute any values you want.
    $ sudo date -s "10 JAN 2021 12:00:00"
    

Closing Thoughts

In this guide, we saw how to set the system time zone via GUI and command line on AlmaLinux. Not only can you synchronize your clock to any of the world’s time zones, but Linux also allows us to set arbitrary values if we want.