In this article, I will show you how to change the Linux timezones setting.
Linux TimeZones Setting Kodekloud Engineer Task Details:
During the daily standup, it was pointed out that the timezone across Nautilus Application Servers
in Stratos Datacenter
doesn’t match with that of the local datacenter’s timezone, which is Africa/Abidjan
.
Important Note:- Perform the below commands based on your question. The server, user name & other details might differ. So please read the task carefully before executing it.
Solution for Linux TimeZones Setting:
Step 1: To start with, login to App server 1.
$ ssh tony@stapp01
Enter the password provided to you using the documentation for authentication.
Step 2: Run the below command to check the existing Time Zone set for the app server.
$ timedatectl
Result:
Local time: Sat 2022-06-12 15:22:41 UTC
Universal time: Sat 2022-06-12 15:22:41 UTC
RTC time: n/a
Time zone: UTC (UTC, +0000)
NTP enabled: n/a
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
Here the time zone is set as “Time zone: UTC (UTC, +0000) “
Step 3: Run the below command to select the time zone. Make sure you enter the timezone provided in your question.
$ sudo timedatectl set-timezone Africa/Abidjan
Enter the password of the user if it asks you to authenticate again.
Step 4: Verify again if the timezone is changed or not.
$ timedatectl
Result:
Local time: Sat 2021-06-12 11:25:38 AST
Universal time: Sat 2021-06-12 15:25:38 UTC
RTC time: n/a
Time zone: Africa/Abidjan
NTP enabled: n/a
NTP synchronized: yes
RTC in local TZ: no
DST active: n/a
Important: You have to do this in all app servers stapp01, stapp02, stapp03. Here I have done it only on app server 1. Follow the same steps in all other app servers.
After setting the timezone for all 3 app servers click on submit and finish the task.
Happy Learning!
Also, check out the post : Create a Linux User with non-interactive shell.