snmp--CentOS安裝Net-SNMP小計

來源:互聯網
上載者:User

snmp--CentOS安裝Net-SNMP小計

首先net-snmp是個軟體

然後我的目標是先安裝net-snmp到CentOS,再匯入python使用的netsnmp模組

即:

為最終目標

---------------------------------------------

從官網下載net-snmp的源碼,然後

./congficure

make

make install

值得講的是在CentOS安裝的時候會有一個錯誤:

Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5/usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5.) at Makefile.PL line 1.BEGIN failed--compilation aborted at Makefile.PL line 1.make: *** [perlmakefiles] ERROR 2
我的解決方案是: 
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
--------------------------------

在make install完成之後直接:

cd python

python setup.py build

python setup.py test

這裡python setup.py build的時候,我的系統預設是python3.4,在build的時候出錯,(python2.7就不會出錯,看來3.4對縮排更加嚴格哦)

TabError: inconsistent use of tabs and spaces in indentation 

然後去看setup.py檔案的時候發現有一行(14行)的縮排是tab而不是4空格,哈哈,這算bug嗎

然後python setup.py test的時候又出錯: 

ImportError: libnetsnmp.so.30: cannot open shared object file: No such file or directory

因為net-snmp是我編譯安裝的,還是預設的,所以它的檔案是分散的,其中/usr/local/lib裡有一部分

找不到這部分是錯誤的原因,解決方案如下: 

echo "/usr/local/netsnmp/lib" >> /etc/ld.so.confldconfig

然後

python setup.py install

安裝python模組,至此就會出線文章開頭那麼美妙的東西了

DONE.

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.