AlmaLinuxRHEL Based

How To Set Date and Time on AlmaLinux 9

Set Date and Time on AlmaLinux 9

In this tutorial, we will show you how to set date and time on AlmaLinux 9. AlmaLinux 9, a free and open-source Linux distribution, has gained popularity among server administrators for its stability, security, and compatibility with Red Hat Enterprise Linux (RHEL). Maintaining accurate date and time settings is crucial for the smooth operation of various system components and applications running on AlmaLinux 9 servers.

In this comprehensive guide, we will explore the importance of setting the correct date and time, provide step-by-step instructions for configuring these settings using both the command line interface (CLI) and graphical user interface (GUI), and offer troubleshooting tips to ensure your AlmaLinux 9 server stays in sync with the correct time.

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 change the date and time settings on an AlmaLinux 9 server, you need to have administrative privileges. Ensure that you are logged in as the root user or have sudo access to execute the necessary commands with elevated permissions. Without proper authorization, you will not be able to modify the system’s date and time settings.

Set Date and Time on AlmaLinux 9

Using the Command Line Interface (CLI)

To check the current date and time settings on your AlmaLinux 9 server, open the terminal and run the following command:

date

This command will display the current date and time in the format: “Day Month Date HH:MM:SS TimeZone Year”. For example:

Thu May 20 10:30:00 UTC 2024

Understanding the current settings will help you determine if any adjustments are necessary.

  • Setting Date and Time Manually

To manually set the date and time on your AlmaLinux 9 server, use the date command with the –set option followed by the desired date and time in the format “YYYY-MM-DD HH:MM:SS”. For example, to set the date and time to May 21, 2024, at 11:00 AM, run the following command:

sudo date --set="2024-08-12 11:00:00"

After executing the command, the system’s date and time will be updated accordingly.

  • Synchronizing with NTP (Network Time Protocol)

NTP is a widely used protocol for automatically synchronizing the server’s time with a reliable time source over the network. To enable NTP synchronization on AlmaLinux 9, use the following command:

sudo timedatectl set-ntp true

This command will enable the NTP service, which will periodically synchronize the server’s time with the configured NTP servers. By default, AlmaLinux 9 uses the chrony service for NTP synchronization.

Using the Graphical User Interface (GUI)

  • Accessing Date and Time Settings

If you prefer using the graphical user interface to set the date and time on AlmaLinux 9, follow these steps:

  1. Click on the “Activities” button in the top-left corner of the screen.
  2. Type “Settings” in the search bar and click on the “Settings” icon.
  3. In the Settings window, click on “Date & Time” in the left sidebar.

The Date & Time settings panel will open, allowing you to configure the date, time, and time zone.

  • Manual Configuration

To manually set the date and time using the GUI:

  1. In the Date & Time settings panel, toggle off the “Automatic Date & Time” option.
  2. Click on the “Date” field and select the desired date from the calendar popup.
  3. Click on the “Time” field and adjust the time using the up and down arrows or by typing the desired time.
  4. Click “Apply” to save the changes.

The system’s date and time will be updated based on your manual configuration.

  • Enabling Automatic Synchronization

To enable automatic time synchronization using NTP in the GUI:

  1. In the Date & Time settings panel, toggle on the “Automatic Date & Time” option.
  2. Ensure that the “Network Time” option is selected.
  3. Click “Apply” to save the changes.

AlmaLinux 9 will now automatically synchronize the date and time with the configured NTP servers.

Configuring Time Zones

  • Checking Current Time Zone

To check the current time zone setting on your AlmaLinux 9 server, use the timedatectl command without any arguments:

timedatectl

The output will display various time-related information, including the current time zone. For example:

Time zone: UTC (UTC, +0000)
  • Setting the Correct Time Zone

To set the correct time zone on your AlmaLinux 9 server, use the timedatectl set-timezone command followed by the desired time zone in the format “Region/City”. For example, to set the time zone to New York, run the following command:

sudo timedatectl set-timezone America/New_York

Replace “America/New_York” with the appropriate time zone for your location. You can find a list of available time zones by running the command timedatectl list-timezones.

Congratulations! You have successfully set a date and time. Thanks for using this tutorial to set a date and time on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official AlmaLinux website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button