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-utils2. 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.repo2.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=12.3 Save and run :
shell> yum install perl-rrdtool rrdtool3. 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/html4. Create the MySQL database: (Check MySQL Root password from /usr/local/directadmin/scripts/setup.txt)
shell> mysqladmin --user=root --password=password create cacti5. 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.sql6. 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.phpChange 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 cacti9. Add a line to your /etc/crontab file similar to:
shell> nano -w /etc/crontabCopy and paste following code:
*/5 * * * * webapps /usr/local/php5/bin/php-cgi /var/www/html/cacti/poller.php > /dev/null 2>&110. 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.iniBy default, DirectAdmin comes with 128Mb, so, no need to do anything here.
memory_limit=128m11. 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 installedIf 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.1If 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.php5Add a following line :
"--with-snmp"Then recompile PHP :
shell> cd /usr/local/directadmin/custombuild
shell> ./build php n12. 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.logshell> nano -w /usr/local/directadmin/custombuild/configure/ap2/configure.php5Add "--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
Comments
no graphs showing
i followed these instructions and all appears to go well, except that graphs aren't showing.....
Try -> yum install
Try -> yum install liberation-fonts.noarch
Then, see if it works or not.
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
Great!
Great :D
Thanx for the explaination!
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
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
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.
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.
Post new comment