[HOWTO] Install Cacti on Fedora and CentOS using yum *FIXED*

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

chris.y2k.r1
Posts: 31
Joined: Tue Mar 07, 2006 11:39 pm

[HOWTO] Install Cacti on Fedora and CentOS using yum *FIXED*

Post by chris.y2k.r1 »

I had the worst time figuring out how to install Cacti without using the custom compilations that are specified in Lee Carter's Linux Install instructions. While Lee's instructions are quite thorough and do work if followed to the letter,like many other's have found, if you use the custom install commands, nothing else you install using Fedora's "yum install" command is compatible with the cacti installation. This makes installing something like SSL, Sendmail or Postfix in conjunction with cacti a cumbersome task to say the least. As a result of these complications, I set out to find a simple way to install Cacti so that it conforms to the standard Fedora libraries and configuration file requirements. This facilitates simple and easy integration of other services (also using "yum install [software]) with Cacti as well as simplifying the notoriously convoluted custom installation of Cacti itself. The benefits of this process are two fold. As previously stated, it simplifies the installation of cacti as well as conforming to standards that enable all types of software to easily integrate and communicate with cacti utilizing the beloved "yum install ..." method.

Next you will find these installation ins ructions. Please feel free to provide any feedback in the case I may have omitted a step, etc. I am human and I am writing this documentation post a successful install as opposed to during. So, please feel free to spout out any constructive criticism you may have as well as any additional pointers that may help smooth out the process.

Enjoy!!

Chris

P.S. - MODS Perhaps this should be stickied? I take no offense if you disagree...?


The following instructions assume you are running a Fedora installation where the install "everything" option was selected. This will install everything needed to run Cacti except Cacti itself and net-snmp. If you have NOT installed "everything" then make sure to use yum to install PHP, MYSQL, HTTP (If you want HTTPS access then do this: "yum install httpd mod_ssl openssl" as root now), SNMP and RRD TOOL. If you did install "everything" during the Fedora installation then all of these (including SSL) will already be installed.


1.) As root:

yum install cacti

Check to see if net-snmp is installed on your system. If not:

yum install net-snmp

2.) Modify Cacti.conf to allow some users to log in. It's installed and defaulted to 'deny all' (gedit /etc/httpd/conf.d/cacti.conf)

I simply changed it to allow all from deny all.

**** UPDATE 12/20/2010 *****

There is a script in the cacti directory called cacti.sql. This has to be run before setting up additional mysql stuff. You can run it afterwards but it is more of a PIA when the users and permissions have been assigned. If you do it before hand it doesn't neesd a user or password. So... do this:

cd (to cacti directory if yours is different - should be close to ) /var/www/cacti

msqyl cactidb < cacti.sql



3.) Change php.config to reflect the true location of the binary, 'php'. Standard FC4 location is /usr/bin/php. Add the MYSQL database name, localhost, user name, password values to this file as well. (See http://www.cacti.net/downloads/docs/con ... How-To.pdf for detailed cacti/MYSQL configuration procedures)

4.) Create the MYSQL cacti database in accordance with the cacti installation instructions at http://www.cacti.net/downloads/docs/con ... How-To.pdf make sure to create a user for the cacti database (I used database name: cactidb, server name: localhost, user name: cacti, password cactipw) and grant access (R/W/E) to this user as well as to root.

***** ADDED 12/20/2010 *****

4.5) Run the cacti.sql script that is in the cacti directory - for me its in /var/www/cacti

mysql cactidb <cacti.sql -u cactiuser -p

You will be prompted for the cactiuser password which is cactipw if you followed step 4 to the letter - otherwise use whatever password you designated. This will fix the problem for folks having blank log in screens - for most of you anyway.

In CentOS, despite the http cacti.conf file being correct for Alias for the cacti directory doesn't work - meaning, when you try to login into cacti with your browser - http/apache doesn't find the cacti directory. I just created a symbolic link in /var/www/html called cacti that pointed to /var/www/cacti and that worked. This was in CentOS which has a root web directory of /var/www/html instead of /var/www which many flavors of linux use. If you are getting a 404 error from your browser this is probably this problem.

***** END OF ADDED 12/20/2010 *****

5.) yum install net-snmp

6.) Make sure the user created for MYSQL (in my case 'cacti') has permissions to write to /usr/share/cacti/rra and /usr/share/cacti/log

7.) Using an Internet browser open: localhost/cacti and follow the instructions. If you followed these instructions exactly, the program paths displayed by the initial page will be correct.

*Be aware that there are two (2) cacti directories on a Fedora Core 4 installation using the yum install method. One exists in /var/www/html/cacti and the other in /usr/share/cacti. /usr/share/cacti is the directory in which configuration changes should be made. The previously mentioned directory houses the php and html pages that make up the cacti user/administrative interface.

This method makes adding Thold notifications very simple. Just see the thread on installing THold in this forum and use "yum install postfix" to get email notifications for downed or overloaded devices. Much simpler to integrate other services with this type of (yum) install.


Feel free to question/comment: chris_y2k_r1@yahoo.com - Don't bother I never check it anymore cos yahoo sucks.
Last edited by chris.y2k.r1 on Mon Dec 20, 2010 1:53 pm, edited 1 time in total.
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Moved to Information/HowTo's
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
chris.y2k.r1
Posts: 31
Joined: Tue Mar 07, 2006 11:39 pm

Post by chris.y2k.r1 »

rony wrote:Moved to Information/HowTo's
Damn you guys are on top of it! Moved it to the right place in less then 10 minutes - strong work bro, strong work!

:D
;)
Last edited by chris.y2k.r1 on Thu Apr 06, 2006 10:05 am, edited 1 time in total.
chris.y2k.r1
Posts: 31
Joined: Tue Mar 07, 2006 11:39 pm

Post by chris.y2k.r1 »

Everyone - If you use this documentation and find something omitted / misspelled command(s) / something incorrect, please let us know!!

P.S. - If it works well for you, let us know that too :D


Thanks!!
Chris
praddie
Posts: 1
Joined: Sat May 20, 2006 4:08 am

Post by praddie »

Thanks Chris got Cacti working by following the instructions given by u. thanks again.
chris.y2k.r1
Posts: 31
Joined: Tue Mar 07, 2006 11:39 pm

Post by chris.y2k.r1 »

praddie wrote:Thanks Chris got Cacti working by following the instructions given by u. thanks again.
Excellent - My pleasure!
new-to-linux
Posts: 9
Joined: Thu Jun 29, 2006 2:03 pm

Please Help

Post by new-to-linux »

Thanks Chris for the giude. I have followed most of it but am now a bit lost. I am new to linux so please forgive me if I sound liike I am dumb.
I have yum rrd tool and cacti and and at the stage where you mention I need to modify the php.config file I can not find this file so I presume this is the config.php file ??
Also you mention I need to create the cacti database but when I reference the pdf it talks about the cacti.sql file should I down load the source to get this file to create my database??.
My installation does not seem to have the two directories you mentioned I have usr/share/cacti but do not have the var/www/html/cacti one

Thanks for any help you can give
markz
Posts: 2
Joined: Thu Jun 29, 2006 10:16 pm

Post by markz »

I must admit I was completely lost on the install too, Fedora core 5. I did not have rrdtool installed and when I downloaded it and tried make it said there were problems with freetype, libpng and libart_lgpl even though I had these installed.

So I used

Code: Select all

yum install rrdtool 
and that worked fine.

Then I tried to follow the instructions at
I started with http://www.cacti.net/downloads/docs/htm ... _unix.html
(and the instructions that come with the download)
All fine until the Step 7
*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1
how was /var/www/html/cacti created? How did the http server know about it?
Answer it didn't. I had unzipped my download to /opt and tried copying a few things around and setting up directories and chaning the http conf. No joy.

So then used

Code: Select all

yum install cacti 
-- no problems.
But now could not connect to database.
After rummaging around found include/db.php
OK so now I can connect to database and get a web page.
But what do I log on as? admin/admin of course -- I suppose that is also written down somewhere but I hadn't seen it.

Looks a great product but it would be good if people could find a reliable install guide without too much hassle, as once again I wasted a lot of time as I thought the link from the home page for a Linux install was the way to go.

So I suppose the easiest way to install is to use yum, but then you must also download from the cacti tar from the site to get the sql file to populate the tables in the database?

Regards

Mark
markz
Posts: 2
Joined: Thu Jun 29, 2006 10:16 pm

Post by markz »

Well if you do yum installs the cacti.sql will of course be available from the rpm install, so no need for the download of the tar.

The only problem being, that you may not have installed mysql by an rpm. It seems to want to look for /var/lib/mysql/mysql.sock. Is the location of mysql.sock configurable? Otherwise a symbolic link.
new-to-linux
Posts: 9
Joined: Thu Jun 29, 2006 2:03 pm

Thanks Mark

Post by new-to-linux »

In the end I uninstalled the cacti version I installed via yum.

Downloaded the rpm version from the cacti site and yum that, finished off the install following the documentation that came with the cacti rpm. Now all is good an I am up and running.

The version I received via yum was a alpha version so not sure if that was the problem, The version I got off the cacti site was for a I386 machine and this work for me.

I was doing this on a fedora core 4 install with most options installed and before installing cacti i yum rrdtool and net-snmp.
natter
Posts: 3
Joined: Thu Jul 26, 2007 3:04 pm

Post by natter »

I come from the apt-get world. How do I get rrdtool and cacti into the yum repository? Thanks, Eric

[root@monitor yum.repos.d]# yum install rrdtool
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
Parsing package install arguments
Nothing to do

[root@monitor yum.repos.d]# yum install cacti
Loading "installonlyn" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Nothing to do
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I'm runnding FC6 and got it using

Code: Select all

[extras]
name=Fedora Extras - $releasever - $basearch
baseurl=http://download.fedora.redhat.com/pub/fedora/linux/extras/6/$basearch/
gpgcheck=0
gpgkey=http://download.fedora.redhat.com/pub/fedora/linux/extras/RPM-GPG-KEY-Fedora-Extras
Reinhard
natter
Posts: 3
Joined: Thu Jul 26, 2007 3:04 pm

Post by natter »

Sweet, got it.

Added this to my /etc/yum.repos.d/CentOS-Base.repo file:

[extras2]
name=Fedora Extras - $releasever - $basearch
baseurl=http://download.fedora.redhat.com/pub/f ... $basearch/
gpgcheck=0
gpgkey=http://download.fedora.redhat.com/pub/f ... ora-Extras

Then ran a 'yum update'

Then 'yum install cacti'

All done. Thanks for the help Gandalf!
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

natter wrote:...
Then 'yum install cacti'
...
Oops. While I'm using yum for almost everything, I do NOT use it for installing cacti.
First, because patches are published too late.
Second, because I HATE accidentally upgrading my cacti (mainly due to installation postprocessing issues that yum will not cope with).
Third, yum install will bring you some /etc/cron.d/cacti crontab; if you add cacti to /etc/crontab, you will run into trouble, then.

Surely, your mileage may vary
Reinhard
natter
Posts: 3
Joined: Thu Jul 26, 2007 3:04 pm

Post by natter »

So, after I did my install, should I not have un-commented the /etc/cron.d/cacti job?

*/5 * * * * cacti /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests