In this exercise, you will adjust the time zone on a server and ensure that its system clock is synchronized with an NTP time source, using Chrony.
Outcomes
Students should be able to configure the servera system to use the time zone appropriate for Haiti and configure chronyd on servera to use the NTP server running on classroom.example.com as the time source.
Log in to workstation as student using student as the password.
On workstation, run the lab core-chrony start command to verify that the environment is ready and to prepare the systems for the exercise.
[student@workstation ~]$lab core-chrony start
Your servera machine has been relocated to Haiti.
Set the appropriate time zone and verify your work.
Log in to servera then become the root user.
[student@workstation ~]$ssh servera[student@servera ~]$sudo -i[root@servera ~]#
Identify the correct time zone for Haiti.
[root@servera ~]#tzselectPlease identify a location so that time zone rules can be set correctly. Please select a continent, ocean, "coord", or "TZ". 1) Africa 2) Americas ...output omitted...#?2Please select a country whose clocks agree with yours. ...output omitted... 10) Canada 28) Haiti 46) Suriname 11) Caribbean NL 29) Honduras 47) Trinidad & Tobago ...output omitted...#?28The following information has been given: Haiti Therefore TZ='America/Port-au-Prince' will be used. Selected time is now: Fri Feb 15 01:24:44 EST 2019. Universal Time is now: Fri Feb 15 06:24:44 UTC 2019. Is the above information OK? 1) Yes 2) No#?1You can make this change permanent for yourself by appending the line TZ='America/Port-au-Prince'; export TZ to the file '.profile' in your home directory; then log out and log in again. Here is that TZ value again, this time on standard output so that you can use the /usr/bin/tzselect command in shell scripts: America/Port-au-Prince
Change the time zone to America/Port-au-Prince.
[root@servera ~]#timedatectl set-timezone America/Port-au-Prince
Retrieve the time zone set on servera to verify your work.
[root@servera ~]#timedatectlLocal time: Fri 2019-02-15 01:45:31 EST Universal time: Fri 2019-02-15 06:45:31 UTC RTC time: Fri 2019-02-15 06:47:25 Time zone:America/Port-au-Prince(EST, -0500) System clock synchronized: no NTP service: inactive RTC in local TZ: no
Enable NTP synchronization on the servera system and use classroom.example.com as the time source.
Configure chronyd to synchronize the time on servera with classroom.example.com.
Edit /etc/chrony.conf to include the following configuration file excerpt:
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html).# pool 2.rhel.pool.ntp.org iburstserver classroom.example.com iburst...output omitted...
Start and enable the chronyd service, turning on the NTP synchronization on servera.
[root@servera ~]#timedatectl set-ntp true
Confirm that the clock on servera is synchronized with classroom.example.com.
Verify the clock synchronization status.
[root@servera ~]#timedatectl...output omitted... System clock synchronized: yes ...output omitted...
Confirm that classroom.example.com is the time source for the clock synchronization on servera.
[root@servera ~]#chronyc sources -v210 Number of sources = 1 .-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state'*' = current synced, '+' = combined , '-' = not combined, | / '?' = unreachable, 'x' = time may be in error, '~' = time too variable. || .- xxxx [ yyyy ] +/- zzzz || / xxxx = adjusted offset, || Log2(Polling interval) -. | yyyy = measured offset, || \ | zzzz = estimated error. || | | MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* classroom.example.com8 6 37 51 -25ns[-703us] +/- 128us
Log off from servera.
[root@servera ~]#exit[student@servera ~]$exit[student@workstation ~]$