Skip to content

Instantly share code, notes, and snippets.

@mortenbra
Last active August 29, 2015 14:22

Revisions

  1. mortenbra revised this gist Jun 13, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion centos_ntp.sh
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ mv /etc/localtime /etc/localtime.bkp
    cp /usr/share/zoneinfo/Europe/Oslo /etc/localtime

    # install NTP
    yum install ntp
    yum install ntp -y
    chkconfig ntpd on
    cat >> /etc/ntp.conf << EOF
    server 0.no.pool.ntp.org
  2. mortenbra created this gist May 28, 2015.
    30 changes: 30 additions & 0 deletions centos_ntp.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    # 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
    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