How will you change server time?
On Linux Server::
1. Login as a Root.
2. The time zones are located on server in the directory /usr/share/zoneinfo, so change the directory to that one.
root@Server [~]# cd /usr/share/zoneinfo
3. Copy or move the current local time zone so that you will be able to set the time zone as per requirement.
root@Server [~]#cp -p /etc/localtime /etc/localtime-back
root@Server [~]#mv /etc/localtime /etc/localtime-back
4. Now say for example, if you want to set the BST [British Summer Time] time zone for your server then, you will need to create a symbolic link for the same. The command is as follows.
root@Server [~]#ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime
Verify the changes done by “date” command.Code:
Mon Oct 20 04:51:57 BST 2008
If you get the below error while trying to change the time, you need to allow permission to the VPS to change time in the main node.
# date 031612482009
date: cannot set date: Operation not permitted
To correct this problem, exit from the container (#exit) and issue the following commands.
Login to the main node
# vzctl stop
# vzctl set –save –capability sys_time:on
# vzctl start
Where <veid> is your Virtual Environment ID. Next, log back into your virtual environment and issue the following commands to set the appropriate time-zone for the Virtual Environment (VE).
# vzctl enter
# mv /etc/localtime /etc/localtime.old
# ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime