Linux Install instructions

Post support questions that directly relate to Linux/Unix operating systems.

Moderators: Developers, Moderators

Post Reply
khutton
Cacti User
Posts: 77
Joined: Tue Jun 18, 2002 9:01 am
Location: Alexandria, Virginia
Contact:

Linux Install instructions

Post by khutton »

This is a document I have written while setting cacti on my Red Hat 7.3 box. I have submitted this to rax for review. I will post this here, its is rather large, so if you want a copy please email me at khutton@yeo.org and I will email you a copy. These work for me, on a fresh box built with these options:

Linux Install notes:

Firewall Settings:
Strong
Allowing SSH and WWW (you will have to edit ipchains to allow snmp communications for Cacti to work)

Overall Packages installed:
Gnome

Minor Packages installed:
Applications/Archiving/unarj
Applications/Archiving/zip
Applications/CPAN/perl (All of them)
Applications/System/bind-utils
Applications/System/firewall-config
Applications/System/iptraf
Development/Libraries/apache-devel
Development/Libraries/glib-devel
Development/Libraries/glibc-devel
Development/Libraries/zlib-devel

Register the system on the RHN and apply all updates.

I hope this will help most of you. If anyone who reviews this document sees something wrong please post to this thread so I can update my documentation and others can read. I am not the strongest Linux person and this box is less than secure. I have it sitting behind a few firewalls and is used on internal equipement so I can afford some lax security. Please watch your systems carefully.

Here is the instruction document:

Download the Following:

Cacti-0.6.8a.tar.gz
MySQL-3.23.54-pc-linux-gnu-i686.tar.gz
php-4.2.3.tar.gz
rrdtool-1.0.35.tar.gz
apache_1.3.27.tar.gz
ucd-snmp-4.2.3.tar.gz (you may not need this if you have snmpget and snmpwalk already on you machine)

Copy all of these to /usr/local/cactisetup

***********************************************************

Installing Apache
from /usr/local/cactisetup
tar zxvf apache_1.3.27.tar.gz (unpacking apache)
mv apache_1.3.27 apache (renaming the apache directory to apache)
cd apache
./configure --prefix=/www --enable-module=so
make
make install
cd ..

***********************************************************

Installing PHP
cd /usr/local/cactisetup
tar zxvf php-4.2.3.tar.gz (unpacking php)
mv php-4.2.3 php4 (renaming the php directory to php4)
cd php4
./configure --with-mysql --with-apxs=/www/bin/apxs
make
make install

Copy and Edit php.ini
cp php.ini-dist /usr/local/lib/php.ini
cd /usr/local/lib
pico php.ini
change Register_Globals=On and Register_argc_argv=On
save edits

Now to create the php command line application
cd /usr/local/cactisetup/php4
./configure --with-mysql
make
make install
php binary should be in /usr/local/cactisetup/php4/ (You will be asked for this in the initial setup of Cacti)


***********************************************************

Edit httpd.conf
cd /www/conf
pico httpd.conf
edit your servername to reflect proper name and add thes lines
AddType application/x-httpd-php .php
LoadModule php4_module libexec/libphp4.so
Edit DocumentRoot to /www/htdocs/cacti/
Edit DirectoryIndex to index.php
save edits

***********************************************************

Start web server
cd /www/bin
./apachectl start

test your webserver

You should get the Apache default page if all is well. If you do not please refer to the Apache documentation for any errors. If you have installed Gnome on you Linux installation then you should have a GUI configuration utility for Apache. If you run this it will overwrite any changes made to httpd.conf by hand. I suggest you edit it by hand. The documentation for Apache is very good, download it.

***********************************************************

Starting Apache at boot
cd /etc
pico rc.local
add the line
/www/bin/apachectl start &
save changes

***********************************************************

Unpacking Cacti
tar zxvf Cacti-0.6.8a.tar.gz (unpack cacti)
mv cacti-0.6.8a /www/htdocs/cacti (rename and move cacti-0.6.8a to /www/htdocs/cacti)
cd /www/htdocs
chown -R nobody:nobody /www/htdocs/cacti (this allows the webserver to show your cacti dir)

***********************************************************

Unpacking rrdtool
tar zxvf rrdtool-1.0.35.tar.gz
mv rrdtool-1.0.35 rrdtool

Setting up rrdtool
cd /usr/local/cactisetup/rrdtool
./configure
make
make install

rrdtool will be installed to /usr/local/rrdtool-version#

**********************************************************

Unpacking MySQL
tar zxvf mysql-3.23.54-pc-linux-gny-i686.tar.gz (unpack mysql)
mv mysql-3.23.54-pc-linux-gnu-i686 /usr/local/mysql (rename and move the mysql directory to mysql)

Setting up mysql
groupadd mysql
useradd -g mysql mysql (this is the user that will run MySQL)
cd /usr/local/mysql
scripts/mysql_install_db
chown -R root .
chown -R mysql data
chgrp -R mysql .
./bin/safe_mysqld --user=mysql &
./mysql -u root mysql
mysql> SET PASSWORD FOR root@localhost=PASSWORD('newpassword'); (sets password for root mysql user not root linux user, like sa account on other DB's)
exit

To start the server at boot time add this line to /etc/rc.local

/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld --user=mysql &'

Reboot machine to test the installation of mysql
once the server has rebooted

cd /usr/local/mysql/bin
./mysqladmin --user=root -pnewpassword version

if you get the version screen from mysql, the server started at boot


*********************************************************

installing Cacti tables in mysql
from /usr/local/mysql/bin/
./mysqladmin --user=root -pnewpassword create cacti
./mysql -u root -pnewpassword cacti < /www/htdocs/cacti/cacti.sql

Create a MySQL username and password for Cacti
./mysql --user=root -ppassword
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';
flush privileges;
exit

Edit /www/htdocs/cacti/include/config.php

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

cd /etc
pico crontab
add this line
*/5 * * * * * cactiuser /usr/local/cactisetup/php4/php www/htdocs/cacti/cmd.php > /dev/null 2>&1

***********************************************************

Upon completing these instructions you should have a functioning site. Most of the scripts will not work right off the bat for Red Hat 7.3. The ping script needs to be changed and you will get some errors when you run cmd.php due to some of the scripts. If you have questions please post on the discussion groups at www.raxnet.net. PLEASE BE SURE TO SEARCH FOR YOUR ANSWER BEFORE YOU ASK A QUESTION!!!!!!!!!!!!
User avatar
bulek
Cacti Pro User
Posts: 854
Joined: Mon May 20, 2002 2:07 am
Location: Poland
Contact:

Post by bulek »

Great step by step installation guide! I bet many people (especialy newbies) were waiting for such document. I have one question. What are the benefits of compiling ucd-snmp, apache, php and mysql instead of installing standard RH rpm packages?

- bulek
khutton
Cacti User
Posts: 77
Joined: Tue Jun 18, 2002 9:01 am
Location: Alexandria, Virginia
Contact:

Post by khutton »

To be honest, I never tried to install with RPM. Doing it the hard way, I learned how MySQL, PHP, SNMP et all..... worked. I learned how to make and install applications on my system. I think the knowledge will be invaluable in making me a better linux admin. As I said, I am not the strongest Linux person but I want to get there. I use RHN to install the RPM's for the basic OS, for times sake, but in trying to write these directions and help others, along with my own learning, I felt it better to install using compilation. As with anything done on Linux, you can usually do it 10 ways to Sunday, or is it 7. :P I thought in the long run this would be more beneficial.

The realized benefits are size and customization. For example, if I want to keep Apache small I only need to compile what my system will use. If I want to add some feature later I can just add it by recompiling. I don't have to rely on the RPM I can just read the manual and use the options I need. It makes the system so much more flexible.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests