{"id":13463,"date":"2019-04-02T04:43:03","date_gmt":"2019-04-02T04:43:03","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13463"},"modified":"2019-04-02T04:43:03","modified_gmt":"2019-04-02T04:43:03","slug":"how-to-install-and-use-chrony-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/02\/how-to-install-and-use-chrony-in-linux\/","title":{"rendered":"How to Install and Use Chrony in Linux"},"content":{"rendered":"<p><strong>Chrony<\/strong>\u00a0is a flexible implementation of the\u00a0<a href=\"https:\/\/www.tecmint.com\/install-ntp-server-in-centos\/\" target=\"_blank\" rel=\"noopener\">Network Time Protocol (NTP)<\/a>. It is used to synchronize the system clock from different NTP servers, reference clocks or via manual input.<\/p>\n<p>It can also be used\u00a0<strong>NTPv4<\/strong>\u00a0server to provide time service to other servers in the same network. It is meant to operate flawlessly under different conditions such as intermittent network connection, heavily loaded networks, changing temperatures which may affect the clock of ordinary computers.<\/p>\n<p><strong>Chrony<\/strong>\u00a0comes with two programs:<\/p>\n<ul>\n<li><strong>chronyc<\/strong>\u00a0\u2013 command line interface for chrony<\/li>\n<li><strong>chronyd<\/strong>\u00a0\u2013 daemon that can be started at boot time<\/li>\n<\/ul>\n<p>In this tutorial we are going to show you how to install and use\u00a0<strong>Chrony<\/strong>\u00a0on your Linux system.<\/p>\n<h3>Install Chrony in Linux<\/h3>\n<p>On some systems,\u00a0<strong>chrony<\/strong>\u00a0may be installed by default. Still if the package is missing, you can easily install it. using your default package manager tool on your respective Linux distributions using following command.<\/p>\n<pre># yum -y install chrony    [On <strong>CentOS\/RHEL<\/strong>]\r\n# apt install chrony       [On <strong>Debian\/Ubuntu<\/strong>]\r\n# dnf -y install chrony    [On <strong>Fedora 22+<\/strong>]\r\n<\/pre>\n<p>To check the status of\u00a0<strong>chronyd<\/strong>\u00a0use the following command.<\/p>\n<pre># systemctl status chronyd      [On <strong>SystemD<\/strong>]\r\n# \/etc\/init.d\/chronyd status    [On <strong>Init<\/strong>]\r\n<\/pre>\n<p>If you want to enable\u00a0<strong>chrony<\/strong>\u00a0daemon upon boot, you can use the following command.<\/p>\n<pre> \r\n# systemctl enable chrony       [On <strong>SystemD<\/strong>]\r\n# chkconfig --add chronyd       [On <strong>Init<\/strong>]\r\n<\/pre>\n<h3>Check Chrony Synchronization in Linux<\/h3>\n<p>To check if chrony is actually synchronized, we will use it\u2019s command line program\u00a0<strong>chronyc<\/strong>, which has the tracking option which will provide relevant information.<\/p>\n<pre># chronyc tracking\r\n<\/pre>\n<div id=\"attachment_30929\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/10\/Check-Chrony-Synchronization-in-Linux.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30929\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/10\/Check-Chrony-Synchronization-in-Linux.png\" sizes=\"auto, (max-width: 799px) 100vw, 799px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/10\/Check-Chrony-Synchronization-in-Linux.png 799w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/10\/Check-Chrony-Synchronization-in-Linux-768x240.png 768w\" alt=\"Check Chrony Synchronization in Linux\" width=\"799\" height=\"250\" aria-describedby=\"caption-attachment-30929\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-30929\" class=\"wp-caption-text\">Check Chrony Synchronization in Linux<\/p>\n<\/div>\n<p>The listed files provide the following information:<\/p>\n<ul>\n<li><strong>Reference ID<\/strong>\u00a0\u2013 the reference ID and name to which the computer is currently synced.<\/li>\n<li><strong>Stratum<\/strong>\u00a0\u2013 number of hops to a computer with an attached reference clock.<\/li>\n<li><strong>Ref time<\/strong>\u00a0\u2013 this is the UTC time at which the last measurement from the reference source was made.<\/li>\n<li><strong>System time<\/strong>\u00a0\u2013 delay of system clock from synchronized server.<\/li>\n<li><strong>Last offset<\/strong>\u00a0\u2013 estimated offset of the last clock update.<\/li>\n<li><strong>RMS offset<\/strong>\u00a0\u2013 long term average of the offset value.<\/li>\n<li><strong>Frequency<\/strong>\u00a0\u2013 this is the rate by which the system\u2019s clock would be wrong if\u00a0<strong>chronyd<\/strong>\u00a0is not correcting it. It is provided in ppm (parts per million).<\/li>\n<li><strong>Residual freq<\/strong>\u00a0\u2013 residual frequency indicated the difference between the measurements from reference source and the frequency currently being used.<\/li>\n<li><strong>Skew<\/strong>\u00a0\u2013 estimated error bound of the frequency.<\/li>\n<li><strong>Root delay<\/strong>\u00a0\u2013 total of the network path delays to the stratum computer, from which the computer is being synced.<\/li>\n<li><strong>Leap status<\/strong>\u00a0\u2013 this is the leap status which can have one of the following values \u2013 normal, insert second, delete second or not synchronized.<\/li>\n<\/ul>\n<p>To check information about chrony\u2019s sources, you can issue the following command.<\/p>\n<pre># chronyc sources\r\n<\/pre>\n<div id=\"attachment_30930\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/10\/Check-Chrony-Sources.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-30930\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2018\/10\/Check-Chrony-Sources.png\" alt=\"Check Chrony Sources\" width=\"702\" height=\"195\" aria-describedby=\"caption-attachment-30930\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-30930\" class=\"wp-caption-text\">Check Chrony Sources<\/p>\n<\/div>\n<h3>Configure Chrony in Linux<\/h3>\n<p>The configuration file of chrony is located at\u00a0<strong>\/etc\/chrony.conf<\/strong>\u00a0or\u00a0<strong>\/etc\/chrony\/chrony.conf<\/strong>\u00a0and sample configuration file may look something like this:<\/p>\n<pre>server 0.rhel.pool.ntp.org iburst\r\nserver 1.rhel.pool.ntp.org iburst\r\nserver 2.rhel.pool.ntp.org iburst\r\nserver 3.rhel.pool.ntp.org iburst\r\n\r\nstratumweight 0\r\ndriftfile \/var\/lib\/chrony\/drift\r\nmakestep 10 3\r\nlogdir \/var\/log\/chrony\r\n<\/pre>\n<p>The above configuration provide the following information:<\/p>\n<ul>\n<li><strong>server<\/strong>\u00a0\u2013 this directive used to describe a NTP server to sync from.<\/li>\n<li><strong>stratumweight<\/strong>\u00a0\u2013 how much distance should be added per stratum to the sync source. The default value is\u00a0<strong>0.0001<\/strong>.<\/li>\n<li><strong>driftfile<\/strong>\u00a0\u2013 location and name of the file containing drift data.<\/li>\n<li><strong>Makestep<\/strong>\u00a0\u2013 this directive causes chrony to gradually correct any time offset by speeding or slowing down the clock as required.<\/li>\n<li><strong>logdir<\/strong>\u00a0\u2013 path to chrony\u2019s log file.<\/li>\n<\/ul>\n<p>If you want to step the system clock immediately and ignoring any adjustments currently being in progress, you can use the following command:<\/p>\n<pre># chronyc makestep\r\n<\/pre>\n<p>If you decide to stop\u00a0<strong>chrony<\/strong>, you can use the following commands.<\/p>\n<pre># systemctl stop chrony          [On <strong>SystemD<\/strong>]\r\n# \/etc\/init.d\/chronyd stop       [On <strong>Init<\/strong>]\r\n<\/pre>\n<h5>Conclusion<\/h5>\n<p>This was a show presentation of the\u00a0<strong>chrony<\/strong>\u00a0utility and how it can be used on your Linux system. If you wish to check more details about chrony, do review\u00a0<a href=\"https:\/\/chrony.tuxfamily.org\/\" target=\"_blank\" rel=\"nofollow noopener\">chrony documentation<\/a>.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/install-chrony-in-centos-ubuntu-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Chrony\u00a0is a flexible implementation of the\u00a0Network Time Protocol (NTP). It is used to synchronize the system clock from different NTP servers, reference clocks or via manual input. It can also be used\u00a0NTPv4\u00a0server to provide time service to other servers in the same network. It is meant to operate flawlessly under different conditions such as intermittent &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/02\/how-to-install-and-use-chrony-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Install and Use Chrony in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13463","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13463"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13463\/revisions"}],"predecessor-version":[{"id":13466,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13463\/revisions\/13466"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}