How To Install systemd-timesyncd on CentOS 8

systemd-timesyncd is System daemon to synchronize local system clock with NTP server

Introduction

In this tutorial we learn how to install systemd-timesyncd on CentOS 8.

What is systemd-timesyncd

systemd-timesyncd is a system service to synchronize the local system clock with a remote Network Time Protocol server. It specifically implements only SNTP; this minimalistic service will set the system clock for large offsets or slowly adjust it for smaller deltas.

We can use yum or dnf to install systemd-timesyncd on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install systemd-timesyncd.

Install systemd-timesyncd on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install systemd-timesyncd using dnf by running the following command:

sudo dnf -y install systemd-timesyncd

Install systemd-timesyncd on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install systemd-timesyncd using yum by running the following command:

sudo yum -y install systemd-timesyncd

How To Uninstall systemd-timesyncd on CentOS 8

To uninstall only the systemd-timesyncd package we can use the following command:

sudo dnf remove systemd-timesyncd

systemd-timesyncd Package Contents on CentOS 8

/etc/systemd/timesyncd.conf
/usr/lib/.build-id
/usr/lib/.build-id/4e
/usr/lib/.build-id/4e/44b684771c054b3b4955ee129a04e93f59994a
/usr/lib/.build-id/83
/usr/lib/.build-id/83/0dc86f33dcbe41121a8571e267e3642dd67e9a
/usr/lib/systemd/ntp-units.d
/usr/lib/systemd/ntp-units.d/80-systemd-timesync.list
/usr/lib/systemd/system/systemd-time-wait-sync.service
/usr/lib/systemd/system/systemd-timesyncd.service
/usr/lib/systemd/system/systemd-tmpfiles-clean.service.d
/usr/lib/systemd/system/systemd-tmpfiles-clean.service.d/10-time-set.conf
/usr/lib/systemd/system/time-set.target
/usr/lib/systemd/system/time-sync.target.d
/usr/lib/systemd/system/time-sync.target.d/10-time-set.conf
/usr/lib/systemd/systemd-time-wait-sync
/usr/lib/systemd/systemd-timesyncd
/usr/share/dbus-1/system-services/org.freedesktop.timesync1.service
/usr/share/dbus-1/system.d/org.freedesktop.timesync1.conf
/usr/share/licenses/systemd-timesyncd
/usr/share/licenses/systemd-timesyncd/LICENSE.LGPL2.1
/usr/share/man/man5/timesyncd.conf.5.gz
/usr/share/man/man5/timesyncd.conf.d.5.gz
/usr/share/man/man8/systemd-time-wait-sync.8.gz
/usr/share/man/man8/systemd-time-wait-sync.service.8.gz
/usr/share/man/man8/systemd-timesyncd.8.gz
/usr/share/man/man8/systemd-timesyncd.service.8.gz
/var/lib/systemd/timesync
/var/lib/systemd/timesync/clock

References

Summary

In this tutorial we learn how to install systemd-timesyncd on CentOS 8 using yum and dnf.