User account menu

  • Log in
BXTra.net

Breadcrumb

  • Home
  • Articles
  • Steps how to install Cacti on CentOS 5.2 + DirectAdmin

Steps how to install Cacti on CentOS 5.2 + DirectAdmin

By BXTra | 12:04 AM PDT, Thu September 18, 2008
Software
CentOS
DirectAdmin
Cacti

First of all, I'm not an Linux/DirectAdmin expert. I just played around with them and found the way to do it. I tried to install Cacti on my server but I couldn't find a complete instruction to do it. So, I just gathered all information I found into one place so that it is easier for many others. I hope it can help someone that needs the same thing that I did.

The software I use:

- CentOS 5.2 - 64-bit
- DirectAdmin 1.323 - Custombuild 1.1.13
     - PHP 5 - CGI
     - Apache 2.2
     - MySQL 5
- Cacti 0.8.7b

Package Required by Cacti :

* RRDTool 1.0.49 or 1.2.x or greater
* MySQL 3.23 or greater, 4.0.20d or greater highly recommended for advanced features
* PHP 4.1 or greater, 4.3.6 or greater highly recommended for advanced features

Apache, PHP and MySQL are already installed by DirectAdmin. However, there are 2 required packages which are net-smtp and RRDTool that I need to install.

1. Install net-snmp with this command :

shell> yum install net-snmp net-snmp-utils

2. RRDTool, to compile or using RPM is not easy. It required many other packages. So, what I did is to follow this instruction : Installing RRDTool Using Yum

2.1 Create a file dag.repo under /etc/yum.repos.d :

shell> nano /etc/yum.repos.d/dag.repo

2.2 Then, copy and paste the following code :

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
enabled=1

2.3 Save and run :

shell> yum install perl-rrdtool rrdtool

3. I, then, follow steps from Here. Extract the distribution tarball. Then, move to /var/www/html/cacti

shell> tar xzvf cacti-version.tar.gz
shell> mv cacti-version cacti
shell> mv cacti /var/www/html

4. Create the MySQL database: (Check MySQL Root password from /usr/local/directadmin/scripts/setup.txt)

shell> mysqladmin --user=root --password=password create cacti

5. Import the default cacti database: (cacti.sql is under cacti directory)

shell> cd /var/www/html/cacti
shell> mysql --user=root --password=password cacti < cacti.sql

6. Optional: Create a MySQL username and password for Cacti.

shell> mysql --user=root --password=password
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
mysql> flush privileges;

7. Edit include/config.php and specify the MySQL user, password and database for your Cacti configuration.

shell> cd /var/www/html/cacti/include
shell> nano -w config.php

Change information below :

$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "somepassword";

8. Set the appropriate permissions on cacti's directories. In DirectAdmin, I tried a few users and got 500 Internal Server Error. So, I end up using user webapps and it works great.

shell> cd /var/www/html
shell> chown -R webapps:webapps cacti

9. Add a line to your /etc/crontab file similar to:

shell> nano -w /etc/crontab

Copy and paste following code:

*/5 * * * * webapps /usr/local/php5/bin/php-cgi /var/www/html/cacti/poller.php > /dev/null 2>&1

10. Edit your PHP Config File at /usr/local/etc/php5/cgi/php.ini for DirectAdmin CGI mode to allocate sufficient memory for Cacti:

shell> nano /usr/local/etc/php5/cgi/php.ini

By default, DirectAdmin comes with 128Mb, so, no need to do anything here.

memory_limit=128m

11. If you need to use SNMP with PHP, then, follow these steps :

If you don't have net-snmp-devel installed. Chec it by using "rpm -q net-snmp-devel"

If it's not installed, it will show :

shell> rpm -q net-snmp-devel
package net-snmp-devel is not installed

If it's already installed, it will show :

shell> rpm -q net-snmp-devel
net-snmp-devel-5.3.1-24.el5_2.1
net-snmp-devel-5.3.1-24.el5_2.1

If you want to install, use this command -> "yum install net-snmp-devel" After you've done installing net-snmp-devel, go through steps below to compile it into PHP.

shell> nano -w /usr/local/directadmin/custombuild/configure/suphp/configure.php5

Add a following line :

"--with-snmp"

Then recompile PHP :

shell> cd /usr/local/directadmin/custombuild
shell> ./build php n

12. Point your web browser to:

http://your-server/cacti/

Log in with a username/password of admin. You will be required to change this password immediately. Make sure to fill in all of the path variables carefully and correctly on the following screen.

Below is the Path I used in Cacti :

snmpwalk Binary Path : /usr/bin/snmpwalk
snmpget Binary Path : /usr/bin/snmpget
snmpbulkwalk Binary Path : /usr/bin/snmpbulkwalk
snmpgetnext Binary Path : /usr/bin/snmpgetnext
RRDTool Binary Path : /usr/bin/rrdtool
PHP Binary Path : /usr/local/php5/bin/php-cgi
Cacti Log File Path : /var/www/html/cacti/log/cacti.log

 

If you use CLI Mode, Configuration is below

shell> nano -w /usr/local/directadmin/custombuild/configure/ap2/configure.php5

Add "--with-snmp" into the file. You have to check that it's last line or not. All other lines will end with "\" except last line. It will look like below :

.
.
.
        --enable-magic-quotes \
        --enable-sockets \
        --enable-mbstring \
        --with-snmp
About text formats
  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Anonymous

16 years 2 months ago

Permalink

Great howto!

Great howto! More people should write them this way :) One addition though: It's recommended to run "build update_script" and "build update_data" before trying to rebuild php.
  • Reply

Anonymous

16 years 1 month ago

Permalink

Lost me on step 3

In step three you say "3. I, then, follow steps from Here. " ..... this is a link to the general documentation page, which steps did you follow from this site? I installed using these instructions with no luck
  • Reply

BXTra

16 years 1 month ago

Permalink

In reply to Lost me on step 3 by Anonymous

I believe there is some

I believe there is some change on the page I've referred to. However, when I put such link, I just want to give the credit to where I got information. So, you don't need to go into that link. Just follow all the steps on my page. It should work fine.
  • Reply

Anonymous

15 years 9 months ago

Permalink

great guide thank you!

For Step 9, I am using CentOS 5.3 without DirectAdmin I've just use root user, and php was installed via yum so my php-cgi is at /usr/bin/cgi Your setup: */5 * * * * webapps /usr/local/php5/bin/php-cgi /var/www/html/cacti/poller.php > /dev/null 2>&1 My setup: */5 * * * * root /usr/bin/php-cgi /var/www/html/cacti/poller.php > /dev/null 2>&1
  • Reply

Anonymous

15 years 5 months ago

Permalink

Great!

Great :D Thanx for the explaination!
  • Reply

Anonymous

15 years 4 months ago

Permalink

hi

yours setup: */5 * * * * root /usr/bin/php-cgi /var/www/html/cacti/poller.php > /dev/null 2>&1 my */5 * * * * root /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1
  • Reply

Anonymous

15 years 3 months ago

Permalink

no graphs showing

i followed these instructions and all appears to go well, except that graphs aren't showing.....
  • Reply

BXTra

15 years 2 months ago

Permalink

In reply to no graphs showing by Anonymous

Try -> yum install

Try -> yum install liberation-fonts.noarch Then, see if it works or not.
  • Reply

Pinoy

13 years 6 months ago

Permalink

Make sure PHP exec function

Make sure PHP exec function is not disabled in the php.ini file.
  • Reply
  • Add new comment

  • Will the router get the Openvpn as a client option?
    6 years ago
  • cancellation
    6 years 1 month ago
  • Router ASUS RT-N12 D1 tomatoes passwort falsch
    7 years 8 months ago
  • WPS button = 30/30/30 hard reset button
    7 years 9 months ago
  • Save my day!
    8 years 3 months ago
  • How to
    8 years 6 months ago
  • Can i still access my modem (the one with the ISP provided)?
    8 years 6 months ago
  • A saving step!
    8 years 10 months ago
  • Problem with Asus n12e-c1
    8 years 11 months ago
  • don't use Hostgator
    9 years 2 months ago

© 2007 - 2023 BXTra.net. All Rights Reserved. 
Certain other content, photos and artwork displayed on BXTra.net are protected by copyright and are the property of their respective owners.

Privacy Policy