Time / Timezone in Linux

From vpsget wiki
Revision as of 15:20, 26 November 2013 by Ndi (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Before set timezone you should delete the current settings if they exists: Create backup

cp /etc/localtime /etc/localtime.bcp 

Delete current settings

rm /etc/localtime

Set new Timzone, for example:

ln -s /usr/share/zoneinfo/CET  /etc/localtime

Check Date/Time:

date

If you see that date/time is incorrect you should sync it using ntpd service. Sure you can set it manually. If ntpd service not installed install it using yum or apt-get. NOTE that you can't use ntpd from ovz container.In general you can only change timzone from ovz container

Start ntdp:

service ntpd start

force sync:

ntpdate pool.ntp.org

Also you can configure ntpd servers in /etc/ntp.conf. for example add next line to conf:

server pool.ntp.org

Here is examples how to set time/date manually:

date --set="23 Nov 2013 11:00:00"
date --set="11:00:00"