[背景]公司的监控平台大部分都是freebsd,为了以后安装方便写了个这个手册,供以后用.
[内容]
注意:在安装apache后,就开一个测试页,装了php,就一直用phpinfo来检测改变! 记住要用apachectl graceful
注意:在安装apache后,就开一个测试页,装了php,就一直用phpinfo来检测改变! 记住要用apachectl graceful
(1)安装apache
cd /usr/ports/www/apache22
make config
选择mysql
make install clean
ee rc.conf
apache22_enable="YES"
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
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"
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
<?php
$host="localhost";
$user="root";
$pwd="badboy";
?>
index.php
<?php
require_once "db.inc";
$db=mysql_pconnect($host,$user,$pwd);
if ($db){
echo "connect!";
}
?>
cd /usr/ports/lang/php5-extensions
make config
选择mysql
make install clean
[测试php连接mysql]
db.inc
<?php
$host="localhost";
$user="root";
$pwd="badboy";
?>
index.php
<?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"
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"这个是变量,不是固定的.
上面的路径中"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即可。
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):
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
com2sec notConfigUser default passwd
####
# Second, map the security names into group names:
# sec.model sec.name
group notConfigGroup v1 notConfigUser
group notConfigGroup v1 notConfigUser
group notConfigGroup v2c notConfigUser
####
# Third, create a view for us to let the groups have rights to:
# Third, create a view for us to let the groups have rights to:
# incl/excl subtree mask
view all included .1 80
view all included .1 80
####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:
# 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
access notConfigGroup "" any noauth exact all none none
#############################################################################
(8)安装cacti
cd /usr/ports/net-mgmt/cacti
make config
选择扩展插件
make install clean
cd /usr/ports/net-mgmt/cacti
make config
选择扩展插件
make install clean
[注意]
每一款软件安装最后,都会有相应的提示,如snmp安装后,cacti安装后......有些可能是配置说明文档