User Tools

Site Tools


linux:sysadmin:time

Time & Date

Show server date & time

After setting the timezone the command “date” should show the correct time and timezone.

Example for BST:

date
Tue May 13 09:50:58 BST 2008

Set the correct timezone

Choose the right timezone from the /usr/share/zoneinfo directory and link it to /etc/localtime.

An example for the BST timezone:

ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime

A easier way is to use the configuration tool which has an ncurses interface, let's you choose the timezone and updates it for you.

system-config-date

NTP

See also article at RedHat Knowledge Base.

Install the time server

yum install ntp
service ntpd start
chkconfig ntpd on

Add the NTP servers to the configuration

Add your name servers in /etc/ntp.conf (example):

# time servers from the NTP Pool Project http://www.pool.ntp.org
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org

Manually sync time with ntpd

Manually sync after installing with ntpd or ntpdate:

ntpd -q -g
ntpdate -v -b 0.ch.pool.ntp.org
/srv/wiki.niwos.com/data/pages/linux/sysadmin/time.txt · Last modified: 2010/06/25 09:08 (external edit)