When you get a VPS outside your own territory the time-zone is unlikely correct. Not only that, sometimes the VPS clock is just wrong: it can be 10 to 20 minutes faster or slower. You are happy after correcting it, not not too long as the clock will be wrong again after a reboot. This guide is for CentoOS 5.x
Here is a solution: submit a ticket to your provider:-)
I don’t want to bother those busy guys (almost always men) unless there is no other way. So if you are like me, follow those steps:
Step 1: Edit /etc/sysctl.conf and add this line (if you are using Xen):
Step 2: Save the file and exit and then run at the command line
Step 3: Set up your local time. Go to the /usr/share/zoneinfo/ (easier on SFTP) and find your correct time zone file. Remember the location and file name (writing it in notepad or on paper). For example, mine is:
Then run the following code at the command line (Replacing /usr/share/zoneinfo/Asia/Shanghai with yours)
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
yum install -y ntp
Bingo! The time is correct, finally! But don’t be happy too early. You will still need to do one last step.
Step 4: Edit file /etc/rc.local and add the following line:
In this way, your VPS will sync time automatically with us.pool.ntp.org server, not local BIOS.
Leave a Reply
You must be logged in to post a comment.