[CENTOS7] 安裝rrdtool+RRDs+PERL

URL Link //n.sfs.tw/13060

2019-01-29 03:11:37 By 張○○

要讓perl繪圖,安裝rrdtool和RRDTool::OO,安裝的過程記錄,有一些困難也排除

CENTOS7+ PERL+ RRDTOOL+ RRDTool::OO(for PERL)

下載

CENTOS8 可以直接 dnf install rrdtool

如果要使用tarball 來裝的話,請到下方連結下載。

https://oss.oetiker.ch/rrdtool/pub/?M=D

安裝及解壓到目錄,進到目錄(略)

 

 

組態

# ./configure

執行出現以下錯誤:

* I found a copy of pkgconfig, but there is no libxml-2.0.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.

* I found a copy of pkgconfig, but there is no glib-2.0.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.

* I found a copy of pkgconfig, but there is no libpng.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.

* I found a copy of pkgconfig, but there is no pangocairo.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.
----------------------------------------------------------------------------

從[1]得來的建議,要裝以下套件

# yum install libxml2*
# yum install glib2*
# yum install libpng*

# yum install libpango* (不確定這個要不要?)

# yum install libcairo* (不確定這個要不要?)

裝完這個錯誤依舊

* I found a copy of pkgconfig, but there is no pangocairo.pc file around.
  You may want to set the PKG_CONFIG_PATH variable to point to its
  location.

上面的錯誤顯然是 pango和cairo這兩個套件,但我裝了又沒作用,但我不確定libcairo, libpango要不要。

爬文花了不少時間,後來發現[2]最後說到的重點,要裝這兩個套件:

# yum install cairo-devel
# yum install pango-devel

裝完組態就過了,感謝他們!

 

編譯及安裝

# make

# make install clean

裝好的程式放在 /opt/rrdtool-1.7.0/

 

PERL 如何使用?

原本找到[3] 所寫的 RRDTool::OO模組,以為可以使用,但是安裝時出現

This module requires rrdtool 1.2.x and the RRDs module to be
installed. They are available in the rrdtool distribution:
 http://oss.oetiker.ch/rrdtool/pub/rrdtool.tar.gz

他說要rrdtool 1.2.x版,我目前是1.7.0版,無論你按y或n都會失敗。

換句話說,在PERL中你不能使用這個套件,只能用1.7版提供的功能。

在PERL中,只要指定pm檔的目錄

 use lib qw( /opt/rrdtool-1.7.0/lib/perl/5.16.3/ );
 use RRDs;

後來發現,可以直接裝 rrdtool-perl

# yum install rrdtool-perl

這樣子安裝完就能直接use RRDs,不必再加 lib路徑~~

呿!怎麼不早說?

還是有差異,這樣子裝好的版本是 1.4.x版。

就看各位想用什麼版本了。

祝您寫程愉快~~

 

參考資料

[1] https://ubuntuforums.org/showthread.php?t=1112365

[2] https://wwangcg.iteye.com/blog/1408328

[3] https://metacpan.org/pod/RRDTool::OO