CentOS 6.5 64位安裝ntp 4.2.7p425相關教程

來源:互聯網
上載者:User

CentOS 6.5 64位安裝ntp 4.2.7p425相關教程
顯然,如果要把NTP伺服器升級到4.2.7p26,目前只能編譯安裝開發版的ntp 4.2.7p425。
為了驗證這個解決方案,我在CentOS下編譯安裝開發版ntp,但參考網上的教程時遇到了不少問題,特寫此教程。
一、條件及環境:
1、CentOS:我用的是最新的CentOS 6.5 64位版,此教程應該也適用於RedHat 6及CentOS 6系列所有系統;
2、編譯所需環境:
# yum -y install vim ntp* wget gcc gcc-c++ ncurses-devel cmake make
# cp /etc/ntp.conf /usr/local/src/ntp.conf
# yum remove ntp*
注意:編譯安裝不會在/etc下自動組建組態檔案,所以我先yum安裝ntp 4.2.6p5產生/etc/ntp.conf後複製出設定檔,再卸載ntp。
3、關閉防火牆及SELINUX!
# chkconfig iptables off
# vim /etc/sysconfig/selinux
將SELINUX=enforcing修改成:
SELINUX=disabled
二、下載並安裝ntp 4.2.7p425:
1、下載ntp 4.2.7p425:
如果伺服器可以上網,可直接用wget命令下載:
# cd /usr/local/src
# wget http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-dev/ntp-dev-4.2.7p425.tar.gz
如果伺服器不能上網,那你就去http://www.ntp.org/downloads.html下載到本地,然後通過SFTP或FTP上傳到伺服器上!
2、解包安裝ntp-dev-4.2.7p425.tar.gz:
# tar zxvf ntp-dev-4.2.7p425.tar.gz
# cd ntp-dev-4.2.7p425
# ./configure --prefix=/usr/local/ntp --enable-all-clocks --enable-parse-clocks
# make && make install
3、修改設定檔ntp.conf:
# cp /usr/local/src/ntp.conf /etc/ntp.conf
# vim /etc/ntp.conf
第(1)種配置:允許任何IP的客戶機都可以進行時間同步
則將“restrict default kod nomodify notrap nopeer noquery”這行修改成:
restrict default nomodify
第(2)種配置:只允許192.168.200.*網段的客戶機進行時間同步
在“restrict default kod nomodify notrap nopeer noquery”(表示預設拒絕所有IP的時間同步)之後增加一行:
restrict 192.168.200.0 mask 255.255.255.0 nomodify
另外,設定檔預設通過網路同步時間:
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
(RedHat預設有類似上面4行內容,網域名稱不一樣而已)
如果需要使用本地時間,則把上面4行刪掉或者用“#”號注釋掉,然後添加以下兩行:
server 127.127.1.0
fudge 127.127.1.0 stratum 10
(RedHat預設有上面兩行,但被注釋掉了)
4、啟動ntp服務:
# /usr/local/ntp/bin/ntpd -c /etc/ntp.conf -p /tmp/ntpd.pid
# 檢查ntp伺服器是否在後台運行可以用下面這條命令:
# ps -ef | grep ntp
# 檢查ntpd偵聽的UDP 123連接埠是否正常用下面這條命令:
# netstat -unl | grep 123
5、用用戶端檢驗時鐘同步伺服器是否可用。
6、如需設定ntpd服務開機自動啟動,則只需把上面的啟動命令放入/etc/rc.local檔案中即可。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.