Having problems setting your OpenVZ network date and timezone? Familiar with this annoying error; “Error: date: cannot set date: Operation not permitted”? Here is a little tutorial on how to properly set the date and timezone in an openvz container. Lets keep it simple.
With openvz virtualization, using NTP is a pain since certain resources are shared between the host and the openvz container, such as the kernel. A work around for this is to update our 'localtime' file in /etc to point to the proper timezone file.
In this example, I will be updating my server timezone to Atlantic Standard Time
1.) Lets rename the current 'localtime':
2.) Create the symlink to the proper timezone file:
And that's it. Type 'date' in to validate that you are now on the right timezone. I have tested and can validate that this works on Centos 6.2 and Ubuntu 12.10 containers. I'm sure there are other ways to get around this but give it a try and let us know how you make out!



