In this guide, we’ll walk you through the step-by-step process of setting the timezone on Ubuntu to manage your Linux Virtual Private Server (VPS) effectively. Ensure you log in as a root user to perform the following actions.
Using the Graphical User Interface (GUI):
The most user-friendly way to adjust the timezone on an Ubuntu system is through the graphical user interface (GUI). This method doesn’t require command-line operations and is accessible directly from the desktop. The steps below apply to Ubuntu 18.04, Ubuntu 20.04, and Ubuntu 22.04:
- Click on the System menu at the top-right corner of the screen.
- Select Settings and navigate to the Date & Time tab.
- Turn off the Automatic Time Zone option to prevent automatic adjustments based on internet connection.
- Click on Time Zone, and a new window will open. Choose the desired timezone by clicking on the map or using the search bar.
- Close the window by clicking the ‘x’ button.
- Verify the changes by checking the Time Zone box inside the Date & Time tab.
Using timedatectl (via the Command Line):
For a more permanent solution via the command line, you can use the timedatectl command. This utility allows users to review and modify the system clock configuration. Follow these steps:
- Open your command-line interface (CLI) and check the current system timezone with the command `timedatectl`.
- Find the full name of the timezone by running `timedatectl list-timezones` or by combining it with grep for a specific city.
- Use the command `sudo timedatectl set-timezone [timezone]` to change the timezone.
- Verify the update by running `timedatectl`.
Using the tzdata Command (Older Ubuntu Versions):
For users on Ubuntu versions 16.04 or lower, the tzdata command is an alternative. This command involves reconfiguring the timezone and daylight-saving time data. Here’s how to do it:
- Run the command `sudo dpkg-reconfigure tzdata` to reconfigure the timezone.
- Choose your geographic area and city or region accordingly.
- Verify the update by checking the output, ensuring the current timezone is set correctly.