VPS Hosting blog

VPS hosting updates and technical articles

Archive for the ‘vps timezone’ tag

How to change timezone of your VPS to IST

with one comment

In this article we shall learn how to change timezone of your bareborn VPS.

It is assumed, though not necessary, that you have already installed a hosting panel like Kloxo or Virtualmin.

Changing timezone in OpenVZ

The file /etc/localtime is the one which holds information of server’s timezone.

We shall point it to the correct zone file by creating a soft link.

Run following commands:

# cd /etc

#mv localtime localtime.bak

#ln -sf /usr/share/zoneinfo/Asia/Calcutta localtime


Changing timezone in Xen

When I tried to change timezone in Xen, it chnage dtimezone but did not update time accordingly after reboot.

So, I did following:

1. Chnaged timezone using steps mentioned above for OpenVZ

2. Run following command

echo 1 > /proc/sys/xen/independent_wallclock

3. Installed ntp

# yum install ntp

4. Turned on service

# chkconfig ntpd on

5. Synchronized the system clock with 0.pool.ntp.org server:

# ntpdate pool.ntp.org

6. Started the NTP:

# /etc/init.d/ntpd start

7. Reboot the VPS


Now you will notice that after rebooting the VPS it again shows wrong time.

Actually you have to set the independent clock every time you reboot the server. To do this, put following lines in /etc/rc.local

service ntpd stop
echo 1 > /proc/sys/xen/independent_wallclock
ntpdate pool.ntp.org
service ntpd start

You would now get correct timezone and correct time every time you reboot your Xen VPS.

Written by economichosting.net

November 6th, 2011 at 11:12 pm