Loading

Introduction

Have you ever wondered how computers in your network seem to have the correct time? They likely synchronize their clocks to a network time server using something called Network Time Protocol, or NTP. If you’re using Rocky Linux and want your own NTP server, this guide is for you! We’ll walk you through the process step-by-step, ensuring everything is easy to understand.

What You’ll Need

  • A computer running Rocky Linux
  • Administrative access (you might be entering some commands as an admin)
  • A bit of patience and readiness to type in some Linux commands

Let’s Get Started!

Step 1: Installing Chrony

Chrony is a software that helps your server keep time accurately. It’s perfect for setting up an NTP server!

First, update your system to ensure all your software is current. Open your terminal and type:

sudo dnf update -y

Install Chrony by entering:

sudo dnf install chrony -y

Step 2: Setting Up Your Time Server

Now, let’s configure Chrony so it can start doing its job.

Open the Chrony configuration file in a text editor by typing:

sudo nano /etc/chrony.conf

Set up time sources: Find the lines that start with server and add or uncomment them. These lines tell your server where to get its time from. Here’s an example using public NTP servers:

server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst

Allow network access: Add a line to let other devices in your network ask your server for the time. Replace 192.168.0.0/16 with your network.

allow 192.168.0.0/16

Set up logs: To keep track of what’s happening, ensure logging is enabled.

log measurements statistics tracking

Step 3: Start and Manage the Chrony Service

Start Chrony and make it run automatically when your system starts:

sudo systemctl enable --now chronyd

Check if Chrony is running properly:

sudo systemctl status chronyd

Step 4: Testing Your NTP Server

Finally, let’s make sure everything is working as it should.

View time sources to see where your server is getting its time from:

chronyc sources

Track server performance:

chronyc tracking

From another device, check if it can see your new NTP server:

chronyc -h <your-server-ip> sources

Wrapping Up

That’s it! Your Rocky Linux system is now a timekeeper for your entire network. This setup should work well for most home and small office environments. If you run into any issues or need to customize settings further for a larger network, there are plenty of additional options in the Chrony documentation online. Happy timing!

Add Comment

Your email address will not be published. Required fields are marked *