Change VPS Time Zone

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.

Code:

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.

Code:

root@Server [~]#cp -p /etc/localtime /etc/localtime-back

Or

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.

Code:

root@Server [~]#ln -s /usr/share/zoneinfo/America/Los_Angeles /etc/localtime

Verify the changes done by “date” command.Code:

root@Server [~]#date

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.

Error:-

# date 031612482009

date: cannot set date: Operation not permitted

Fix:-

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

# date

Advertisements
  1. #1 by managed cloud hosting on May 22, 2014 - 9:41 AM

    Magnificent put up, very informative. I ponder why the other specialists of this sector do not realize this. You should continue your writing. I’m confident, you’ve a huge readers’ base already!|What’s Going down i’m new to this, I stumbled upon this I have found It positively useful and it has aided me out loads. I am hoping to contribute & help different users like its helped me. Good job.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: