Setting timezone and synchronizing time with NTP (CentOS/RHEL)

Hello,

first of all i explain how you can set your timezone through the terminal. This is quite easy:

check the available timezones on your machine with:
# ls /usr/share/zoneinfo

and copy them over to /etc/localtime (e.g. Europe/Luxembourg)
# cp /usr/share/zoneinfo/Europe/Luxembourg /etc/localtime

done.

Next step is the syncing with an ntp server. First check is ntp is installed on your system with
# which ntp

if it's not installed you get nothing in return. so install it with:
# yum install ntp

the config file which is used for the ntp is /etc/ntp.conf. There you can configure the time servers you want to use. For a list of servers visit www.ntp.org or go here. Here is an example for Luxembourg time servers, remove the old ones and insert the following lines instead:

server 2.lu.pool.ntp.org
server 3.europe.pool.ntp.org
server 0.europe.pool.ntp.org

Note:
Inside the ntp.conf you find 2 lines starting with "server … # local time" and "fudge". Comment out these lines as they can prevent proper syncing.

Now start the ntp daemon and set it up at boot time:
# /etc/init.d/ntp start
# chkconfig ntp on

Hope this helps someone out there!