downloal the debian 5 iso for install:
http://cdimage.debian.org/debian-cd/5.0.0/i386/iso-cd/debian-500-i386-netinst.iso
install the debian with the downloaded ISO
code:
#!/bin/bash
#update!
apt-get update
apt-get upgrade
cd /tmp
#install the component
apt-get install ssh patch zip -y
#apt-get install gcc g++ -y
apt-get install apache2 -y
apt-get install php5 php5-gd -y
apt-get install mysql-server -y
apt-get install php5-mysql -y
apt-get install phpmyadmin -y
#apt-get install snmp
#apt-get install rrdtool
#install cactid
apt-get install cacti-spine -y
do not config the mysql for cacti.
#download and extract the cacti 0.8.7d from cacti.net
cd /tmp
mv /usr/share/cacti/site /usr/share/cacti/site-b
wget http://www.cacti.net/downloads/cacti-0.8.7d.tar.gz
tar zxvf cacti-0.8.7d.tar.gz
mv cacti-0.8.7d /usr/share/cacti/site #debian/ubuntu
#download the patch from cacti.net
wget http://www.cacti.net/downloads/patches/0.8.7d/ping_timeout.patch
wget http://www.cacti.net/downloads/patches/0.8.7d/graph_search.patch
wget http://www.cacti.net/downloads/patches/0.8.7d/page_length_graph_view.patch
wget http://www.cacti.net/downloads/patches/0.8.7d/snmp_string_issue_with_rrdtool_creation.patch
#patch for cacti 0.8.7d
cd /usr/share/cacti/site
patch -p1 -N < /tmp/ping_timeout.patch
patch -p1 -N < /tmp/graph_search.patch
patch -p1 -N < /tmp/page_length_graph_view.patch
patch -p1 -N < /tmp/snmp_string_issue_with_rrdtool_creation.patch
cd /tmp
#download cacti-plugin-0.8.7d-PA-v2.4.zip for cacti 0.8.7d from Patrick.Ru’s Blog.
wget http://forums.cacti.net/download.php?id=16863 -O cacti-plugin-0.8.7d-PA-v2.4.zip
#unzip the cacti-plugin-0.8.7d-PA-v2.4.zip
unzip cacti-plugin-0.8.7d-PA-v2.4.zip
#patch the PA v2.4 for cacti-0.8.7d
cd /usr/share/cacti/site
patch -p1 -N < /tmp/cacti-plugin-0.8.7d-PA-v2.4.diff
cd /tmp
#Create the database for cacti
mysql -u root -pdbadmin
CREATE DATABASE `cacti` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci
\g
CREATE USER ‘cactiuser’@'localhost’ IDENTIFIED BY ‘cactiuser’
\g
GRANT ALL PRIVILEGES ON `cacti` . * TO ‘cactiuser’@'localhost’
\g
\q
mysql -u cactiuser -pcactiuser cacti < /usr/share/cacti/site/cacti.sql
mysql -u cactiuser -pcactiuser cacti < /tmp/pa.sql