Moon Light Box

Time is Money

Linux - Install NTP in CentOS 7

| Comments

Step 1. Install

# sudo yum -y install ntp

Step 2. Link localtime to Taipei time.

# sudo rm /etc/localtime
# sudo ln -s /usr/share/zoneinfo/Asia/Taipei /etc/localtime

Step 3.

# sudo vim /etc/ntp.conf


# Permit all access over the loopback interface.  This could
# be tightened as well, but to do so would effect some of
# the administrative functions.
restrict tock.stdtime.gov.tw
restrict tick.stdtime.gov.tw
restrict time.stdtime.gov.tw
#restrict 127.0.0.1
#restrict -6 ::1

# Hosts on local network are less restricted.
restrict 10.16.131.0 mask 255.255.255.0 nomodify
#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap


# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server tock.stdtime.gov.tw
server tick.stdtime.gov.tw
server time.stdtime.gov.tw
#server 0.centos.pool.ntp.org
#server 1.centos.pool.ntp.org
#server 2.centos.pool.ntp.org
#server 3.centos.pool.ntp.org
# sudo vim /etc/sysconfig/ntpd

SYNC_HWCLOCK=yes

Step 3. Auto Start when Boot On.

# sudo systemctl start ntpd
# sudo systemctl enable ntpd

Linux

Comments

comments powered by Disqus