How to change the remote server(linux) timezone?

Juhan Kim·2023년 12월 22일
0
post-thumbnail

If you are building a linux server and wants to set the different server timezone, how can you do that?

I will use WSL

The /etc/localtime is symbolic link and it points directly where the server timezone is. If the server is WSL, WSL doesn't maintain its own separate clock; instead, it relies on the Windows system clock. WSL can be configured to synchronize its clock with the Windows system clock. This synchronization usually happens automatically during the WSL startup process.

However, If your WSL instance seems to have an incorrect time, you can manually synchronize it using the hwclock command. You don't have to care about the timezone because it will be already localized. However, I've found that the wsl server time synchronization often goes out of order, so if you found that the server time unsynchronization happens, then you have to enter this command.

sudo hwclock -s

But, if you are trying to set the time as different timezone, then you should go right below.

Server == Remote Server(linux)

I made an AWS ec2 instance server and I connected to it by putty. If you want to set the time to different timezone, then enter this command.

sudo ln -sf /usr/share/zoneinfo/Asia/Seoul /etc/localtime

You can see the detail information by using 'timedatectl' keyword.

Also, you can change the server timezone working as the same as changing the path directly.

sudo timedatectl set-timezone Asia/Seoul
profile
지식에 대한 열망이 있는 사람

0개의 댓글