Linux TimeZones Setting

Ticker

6/recent/ticker-posts

Linux TimeZones Setting

Question :   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 America/Blanc-Sablon.

Please Note :-  Perform the below commands based on your question  server,  user name & other details might differ . So please read task carefully before executing. All the Best 👍


Solution:  

1. At first login on App server   &  Switch to  root user 

thor@jump_host ~$ ssh tony@stapp01

The authenticity of host 'stapp01 (172.16.238.10)' can't be established.

ECDSA key fingerprint is SHA256:2DbVbI7xvrQSSIOQD502dx7BHfADaJEecTxNIX/MmQs.

ECDSA key fingerprint is MD5:c6:8e:51:2e:28:dd:bd:cc:e4:b6:b5:c4:d3:dc:13:e6.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'stapp01,172.16.238.10' (ECDSA) to the list of known hosts.

tony@stapp01's password:

 [tony@stapp01 ~]$ sudo su -

 We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

     #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

 [sudo] password for tony:

[root@stapp01 ~]#

 

 2. Run Below command to  check existing Time Zone set for server

[root@stapp01 ~]# timedatectl

      Local time: Sat 2021-06-12 15:22:41 UTC

  Universal time: Sat 2021-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

[root@stapp01 ~]#

 3. Help give you syntax to set the time zone & others

[root@stapp01 ~]# timedatectl -h

timedatectl [OPTIONS...] COMMAND ...

 

Query or change system time and date settings.

 

  -h --help                Show this help message

     --version             Show package version

     --no-pager            Do not pipe output into a pager

     --no-ask-password     Do not prompt for password

  -H --host=[USER@]HOST    Operate on remote host

  -M --machine=CONTAINER   Operate on local container

     --adjust-system-clock Adjust system clock when changing local RTC mode

 

Commands:

  status                   Show current time settings

  set-time TIME            Set system time

  set-timezone ZONE        Set system time zone

  list-timezones           Show known time zones

  set-local-rtc BOOL       Control whether RTC is in local time

  set-ntp BOOL             Control whether NTP is enabled

[root@stapp01 ~]#

 

 4. Run Below command to set the time zone  & verify it 

[root@stapp01 ~]# timedatectl set-timezone America/Blanc-Sablon

 

 [root@stapp01 ~]# timedatectl

      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: America/Blanc-Sablon (AST, -0400)

     NTP enabled: n/a

NTP synchronized: yes

 RTC in local TZ: no

      DST active: n/a

[root@stapp01 ~]#


Please Note :- You have to do this in all app servers stapp01,stapp02, stapp03. I have Shown only for Stapp01 


5.  Click on Finish & Confirm to complete the task successful

Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , please go through and share your comments. Like and share the knowledge



Post a Comment

12 Comments

  1. thank you, it worked.

    ReplyDelete
    Replies
    1. Thanks for your Kind words. Glad it help to solve your task. Keep Learning

      Delete
  2. how to find the password of the root i have followed the steps but i don't know the password

    ReplyDelete
    Replies
    1. You dont need to have root password since lab configured by sudoers. You have to used the user login password to become root

      Delete
    2. https://kodekloudhub.github.io/kodekloud-engineer/docs/projects/nautilus

      Delete
  3. thank you very much.

    ReplyDelete
  4. Just WOW! You are the real brilliant! Thank you a lot!

    ReplyDelete
  5. how to know for which user and server we need to login

    ReplyDelete
    Replies
    1. In task it mentioned app1 , 2 or 3 accordingly login on the server . kindly go through Wiki to know server details. Feel free to chat online if you have any doubts

      Delete
  6. During this task, I'm facing the issue of an Unknown operation set time zone. any one help me with this?

    ReplyDelete
    Replies
    1. There was issue with the kodekloud lab which is resolved now. Please retry the task again.

      Delete

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 1 | Image Scanning using Aquasec Trivy | Secure Deployment using AppArmor Profile  | PVC to PV binding