It is assumed, though not necessary, that you have already installed a hosting panel like Kloxo or Virtualmin.
Changing the timezone in OpenVZ
The file /etc/localtime is the one that holds information on the server’s timezone.
We shall point it to the correct zone file by creating a soft link.
Run the following commands:
# cd /etc # mv localtime localtime.bak # ln -sf /usr/share/zoneinfo/Asia/Calcutta localtime # reboot
Changing timezone in Xen
1. Change the timezone using the steps mentioned above for OpenVZ
2. Run the 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
# reboot
Now you will notice that after rebooting the VPS it again shows the wrong time.
Actually, you have to set the independent clock every time you reboot the server. To do this, put the 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 the correct timezone and correct time every time you reboot your Xen VPS.
Setting Time Zone in a cPanel installed server
1. Open a web browser and connect to your cPanel Control Panel located at https://ip_address:2087.
2. log in as the root using the information sent to you in your setup email.
3. From the Server Configuration menu, click Server Time.
4. Select your time zone from the drop-down list.
5. Click Change TimeZone.
6. Click Sync Time with Time Server to sync the time with the time zone.