安装环境centos5.4 32位系统
安装gcc库
(1)apache
[root@localhost install]# rpm -e httpd --nodeps
[root@localhost install]# rpm -qa | grep openssl-devel
openssl-devel-0.9.8e-12.el5
[root@localhost install]# tar -zxvf httpd-2.2.15.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/httpd-2.2.15/
[root@localhost httpd-2.2.15]# ./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-auth-digest --enable-cgi --with-ssl=/usr/lib --enable-suexec --with-suexec-caller=daemon --with-suexec-docroot=/usr/local/apache/htdocs
[root@localhost httpd-2.2.15]#make
[root@localhost httpd-2.2.15]#make install
[root@localhost httpd-2.2.15]#cd /usr/local/apache/bin/
[root@localhost bin]# vim apachectl
#!/bin/sh
# chkconfig: 35 85 15
# description: Apache is a Web Server
[root@localhost bin]# cp apachectl /etc/init.d/httpd
[root@localhost bin]# chmod +x /etc/init.d/httpd
[root@localhost bin]# chkconfig --add httpd
[root@localhost bin]# service httpd start
测试:
http://192.168.1.121
It works!
数据库改成rpm mysql软件
________________________________________________________________________________________________________________________________________________________
(2)mysql
2:安装mysql
[root@localhost install]#rpm -qa | grep libtermcap-devel
libtermcap-devel-2.0.8-46.1
[root@localhost install]#rpm -e mysql --nodeps
[root@localhost install]# userdel -r mysql
[root@localhost install]# useradd -M -s /sbin/nologin mysql
[root@localhost install]# tar -zxvf mysql-5.1.47.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/mysql-5.1.47/
[root@localhost mysql-5.1.47]# ./configure --prefix=/usr/local/mysql --with-mysqld-user=mysql
[root@localhost mysql-5.1.47]#make
[root@localhost mysql-5.1.47]#make install
[root@localhost mysql-5.1.47]#cp support-files/my-medium.cnf /etc/my.cnf
[root@localhost mysql-5.1.47]#/usr/local/mysql/bin/mysql_install_db --user=mysql
[root@localhost mysql-5.1.47]#chown -R root:mysql /usr/local/mysql/
[root@localhost mysql-5.1.47]#chown -R mysql /usr/local/mysql/var/
[root@localhost mysql-5.1.47]#echo "/usr/local/mysql/lib/mysql" >> /etc/ld.so.conf
[root@localhost mysql-5.1.47]#ldconfig
[root@localhost mysql-5.1.47]#cp support-files/mysql.server /etc/init.d/mysqld
[root@localhost mysql-5.1.47]#chmod +x /etc/init.d/mysqld
[root@localhost mysql-5.1.47]#chkconfig --add mysqld
[root@localhost mysql-5.1.47]#chkconfig mysqld on
[root@localhost mysql-5.1.47]#service mysqld start
[root@localhost mysql-5.1.47]#ps -e | grep mysqld
3241 pts/0 00:00:00 mysqld_safe
3344 pts/0 00:00:00 mysqld
[root@localhost mysql-5.1.47]#export PATH=$PATH:/usr/local/mysql/bin
[root@localhost mysql-5.1.47]#echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile
[root@localhost mysql-5.1.47]#mysqladmin -u root password 123456
[root@localhost mysql-5.1.47]#mysql -u root -p
________________________________________________________________________________________________________________________________________________________
(3)php
安装php
[root@localhost install]# yum -y install gd*
[root@localhost install]# yum -y install libpng*
[root@localhost install]# yum -y install libjpeg*
[root@localhost install]# yum -y install freetype*
[root@localhost install]# yum -y install libxml2*
[root@localhost install]# yum -y install libart_lgpl
[root@localhost install]# yum -y install fontconfig
[root@localhost install]# yum -y install jpeg
[root@localhost install]# yum -y install gettext
[root@localhost install]# yum -y install curl
[root@localhost install]# yum -y install zlib
[root@localhost install]# yum -y install glib
[root@localhost install]# yum -y install pixman
[root@localhost bin]# yum -y install pango
[root@localhost install]# tar -zxvf php-5.2.13.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/php-5.2.13/
[root@localhost php-5.2.13]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql --with-gd --with-freetype-dir --with-jpeg-dir --with-png-dir --enable-sockets --with-zlib
[root@localhost php-5.2.13]#make
[root@localhost php-5.2.13]#make install
[root@localhost php-5.2.13]#cp php.ini-dist /usr/local/php/php.ini
[root@localhost php-5.2.13]#vim /usr/local/apache/conf/httpd.conf
53 LoadModule php5_module modules/libphp5.so
54 AddType application/x-httpd-php .php
167 <IfModule dir_module>
168 DirectoryIndex index.php index.html
169 </IfModule>
[root@localhost php-5.2.13]vim /usr/local/apache/htdocs/index.php
<?php
echo phpinfo();
?>
[root@localhost php-5.2.13]service httpd stop
[root@localhost php-5.2.13]service httpd start
测试
http://192.168.1.124
PHP页面
rrdtool
___________________________________________________________________________________________________________________________________________________
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[root@localhost install]# rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[root@localhost install]# yum -y install rrdtool*
(1/6): perl-rrdtool-1.4.7-1.el5.rf.i386.rpm
(2/6): lua-5.1.4-2.el5.rf.i386.rpm
(3/6): ruby-1.8.5-24.el5.i386.rpm
(4/6): rrdtool-devel-1.4.7-1.el5.rf.i386.rpm
(5/6): rrdtool-1.4.7-1.el5.rf.i386.rpm
(6/6): ruby-libs-1.8.5-24.el5.i386.rpm
___________________________________________________________________________________________________________________________________________________
(4)rrdtool
[root@localhost install]# tar -zxvf rrdtool-1.2.27.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/rrdtool-1.2.27/
[root@localhost rrdtool-1.2.27]# ./configure --prefix=/usr/local --disable-python --disable-tcl
[root@localhost rrdtool-1.2.27]#make
[root@localhost rrdtool-1.2.27]#make install
(5)net-snmp
[root@localhost install]# tar -zxvf net-snmp-5.5.tar.gz -C /usr/src/
[root@localhost install]# cd /usr/src/net-snmp-5.5/
[root@localhost net-snmp-5.5]# ./configure --prefix=/usr/local/net-snmp --enable-developer
编译过程中会回答几个问题,由于目前大部分设备支持 SNMPV2,所以此处建设选择 v2
Default version of SNMP to use (3): 2
System Contact Information (root@): [email protected]
System Location (Unknown): beijing
Location to write logfile (/var/log/snmpd.log):
Location to write persistent information (/var/net-snmp):
[root@localhost net-snmp-5.5]# make
[root@localhost net-snmp-5.5]# make install
[root@localhost net-snmp-5.5]# cp python/netsnmp/tests/snmpd.conf /etc/
[root@localhost net-snmp-5.5]# ln -s /usr/local/net-snmp/sbin/* /usr/local/sbin
[root@localhost net-snmp-5.5]# ln -s /usr/local/net-snmp/bin/* /usr/local/bin
[root@localhost net-snmp-5.5]# /usr/local/sbin/snmpd -c /etc/snmpd.conf
[root@localhost net-snmp-5.5]# echo "/usr/local/sbin/snmpd -c /etc/snmpd.conf" >> /etc/rc.local
[root@localhost net-snmp-5.5]#
[root@localhost net-snmp-5.5]# netstat -lnput | grep snmp
udp 0 0 0.0.0.0:161 0.0.0.0:* 5855/snmpd
注明:如果不安装net-snmp可能导致图片不出来
[root@localhost net-snmp-5.5]# yum -y install net-snmp
[root@localhost net-snmp-5.5]# rpm -ivh net-snmp-utils-5.3.2.2-7.el5.i386.rpm
[root@localhost net-snmp-5.5]# chkconfig snmpd off
[root@localhost net-snmp-5.5]# snmpwalk -v 1 -c public localhost SNMPv2-MIB::system
SNMPv2-MIB::sysDescr.0 = STRING: Linux localhost 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:54 EDT 2009 i686
SNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::org
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (10436) 0:01:44.36
SNMPv2-MIB::sysContact.0 = STRING: G. S. Marzot <[email protected]>
SNMPv2-MIB::sysName.0 = STRING: localhost
SNMPv2-MIB::sysLocation.0 = STRING: beijing
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDMIBObjects.3.1.1
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB
----------------------------------------------------------------------------------------------------------------------------------------------------------
(6)cacti
[root@localhost install]# tar -zxvf cacti-0.8.7b-cn-utf8.tar.gz -C /usr/local/apache/htdocs/
[root@localhost install]# mv /usr/local/apache/htdocs/cacti-0.8.7b-cn-utf8 /usr/local/apache/htdocs/cacti
[root@localhost install]# cd /usr/local/apache/htdocs/
[root@localhost htdocs]# useradd cacti
[root@localhost htdocs]# chown cacti:cacti cacti/log cacti/rra
[root@localhost htdocs]# mysql -u root -p
mysql> create database cacti default character set utf8;
mysql> grant all on cacti.* to cacti@localhost identified by "cacti";
mysql> flush privileges;
[root@localhost htdocs]# mysql -u cacti -p cacti < cacti/cacti.sql
[root@localhost htdocs]# vim cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
cacti用户设置任务计划:
root@localhost htdocs]# su - cacti
[cacti@localhost ~]$ crontab -e
*/5 * * * * /usr/local/php/bin/php /usr/local/apache/htdocs/cacti/poller.php &> /dev/null
[root@localhost htdocs]# service crond restart
[root@localhost htdocs]# chkconfig crond on
tar -zxvf cacti-cactid-0.8.6k.tar.gz -C /usr/src/
cd /usr/src/cacti-cactid-0.8.6k
./configure --prefix=/usr/local/cactid --with-mysql=/usr/local/mysql --with-snmp=/usr/local/net-snmp
make
make install
cd /usr/local/cactid/etc/
vim cactid.conf
DB_Host localhost
DB_Database cacti
DB_User cacti
DB_Pass cacti
DB_Port 3306
http://192.168.1.151/cacti
/usr/local/cactid/bin/cactid
/usr/local/php/bin/php
/install/zysong.ttf
[root@localhost install]# tar -zxvf cacti-plugin-arch.tar.gz -C /usr/local/apache/htdocs/cacti/
[root@localhost install]# cd /usr/local/apache/htdocs/cacti/
[root@localhost cacti]# mysql -u cacti -p cacti < cacti-plugin-arch/pa.sql
[root@localhost cacti]# gunzip -c /install/cacti-plugin-0.8.7b-PA-v2.1-cn-utf8.diff.gz > PA-utf8.diff
[root@localhost cacti]# patch -p1 -N < PA-utf8.diff
[root@localhost cacti]# cd /usr/local/apache/htdocs/cacti/plugins
[root@localhost plugins]# tar -zxvf /install/monitor-0.8.2.tar.gz
[root@localhost plugins]# tar -zxvf /install/settings-0.5.tar.gz
[root@localhost plugins]# tar -zxvf /install/thold-0.3.9.tar.gz
[root@localhost plugins]# tar -zxvf /install/clog-1.21.tar.gz
[root@localhost plugins]# tar -zxvf /install/reportit_v061.tar.gz
[root@localhost plugins]# tar -zxvf /install/discovery-0.8.5.tar.gz
[root@localhost plugins]# mysql -u cacti -p cacti < thold/thold.sql
Enter password:cacti
[root@localhost plugins]# mysql -u cacti -p cacti < monitor/monitor.sql
Enter password: cacti
[root@localhost plugins]# mysql -u cacti -p cacti < discovery/discover.sql
[root@localhost plugins]# vim ../include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cacti";
$database_port = "3306";
$plugins = array ();
$plugins[] = "settings";
$plugins[] = "thold";
$plugins[] = "monitor";
$plugins[] = "clog";
$plugins[] = "discovery";
$plugins[] = "reportit";
测试:
http://192.168.1.120/cacti
本文出自 “dsafsa_技术博客” 博客,转载请与作者联系!