CentOS7にNTPクライアントをインストールする
スポンサーリンク
CentOS7にNTPクライアントをインストールする方法
CentOS7にはNTPクラインとが2種類(Chrony, ntp)あるが,基本的にはChronyで問題ないと思う
Chrony
インストール
$ sudo yum -y install chrony
NTPサーバーの編集
/etc/chrony.conf
の3~6行目をコメントアウトし,その下にntpサーバーを指定
$ sudo vi /etc/chrony.conf #server 0.centos.pool.ntp.org iburst #server 1.centos.pool.ntp.org iburst #server 2.centos.pool.ntp.org iburst #server 3.centos.pool.ntp.org iburst server ntp1.jst.mfeed.ad.jp iburst server ntp2.jst.mfeed.ad.jp iburst server ntp3.jst.mfeed.ad.jp iburst
サービス起動
$ sudo systemctl enable chronyd $ sudo systemctl start chronyd
しばらくすると,正しい時刻に更新される
$ date xxxx年 xx月 xx日 x曜日 xx:xx:xx JST
NTP
インストール
$ sudo yum -y install ntp
NTPサーバーの編集
/etc/ntp.conf
にntpサーバーを指定
$ sudo vi /etc/ntp.conf # Use public servers from the pool.ntp.org project # Please consider joining the pool (http://www.pool.ntp.org/join.html). #server 0.centos.pool.ntp.org iburst #server 1.centos.pool.ntp.org iburst #server 2.centos.pool.ntp.org iburst #server 3.centos.pool.ntp.org iburst server ntp1.jst.mfeed.ad.jp iburst server ntp2.jst.mfeed.ad.jp iburst server ntp3.jst.mfeed.ad.jp iburst
サービス起動
$ sudo systemctl enable ntpd $ sudo systemctl start ntpd
しばらくすると,正しい時刻に更新される
$ date xxxx年 xx月 xx日 x曜日 xx:xx:xx JST