ntp.conf
Installation and Configuration Steps
Follow these steps to install, configure, and verify the NTP service on your Ubuntu 24.04 system.
Install the NTP Service: Start by updating your package lists to ensure you have the latest version of the repositories.
$ sudo apt update
Then, install the NTP package using the following command:
$ sudo apt install ntp
This command installs the NTP service on your Ubuntu system, making it ready for configuration.
Configure NTP Servers: Configuring your NTP servers is a critical step. Open the NTP configuration file in a text editor of your choice. Here, nano is used for simplicity.
$ sudo nano /etc/ntp.conf
In the configuration file, add or modify the server lines to specify your preferred NTP servers. For example:
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org
These servers are part of the Ubuntu pool, but you can choose other public NTP servers closer to your geographic location.
Restart NTP Service: After configuring your servers, restart the NTP service to apply the changes.
$ sudo systemctl restart ntp
This command ensures that the NTP service starts using the new configuration.
Check NTP Service Status: To confirm that NTP is functioning correctly, use the systemctl command.
$ sudo systemctl status ntp
留言
張貼留言