Collapse

Announcement

Collapse
No announcement yet.

How to set time zone on linux VPS (openVZ)?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set time zone on linux VPS (openVZ)?

    I want to change the time zone, I followed all steps but changes are not being reflected. I am trying to change the time zone to Hong Kong.
    Could you please help me with this?
    Last edited by Priyanka; 04-29-2018, 02:47 PM.

  • #2
    Hi Priyanka,

    In this case, you will need to,

    1. login to your OpenVZ Node.

    2. Stop the container you wish to set the time. Replace 169 with your container ID.


    Code:
    [root@ ~]# vzctl stop 169 
    Stopping container ...
    Container was stopped
    Container is unmounted

    3. Next is to set the capability for the container to change the time zone.

    Code:
    [root@ ~]# vzctl set 169 --capability sys_time:on --save
    CT configuration saved to /etc/vz/conf/169.conf
    4. Go ahead and start the container.

    Code:
    [root@ ~]# vzctl start 169
    Starting container...
    Container is mounted
    Adding IP address(es): x.x.x.x
    Setting CPU limit: 400
    Setting CPU units: 1000
    Setting CPUs: 2
    Container start in progress...
    5. Login to the container.

    Code:
    [root@ ~]# vzctl enter 169
    entered into CT 169
    6. Check the current time using date command.

    Code:
    [root@/]# date
    Sun Apr 29 07:18:29 UTC 2018
    7. You may change the localtime to (Hong_kong) as below. This timezone may vary depending upon the time you want to set.

    Code:
    [root@/]# mv /etc/localtime /etc/localtime_bk
    [root@svr1 /]# ln -s /usr/share/zoneinfo/Asia/Hong_Kong /etc/localtime
    8. That's all !! Your open VZ container will start reflecting the correct time.

    Code:
    [root@/]# date
    Sun Apr 29 15:19:46 HKT 2018

    Comment


    • #3
      In addition to my earlier reply, you can type the below command which contains current time and date you want on set on the VPS.

      date --set="2018-07-16 12:17 pm"

      Comment

      Working...
      X