2011年5月24日 星期二

Freebsd 7.0 安裝cacti手冊

Freebsd 7.0 安裝cacti手冊


原創作品,允許轉載,轉載時請務必以超鏈接形式標明文章 原始出處 、作者信息和本聲明。否則將追究法律責任。http://5ydycm.blog.51cto.com/115934/113305
[背景]公司的監控平台大部分都是freebsd,為了以後安裝方便寫了個這個手冊,供以後用.
[內容]
注意:在安裝apache後,就開一個測試頁,裝了php,就一直用phpinfo來檢測改變!  記住要用apachectl graceful
(1)安裝apache
cd /usr/ports/www/apache22
make config
選擇mysql
make install clean
ee rc.conf
apache22_enable="YES"
(2)安裝php
cd /usr/ports/lang/php5
make config
選擇apache
make install clean
修改httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
cp /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini
(3)安裝mysql
cd /usr/ports/database/mysql50-server
make install clean
/usr/local/bin/mysql_install_db --user=mysql
/usr/local/bin/mysqld_safe --user=mysql&
ee rc.conf
mysql_enable="YES"
(4)安裝php-extensions
cd /usr/ports/lang/php5-extensions
make config
選擇mysql
make install clean
[測試php連接mysql]
db.inc
$host="localhost";
$user="root";
$pwd="badboy";
?>
index.php
require_once "db.inc";
$db=mysql_pconnect($host,$user,$pwd);
if ($db){
echo "connect!";
}
?>
(5)安裝zend
cd /usr/local/devel/ZendOptimizer
make install clean
add
[Zend]
zend_optimizer.optimization_level=15
zend_extension_manager.optimizer="/usr/local/lib/php/20060613/Optimizer"
zend_extension_manager.optimizer_ts="/usr/local/lib/php/20060613/Optimizer_TS"
zend_extension="/usr/local/lib/php/20060613/ZendExtensionManager.so"
zend_extension_ts="/usr/local/lib/php/20060613/ZendExtensionManager_TS.so"
[注意]
上面的路徑中"20060613"這個是變量,不是固定的.
解決一個[問題]
Failed loading /usr/local/lib/php/20060613/ZendExtensionManager.so:  Shared object "libm.so.4" not found, required by "ZendExtensionManager.so"
報錯
解決辦法:ln -s /lib/libm.so.5 /usr/lib/libm.so.4即可。
(6)安裝rrdtool
cd /usr/ports/database/rrdtool
make install clean
(7)安裝net-snmp
cd /usr/ports/net-mgmt/net-snmp
make install clean
自動的會將snmp support加入到php的擴展功能中,所以在php擴展模塊選擇上面沒有選擇snmp
ee /etc/snmpd.conf
###################################################################
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):
#       sec.name  source          community
com2sec notConfigUser  default  passwd

####
# Second, map the security names into group names:
#               sec.model  sec.name
group   notConfigGroup v1           notConfigUser
group   notConfigGroup   v2c           notConfigUser
####
# Third, create a view for us to let the groups have rights to:
#           incl/excl subtree                          mask
view all    included  .1                               80
####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:
#                context sec.model sec.level match  read   write  notif
access notConfigGroup ""      any       noauth    exact  all    none   none
#############################################################################
(8)安裝cacti
cd /usr/ports/net-mgmt/cacti
make config
選擇擴展插件
make install clean

[注意]
每一款軟件安裝最後,都會有相應的提示,如snmp安裝後,cacti安裝後......有些可能是配置說明文檔
本文出自 「壞男孩」 博客,請務必保留此出處http://5ydycm.blog.51cto.com/115934/113305

*可參閱CACTI 流量監控工具 (此文以FreeBSD 5.4 Release為範例,有些ports路徑有更改,請小心!!

沒有留言:

張貼留言