Thursday, 12 December 2013

VPS Shows the Wrong Time [Xen]

The VPS system clock is synced with the dom0 (host) clock unless an independent “wall” clock is specified. This is done by performing the following:

echo 1 > /proc/sys/xen/independent_wallclock
 
To make this change persist on boot, edit /etc/sysctl.conf and add the following on a new blank line:

xen.independent_wallclock = 1
 
Then you may set the time as you desire, or sync it with an NTP server, e.g.:

ntpdate ntp1.ndchost.com
 
Syncing your time via NTP is considered good practice to ensure proper server functionality. By default the ntpdate command is not installed, so you will need to add it. The process dependson your distro. For CentOS/RedHat/Fedora Core:

yum -y install ntp
For Ubuntu/Debian:

apt-get install ntp
For cPanel servers:
Log into the WHM and go to Main » Server Configuration » Server Time and select Sync with Time Server.

===========================================================

 

Procedure: Setup NTPD on CentOS Linux

Open the terminal or login over the ssh session. You must login as as the root user. Type the following yum command to install ntp
# yum install ntp ntpdate ntp-doc

Turn on service, enter:
# chkconfig ntpd on

Synchronize the system clock with 0.pool.ntp.org server (use this command only once or as required):
# ntpdate pool.ntp.org

Start the NTP server. The following will continuously adjusts system time from upstream NTP server. No need to run ntpdate:
# /etc/init.d/ntpd start

Configure ntpd (optional)

Edit /etc/ntp.conf, enter:
# vi /etc/ntp.conf

Set public servers from the pool.ntp.org project:
server 0.rhel.pool.ntp.org
server 1.rhel.pool.ntp.org
server 2.rhel.pool.ntp.org

No comments:

Post a Comment