Setting Up NTP (Network Time Protocol) Server in RHEL/CentOS 7


To configure an NTP (Network Time Protocol) server in RHEL/CentOS 7, adhere to these procedures. Install the NTP software initially using the package manager. Modify the "/etc/ntp.conf" file to set up the NTP server after that by adding the server's IP address and preferred time sources. Then, enable NTP traffic by opening the necessary network ports in the firewall. Set the NTP service to launch automatically when the system boots. Finally, use the "ntpdate" command or restart the NTP service to synchronize the server's time. In the RHEL/CentOS 7 environment, the NTP server is now prepared to give network clients precise time synchronization.

Methods Used

  • Install NTP Package

  • Open Network Ports

Install NTP Package

Using a package manager like yum or dnf, first install the NTP package for RHEL/CentOS 7. An NTP server should then be configured. For the package to be downloaded and installed, issue the proper command to the repository. This will guarantee that the server has the essential NTP software installed. After installation is complete, the "/etc/ntp.conf" file can be updated, and the NTP server can then be established by following the other server setup stages.

Algorithm

  • Start the technique of putting in the NTP server.

  • Open the terminal or command-line interface.

  • Use the bundle manager, which includes YUM, to put in the NTP bundle with the aid of the command "sudo yum set up ntp".

  • Wait for the bundle setup to be complete.

  • Once the setup is finished, configure the NTP server by modifying the NTP configuration document positioned at "/etc/ntp.conf".

  • Specify the desired NTP servers with a view to being used for time synchronisation. These servers may be public NTP servers or inner servers inside the network.

  • Save the adjustments made to the configuration document.

  • Start the NTP provider with the aid of the command "sudo systemctl begin ntpd".

  • Enable the NTP provider to begin mechanically at machine boot with the command "sudo systemctl permit ntpd".

  • Verify the NTP provider's fame to make certain it's strolling efficiently with the aid of using the command "sudo systemctl fame ntpd".

Open Network Ports

These procedures describe how to open network ports in RHEL/CentOS 7 in order to configure an NTP (Network Time Protocol) server. Find UDP 123, the default NTP port. Add a rule to accept inbound connections on this port using the firewall management programme, such as firewalld or iptables. Firewalld users need run "firewall-cmd --add-port=123/udp --permanent" and then refresh the firewall rules. Use "iptables -A INPUT -p udp --dport 123 -j ACCEPT" to create the rules with iptables, then save them. By allowing NTP traffic to pass through the UDP 123 port, time synchronisation with client devices on the network is made possible.

Algorithm

  • Use the package manager to set up the Apt-Cacher-NG package (such as apt-get or yum).

sudo apt-get install apt-cacher-ng
  • Change the authorised networks, cache directory, and other options in the configuration file (/etc/apt-cacher-ng/acng.conf).

sudo nano /etc/apt-cacher-ng/acng.conf
  • To effect the modifications, restart the Apt-Cacher-NG service.

sudo service apt-cacher-ng restart
  • Configure user machines to apply the Apt-Cacher-NG server after including the server's IP address to the sources.list file.

sudo nano /etc/apt/sources.list
  • Change "server_ip" to the IP address of the Apt-Cacher-NG server.

deb http://<server_ip>:3142/archive.ubuntu.com/ubuntu/ trusty main restricted
  • To begin using the cache, update the package listings on the clients.

sudo apt-get update
  • Using the Apt-Cacher-NG server's web interface (http://:3142/acng-report.html), you can opportunistically manage and monitor it.

  • Run 'apt-get update' and 'apt-get upgrade' on the server computer to ad-hoc update the Apt-Cacher-NG server.

sudo apt-get update
sudo apt-get upgrade
  • To prevent the cache from growing out of control, keep an eye on disc utilisation and clean it as needed.

sudo apt-get autoclean

Conclusion

In conclusion, installing Apt-Cacher-NG on Ubuntu 14.04 Server and configuring an Apt-Cache server offers a practical package management solution. Users can set up a reliable Apt-Cache server by following the instructions for either the manual installation and configuration technique or by utilising Docker containers. These techniques give you the freedom to alter the arrangement to suit certain needs. By using the cached packages, clients can take advantage of the Apt-Cache server's reduced bandwidth usage and quicker package installations. Implementing an Apt-Cache server in Ubuntu 14.04 Server optimises package management and greatly boosts system speed, whether you choose manual configuration or Docker containers. The ability to cache package updates is crucial for effectively managing many devices because it saves time and resources.

Updated on: 03-Aug-2023

522 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements