Casbay Knowledge Base

Search our articles or browse by category below

2 Simple Methods Of Configuring Timezone In Linux VPS Server

Last updated: September 7, 2022
Estimated reading time: 2 min

Virtual Private Server (VPS) configuration can either be really complex or at times be really simple such as the changing timezone. As simple it may be, it is vital to have the correct timezone set such as having proper logging in any IT transactional system. The three factors that will be affected by having an improper timezone in a Linux VPS server are loggings, automation and, cron jobs.

Setting the timezone improperly will affect the time of your application deployment. Aside from that, if it uses a NTP, it could be worse by having similar problems in various nodes of the network. There are multiple ways of changing the timezone, including using tools to automate it. In this article, the 2 methods we will be using to change the timezones are tzselect and timedatectl. The Linux distribution used in this guide is based on the Ubuntu operating system.

tzselect

The tzselect command is available to all Debian-based distributions such as Ubuntu, Linux Mint, and Elementary OS. This command allows the change of timezone using a command-line interface. Firstly, access your VPS via SSH. Open your terminal by searching it through the application menu or by right-clicking the desktop and selecting the “Open Terminal” option, then run the following command in the terminal.

sudo tzselect

After running the command, a list of geographical areas will be shown in the output. Select any region of your needs and you should be able to see the list of timezones available in the selected region. Enter the index number of the region and timezone that you need and you should be done setting your timezone. After setting the timezone, it is safer to verify at least once if the timezone is similar to the one you had set using the following command.

timedatectl

With this, you have successfully changed your timezone with tzselect command.

timedatectl

Moving on to the next method of changing timezone using timedatectl command. This is a more detailed version of changing timezone compared to the method earlier. Firstly, similarly to tzselect, look for the available timezones. You are able to list the timezones using the following command.

timedatectl list-timezones

A long list of timezones available will appear and it may be hard for the user to pick a proper one, press Ctrl+C to exit the display. To filter out the long list, use the grep command along with the command above to filter the name of the city in which timezone you need, such as the following command.

timedatectl list-timezones | grep <city_name>

Replace the “<city_name>” with the city which timezone you need the most to filter the long list. After learning which timezone you needed. use the following command to set the timezone on your system.

sudo timedatectl set-timezone <timezone>

Replace the “<timezone>” with the timezone you had selected and run the command. The system’s timezone should be set with this. To verify if it had already been set, use the following command.

timedatectl

You should be able to change the timezone of your system.

Was this article helpful?
Dislike 0
Previous: Disable Enhanced Security Configuration for Internet Explorer in Windows Server 2019/2016
Next: Maldet (LMD) commands and examples.
Discover the perfect balance of performance and budget-friendly Dedicated Server plan !
Discover the perfect balance of performance and budget-friendly Dedicated Server plan !
High performance and low cost Dedicated Server plan 128GB from $185 – upgrade today!
High performance and cheap Dedicated Server plan 128GB from $185 – upgrade today!