Install – configure NTP and set the timezone on CentOs 5.x January 14, 2011Posted by Tournas Dimitrios in Linux.
This is just a brief howto about installing and configuring NTPD (Network Time Protocol Daemon) on a Linux server . First we will install ntpd, then update the current time on the server, configure ntpd to restart on server boot, and then start ntpd .Last but not least the timezone will be set .
Network time protocol (NTP) is a communication protocol that syncs computers over the network. NTP syncs the time so all computers on the network do not have incorrect clock values. Improper time stamps on files and folders can cause a problem for network administrators, so NTP is used to keep all clients up to the second.
Installing ntpd :
- Run the below command to install ntpd via yum.
[root@server ~]# yum install ntp
- Set NTPD to Start: Update chkconfig to have ntpd start when the server restarts.
- Update Server Time: Use rdate to set the server time. Install it if it is not already installed.
[root@server ~]# yum install rdate
[root@server ~]# rdate -s cuckoo.nevada.edu
- Start NTPD: Run the below command to start NTP (Network Time Protocol).
[root@server ~]# service ntpd start
Use the below command to verify NTPD is now running. You should see output similar to what is below the ps command.
[root@server ~]# ps -ef | grep ntp
ntp 15120 1 0 21:50 ? 00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
root 20420 19746 0 22:44 pts/3 00:00:00 grep ntp
[root@server ~]# chkconfig ntpd on
[root@server ~]# chkconfig –list | grep ntp
Configuring the timezone :
As usual , Linux has many ways to achieve the same result . It’s up to the user to select the method that is the most convenient to him .From the terminal use one of the following configuration methods .
- System-config-date : go to the timezone tab and select your timezone
- setup : with your arrow keys select the timezone option
- tzselect : This utility is part of the glibc-common package , so if not available , install the package first ( yum install glibc-common) . tzselect is an interactive terminal utility , just follow the steps and make the appropriate selections