Change timezone

De Wiki-Tel&Go
Sauter à la navigation Sauter à la recherche
# mv /etc/localtime /etc/localtime.backup
# ln -s /usr/share/zoneinfo/Europe/Brussels /etc/localtime

You need to substitute the lines in bold with your actual current timezone. That will change the timezone in the current session and should prevail upon reboots. To be absolutely certain, edit the file /etc/sysconfig/clock as well. That’s the file that will be read on boot the determine the timezone.

# cat /etc/sysconfig/clock
ZONE="Europe/Brussels"
UTC=true
ARC=false

To start with, update the time manually  by calling the ntp daemon, then start the service so it updates automatically.

# ntpdate be.pool.ntp.org
8 Nov 16:58:12 ntpdate[3635]: step time server 193.110.251.51 offset 1.045684 sec
# /etc/init.d/ntpd start
Starting ntpd:                                             [  OK  ]

If you receive the following error when running ntpdate:

# ntpdate be.pool.ntp.org
8 Nov 16:58:05 ntpdate[3547]: the NTP socket is in use, exiting

Source : https://ma.ttias.be/changing-the-time-and-timezone-settings-on-centos-or-rhel/