Linux change timezone and force ntpd synchronization

This short article shows how to change the timezone of the Linux distribution as well as forcing the synchronisation of date/time with the ntpd servers

This applies specifically applies to CentOS so some changes might be possible depending on the distribution
1.Change timezone
cp /etc/localtime /root/old.timezone
rm /etc/localtime
ln –s /usr/share/zoneinfo/Europe/Zurich /etc/localtime
2.Add ntpd servers to you configuration file (optional)

Edit (or create) the /etc/ntpd.conf and add the appropriate ntpd servers :

server xxx.xxx.xxx.xxx
server xxx.xxx.xxx.xxx
note: xxx.xxx.xxx.xxx is the ip or domain name of the server
3.Stop the ntpd daemon

/etc/init.d/ntpd stop

4.Force the date update

Force the update of the date with the new timezone and eventually the ntpd servers


ntpdate xxx.xxx.xxx.xxx

5.Stop the ntpd daemon

/etc/init.d/ntpd start

6.Stop the ntpd daemon

date

Popular posts from this blog

Multi-hop ssh tunnel - howto : Creating a SSH tunnel with port forwarding between multiple hosts

Spring boot and spring data jpa tutorial - A sample application using spring 4.0 spring boot and JPA (part 2/2)

Scala : easily load an parse configuration files