How to sync time on linux server using Network Time Protocol (NTP)

Some times we might wrong time on servers or on your machine. On machines cmos battery is helpful to keep system time update to date even machine is not running. If this is not working or for some reason we might get wrong time on machines some times. To make sure servers time is update it is recommended to configure your system with NTP servers to sync server time.

NTP is the protocol which is used to sync system time. which stands for Network Time protocol. System will sync time form any one of the NTP server available using this protocol

We use the program ntp on linux to sync time from NTP servers. If you don’t this thing already installed, install using following instructions.


sudo apt-get install ntp 

apt-get install ntpdate

CentOS or Redhat

sudo yum install ntp

Once this program is installed, you will get /etc/ntp.conf  file. This file can be edited to configure ntp. You can place your desired NTP server in this file to sync time from that server. List of NTP servers can be found at NTP Servers

After you install package ntp you will get several commands including ntpd deamon. This daemon will run in background to sync system time.

Start nptd deamon

/etc/init.d/ntpd start

Configure ntpd to run as startup

chkconfig ntpd on 

Update time using ntpdate

If not already installed

Update system time




Leave a Reply

Your email address will not be published. Required fields are marked *