Install Cacti From Source on Ubuntu 9.04/9.10  
Last Updated: January 02, 2010
(01) Introduction:

The following how-to will show you howto install (Install Only, not Configuration) Cacti from the Source Package (.tar.gz).

Disclaimer: Here, I am giving no warranty that my howto will work for you. Use it as your own risk. Test it first before you go for any production server. Secure your server as your own.

You may mail me to helpdesk@linux-bd.com if you have any asking regarding this howto. You also may catch me on google-talk, my gtalk id is 'rkarim1981'


(02) Installing Cacti From Source:

Login as root, to your Linux Box where you already installed Ubuntu Server Edition 9.04/9.10; also you must select LAMP (Apache, MySQL, PHP) while you installed Ubuntu Server Edition 9.04/9.10, and make sure this server is connected to the internet

So, Here, I suppose, you have installed LAMP (Apache, MySQL, PHP) while you installed Ubuntu Server Edition 9.04/9.10; also these services are running properly, and you know the MySQL root password. Now apply (you may copy/past) the following shell commands (removing preceding "cmd:");

Lets Start ...

cmd:apt-get update
cmd:apt-get upgrade; you may skip this if internet speed is less than 512kpbs
cmd:apt-get install snmp snmpd rrdtool; these are dependency other than LAMP
cmd:cd /var/www/
cmd:wget http://www.cacti.net/downloads/cacti-0.8.7e.tar.gz; I found this version in December 2009
cmd:mysql --user=root --password=mysqlrootpassword; test that you can login to mysql successfully
SQL:exit;; type 'exit;' to logout from MySQL
cmd:tar zxvf cacti-0.8.7e.tar.gz
cmd:mv cacti-0.8.7e cacti
cmd:cd /var/www/cacti
cmd:
cmd:vim include/config.php
next:[OK] Now edit this cacti php config file as follows:
cmd:
edit:
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "root";
$database_password = "mysqlrootpassword";
$database_port = "3306";
cmd:[Save + Exit]
cmd:
cmd:mysqladmin --user=root --password=mysqlrootpassword create cacti; it will create the cacti database in MySQL
cmd:mysql --user=root --password=mysqlrootpassword cacti < cacti.sql; it will create the tables in MySQL require for Cacti
cmd:
cmd:vim /etc/crontab
next:[OK] Now add the following line in "/etc/crontab" at the end;
cmd:
add:
*/5 * * * * root php /var/www/cacti/poller.php > /dev/null 2>&1
cmd:[Save + Exit]
cmd:
cmd:/etc/init.d/apache2 restart; restart the apache service
done:[OK] You are done with Cacti Installation; end of Cacti Installation
done:[DONE]


(03) Accessing The Cacti Interface from Browser

At this stage your Cacti is installed. Now you can access your Cacti interface page from your browser by the URL:
http://server-ip/cacti

To login you have to use username=admin and password=admin, then you will be asked for changing the default admin password. Change the password and login to your Cacti admin panel. Keep your Password Safe.


(04) Hosting The Cacti Webpage To a Specific Port

You can host the cacti webpage to a specific port, so that the page can not be accessed publicly. It is a standard procedure to secure your cacti webpage. To do that you have to know how to configure the apache2 in Ubuntu, that I will not show here. I will just show you the part that is require to run the cacti hosting page to a specific port. Here I will use PORT 9090 as the cacti accessing port.

Now apply (you may copy/past) the following shell commands (removing preceding "cmd:");
Lets, do it ...

cmd:vim /etc/apache2/ports.conf; open the file '/etc/apache2/ports.conf'
next:[OK] You should edit/add the following lines as follows, keep other lines untouced:
cmd:
edit:
Listen    server-ip-address:80# your default apache2 hosting page will use this port
Listen    server-ip-address:9090# your cacti hosting page will use this port
cmd:[Save + Exit]
cmd:
cmd:vim /etc/apache2/sites-available/cacti.yourdomain.com; create this file
next:[OK] add (copy/past) the following lines
cmd:
copy:
<VirtualHost *:9090>
ServerAdmin sysadmin@yourdomian.com
ServerName cacti.yourdomain.com
DocumentRoot /var/www/cacti
    <Directory /var/www/cacti >
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Order allow,deny
         allow from all
    </Directory>
</VirtualHost>
cmd:[Save + Exit]
cmd:
cmd:ln -s /etc/apache2/sites-available/cacti.yourdomain.com /etc/apache2/sites-enabled/; make this symbolic link
cmd:/etc/init.d/apache2 restart; restart the apache2 service
cmd:
done:[OK] You are done with new configuration; end of Configuration
done:[DONE]


Now, you can access your cacti web-interface with the
URL: http://your-server-ipaddress:9090
After pointing the url to your browser you should see the cacti login page.


(05) Customize Cacti Webpage 'title'

You can customize the Cacti Webpage title (Header Title).
To do that you have to edit the three files auth.php, top_header.php, top_graph_header.php located at /var/www/cacti/include/

Procedure,
Open those files with 'vim' or any other text editor, then find the part <title>cacti</title> and replace only cacti with your own text such as cacti:yourdomain.com or whatever text you want to see as page header title.


(06) References:

Ref-1: http://www.cacti.net/


"make a habit to thank people, and to thank Allah (GOD) ..."
Copyright @ all people of open-source world