说明:
实现: # yum -y install httpd mysql-server php php-mysql mysql-devel # chkconfig httpd on //设置httpd开机启动 # chkconfig mysqld on # /etc/init.d/httpd start //启动httpd # /etc/init.d/mysqld start 安装完成后,可通过以下程序测试 # cat index.php //内容如下 <?php phpinfo(); ?>
# wget http://oss.oetiker.ch/rrdtool/pub/rrdtool-1.4.7.tar.gz Rrdtool http://oss.oetiker.ch/rrdtool/ # wget http://sourceforge.net/projects/net-snmp/files/net-snmp/5.6.2/net-snmp-5.6.2.tar.gz Net-snmp http://www.net-snmp.org/ # wget http://www.cacti.net/downloads/cacti-0.8.8a.tar.gz Cacti http://www.cacti.net/
# yum -y install cairo-devel libxml2-devel pango-devel //Rrdtool安装需要cairo、libxml2、pango库支持,可通过yum安装 # tar zxvf rrdtool-1.4.7.tar.gz # cd rrdtool-1.4.7 # ./configure --prefix=/usr/local/rrdtool # make && make install # ln -s /usr/local/rrdtool/bin/* /usr/local/bin/
# tar zxvf net-snmp-5.6.2.tar.gz # cd net-snmp-5.6.1.1 # ./configure --prefix=/usr/local/net-snmp ./configure编译时,遇到checking for file... no configure: error: file program not found although it is needed by libtool,直接yum install -y file就可以了 # make && make install # cp EXAMPLE.conf /etc/snmpd.conf # ln -s /usr/local/net-snmp/bin/* /usr/local/bin/ # vim /etc/snmpd.conf rocommunity public localhost //去掉注释 # /usr/local/net-snmp/sbin/snmpd -c /etc/snmpd.conf # echo "/usr/local/net-snmp/sbin/snmpd -c /etc/snmpd.conf " >>/etc/rc.local //加入开机启动
# tar zxvf cacti-0.8.8a.tar.gz # mv cacti-0.8.8a/* /var/www/html/ //将cacti中的内容移到 web目录 # chown -R apache:apache /var/www/html/ # mysql -uroot -p //连接到mysql创建数据库 > create database cacti; //创建cacti数据库 > insert into mysql.user(host,user,password) values ('localhost','cacti',password('cacti123')); //建立用户cacti,密码cacti123 > flush privileges; //重载mysql授权表 > grant all on cacti.* to cacti@'localhost' identified by 'cacti123'; //把数据库cacti授权于用户cacti # cd /var/www/html/ # mysql -ucacti -pcacti123 cacti<cacti.sql //将cacti数据库导入 # vim include/config.php //修改网站连接数据库的配置文件 $database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cacti"; $database_password = "cacti123"; $database_port = "3306"; $url_path = "/cacti/";为$url_path = "/"; //更改usr_path,不然访问cacti时地址还得加http://192.168.0.2/cacti
|