Ubuntu Installation Instructions
Requirements
- One linux machine - (can be any depending on your choice try and keep atleast 256mb ram, tested on a 1.4ghz processor and 256 mb ram, with centos as the operating system and with around 350 monitored devices)
- RRDtool - This is the defacto package used by 95% of all NMS tools out on the net for graphing, details can be found at the link given
- Xampp - now the reason i am going in for Xampp is because it lets maintain a lot of things very easily, (the apache webserver - mysql database , php programming language and all needed dependencies) of course we can do it without xampp but you can search for those doc's on the net.
- Ubuntu installation
- The First step now would be to install Linux on our machine, for this example we will download ubuntu ios (or newer). Note: there is a server version of ubuntu which is also available but we will not be going in for that due to lack of gui.
- once downloaded burn it on to a cd and then boot the machine you have decided to make as your server with the same CD
- once the machine boots up, you will notice that is running in live cd mode, i.e the hard disk is not being used, you will find a Install icon on the top left of your screen, double click on it and go ahead with the install, the only problem you might have is during partitioning as we are going in for a separate machine its best that we go in for auto partitioning (a detailed ubuntu install guide is not really possible right now but it can found here
- Also remember to type in your username to be used as deadwait (im taking deadwait just for this example)
- Once ubuntu is installed - all further steps will now occur from within ubuntu itself, the next thing to do is see to it that it is updated, for that we have to have access to the internet hence you network card will have to configured, i hope you remember the root password you had supplied during the installation.
- click on
system --> administration --> network
and in the wired connection tab supply your needed ip address/subnet mask and gateway
- if your internet access is through a proxy then click on
system -> preferences -> network proxy
and supply your proxy server's ip address and port.
- open up a terminal window (Applications -> accessories -> terminal) and type in the foll. commands
sudo aptitude update sudo aptitude install build-essential
. Once the build essential is over you are set to install Xampp, RRDtool and Cacti
- We will begin with Xampp - to know in detail what xampp is check out their website. Now we need to download Xampp for linux directly. This is the current latest version of Xampp as of writing. remember to download it to /opt.
- Now assuming you have downloaded the file in /opt you need to do the foll next. As usual click on
Application -> accessories -> terminal
type in
cd /opt sudo tar -xvzf xampp-linux-1.6.3b.tar.gz
what this does is unzip/unpack the file into its own directory, if you type int the command dir you will now see that a new directory (lampp) has been created, if you want to delete the xampp-linux-1.6.3b.tar.gz file or not is up to you, if you want to delete it the command is
sudo rm -rf xampp-linux-1.6.3b.tar.gz
. What I do is usually move these files in to my home folder, assuming my login name is tulip then my home folder becomes /tulip, the command to move the file is as follows
sudo mv xampp-linux-1.6.3b.tar.gz /tulip
Now for the cool part: in the same terminal type in
cd lampp<sudo ./lampp start
and your webserver along with mysql and ftp will have started, to check the same, open up firefox and type in http://localhost, you should get the Xampp screen.
- Now lets clear some basic stuff we need to do - you see Cacti needs a database which we have already installed using xampp, now what we need to do is create cacti's own database. now since you have opened up http://localhost in firefox, xampp will ask you its language preference, click on english, then on the left pane you will see a link for phpmyadmin, click on it, what you see now is an web based administration tool for MySql, on the first page itself you will see an option named Create Database in the field below type in cacti since this is the name we will use for our database (of course you could name it whatever you want). Then go on to the next step.
- So then, one part of our work is done next thing to do is to install rrdtool. your going to love this, in a terminal box type in the magic commands
sudo aptitude install rrdtool
to install rrdtool (Now for a bit of history, we can install entire cacti along with webserver php and mysql by doing sudo aptitude install cacti, but we havent done that because if you are not comfortable with linux it could lead to a lot of confusion as to where the files are installed, also the package could break if an upgrade takes place)
At the same time lets install one more tool needed which snmp with the same commandsudo aptitude install snmp sudo aptitude install snmpd
What is important to remember is rrdtool gets installed in /usr/bin/rrdtool, we will need this path later.
- Now the cream - cacti installation.
First we need to download the cacti package as stated above. Save e.g. on your Desktop. Then open up a terminal and navigate to your desktop, the commands are (assuming your user login is tulip)cd /home/deadwait/Desktop
Remember linux is case-sensitive so desktop wont work it will be Desktop, once we are in Desktop type in the foll commands
sudo tar -xvzf cacti-0.8.6j.tar.gzsudo mv cacti-0.8.6j cacti
Now that the directory is renamed lets move it in our lampp directory so that we can access it via our webserver, to do so run the foll command
sudo mv cacti /opt/lampp/htdocs
Now our cacti directory is copied on to lampp's webroot directory, remember we had created a database in mysql named cacti, now we need to populate tis database, which you should not worry about if you dont understand, just follow the foll steps
- open up firefox and again go to phpmyadmin
on the left pane select the database which we have created, in our case its cacti. - then on the right pane select import -> then click on browse -> navigate to the directory /opt/lampp/htdocs/cacti in which you have to select the file cacti.sql and then click on go.
- Again in a terminal type in
cd /opt/lampp/htdocs/cacti/include sudo nano config.php
. nano is an editor which will open up the file config.php, in the beginning you will see these options
$database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "cactiuser"; $database_password = "cactiuser"; $database_port = "3306";
You need to change the username and password so that it looks like this
$database_type = "mysql"; $database_default = "cacti"; $database_hostname = "localhost"; $database_username = "root"; $database_password = ""; $database_port = "3306";
Then press ctrl-x and come out.
- Now open up firefox visit cacti
you will be greeted with a screen which will be the beginning of the installation , just click on next - on the next screen you will asked if its a new install, which of course it is, confirm whether the database user and the database name mentioned are correct, click on next
- when we click it shows us the base paths of all needed files we will notice that the path for php is marked in red because the path is wrong the path shown in the installer is
/usr/bin/php
we have to change that to
/opt/lampp/bin/php
and then click finish.
Cacti is now installed.
It will open up to the cacti homepage and ask you a username and password type in
admin
and password as
admin
It will then force you to change the password, type in the new password that you decide on and log in using the new password.
We need to do a bit more stuff, you see cacti works by polling the devices which we set it up for, so lets set the poller for every 5 minutes, open up terminal and type in the foll command
sudo nano /etc/crontab
This will open up the crontab file, now at the end type in the foll.
/5 * * * * deadwait /opt/lampp/bin/php /opt/lampp/htdocs/cacti/poller.php > /dev/null 2>&1
Then press ctrl x and come out now all along we have assumed the username to login to your machine is tulip, hence the tulip is added above, now we need to do one last thing type in the following command in a terminal
sudo chown -R 777 /opt/lampp/htdocs/cacti
Thats its you are done!!! Phew!