Skip to content

Practice Exercise 2: Exploring Time Zones

Objectives

The objective of this lab exercise is to understand how to configure and manage time zones on virtual machines and verify different timezones on virtual machines

Prerequisites

  • Access to your machine via ssh. Follow the steps in Lab Environment to access your machine.
  • Basic knowledge of Linux commands

Exercise

Step 1: Connect to your Machine

Step 2. View the Current Timezone - To view the current timezone on your machine, use the timedatectl command:

timedatectl

Step 3: Change the Timezone

  • Change the timezone to a different one. For example, to set the timezone to New York (Eastern Time), use the following command:
    sudo timedatectl set-timezone America/New_York
    

Replace America/New_York with the timezone of your choice. You can find a list of valid timezones in the /usr/share/zoneinfo/ directory.

Step 4: Verify the Timezone Change

  • Run timedatectl again to verify that the timezone has been changed.
timedatectl

Step 5: Set Another Timezone

  • Repeat the process to set a different timezone, such as Los Angeles (Pacific Time):
sudo timedatectl set-timezone America/Los_Angeles

Step 6: Verify the Second Timezone Change - Run timedatectl one more time to verify that the second timezone change has taken effect.

timedatectl

Conclusion

This lab exercise helps you understand how to set and verify timezones a fundamental skill for server management. It also demonstrates the significance of time settings in a server's configuration.