Published On Mar 21, 2020
Your support on Ko-Fi is much appreciated:
👉 https://ko-fi.com/csg_yt
Join our new discord channel:
👉   / discord Â
Buy CSG Merchandise:
👉 http://tee.pub/lic/csg
This video is based on RHEL 8.
Video to cover the section 'Configure time service clients' for the RHCSA (Red Hat Certified System Administrator).
More information on the required learning: http://bit.ly/rhcsa8
Notes from the video:
To show the current date and time:
date
To use date to print out the current date and time in a particular format you can use the date variable for example:
date +%d%m%y-%H%M%S
This can be used in a script to produce a new log file name everytime the script is run for example:
touch logfile-`date +%d%m%y-%H%M%S`.log
Will output a log file with the current date and time.
To get the current hardware clock time:
hwclock
To set the system clock to hardware clock:
hwclock -s
To set the hardware clock to the system clock:
hwclock -w
The main command for managing the time is timedatectl, to see the current time and timezone information:
timedatectl
To manually set the date and time:
timedatectl set-time 2020-18-03
timedatectl set-time 10:26:00
To set the timezone:
timedatectl set-timezone Australia/Melbourne
To list all available timezones:
timedatectl list-timezones
To get the timedatectl to use the Network Time Protocol (NTP):
timedatectl set-ntp yes
The NTP deamon is no longer used as of RHEL8 so we need to use chrony. To install the application run:
dnf install chronyd
Then start and enable the service:
systemctl start chronyd
systemctl enable chronyd
To edit the servers list edit the chrony.conf file and add entries starting with “server then IP address” and restart the chronyd service:
vi /etc/chrony.conf
systemctl restart chronyd
To see which servers chronyd is currently syncing with run:
chronyc sources
#rhcsa #rhel #linux #redhat