Sunday, October 21, 2007

Installing Cacti Under Unix

1. Extract the distribution tarball.

shell> tar xzvf cacti-version.tar.gz


2. Create the MySQL database:

shell> mysqladmin --user=root create cacti


3. Import the default cacti database:

shell> mysql cacti < cacti.sql


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

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


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

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


6. Set the appropriate permissions on cacti's directories for graph/log generation. You should execute these commands from inside cacti's directory to change the permissions.

shell> chown -R cactiuser rra/ log/
(Enter a valid username for cactiuser, this user will also be used in the next step for data gathering.)



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

*/5 * * * * cactiuser php /var/www/html/cacti/poller.php > /dev/null 2>&1
Replace cactiuser with the valid user specified in the previous step.

Replace /var/www/html/cacti/ with your full Cacti path.



8. Point your web browser to:

http://your-server/cacti/

Log in the 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.

------
Upgrading Cacti


1. Backup the old Cacti database.

shell> mysqldump -l --add-drop-table cacti > mysql.cacti
Note: You will probably have to specify the -u and -p flags for the MySQL username and password. This user must have permission to read from Cacti's database or you will end up with an empty backup.



2. Backup the old Cacti directory.

shell> mv cacti cacti_old



3. Extract the distribution tarball.

shell> tar xzvf cacti-version.tar.gz



4. Rename the new Cacti directory to match the old one.

shell> mv cacti-version cacti



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

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



6. Copy the *.rrd files from the old Cacti directory.

shell> cp cacti_old/rra/* cacti/rra/



7. Copy any relevant custom scripts from the old Cacti directory. Some script are updated between versions. Therefore, make sure you only over write if the scripts either don't exist or are newer than the distribution's.

shell> cp -u cacti_old/scripts/* cacti/scripts/


8. Copy any relevant custom resource XML files from the old Cacti directory. Some resource XML files are updated between versions. Therefore, make sure you only over write if the XML files either don't exist or are newer than the distribution's.

shell> cp -u -R cacti_old/resource/* cacti/resource/



9. Set the appropriate permissions on Cacti's directories for graph/log generation. You should execute these commands from inside Cacti's directory to change the permissions.

shell> chown -R cactiuser rra/ log/
(Enter a valid username for cactiuser, this user will also be used in the next step for data gathering.)



10. Point your web browser to:

http://your-server/cacti/

Follow the on-screen instructions so your database can be updated to the new version.

No comments:

Post a Comment