Last active
August 29, 2015 14:22
Setup Network Time Protocol (NTP) for CentOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup Network Time Protocol (NTP) | |
# see http://www.uptimemadeeasy.com/networking/setup-ntp-on-centos-linux/ | |
# check current date/time | |
date | |
# setup time zone | |
mv /etc/localtime /etc/localtime.bkp | |
cp /usr/share/zoneinfo/Europe/Oslo /etc/localtime | |
# install NTP | |
yum install ntp -y | |
chkconfig ntpd on | |
cat >> /etc/ntp.conf << EOF | |
server 0.no.pool.ntp.org | |
server 1.no.pool.ntp.org | |
server 2.no.pool.ntp.org | |
server 3.no.pool.ntp.org | |
EOF | |
cat >> /etc/ntp/step-tickers << EOF | |
0.no.pool.ntp.org | |
1.no.pool.ntp.org | |
2.no.pool.ntp.org | |
3.no.pool.ntp.org | |
EOF | |
service ntpd restart | |
# wait 5-10 minutes and check current date/time again | |
date |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment