INSTALL:

    1. Create the MySQL database:

 shell> mysqladmin --user=root create cacti

    2. Import the default cacti database:

 shell> mysql cacti < cacti.sql

    3. 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;

    4. 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 = "somepassword";

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

 */5 * * * * cactiuser php /var/www/htdocs/cacti/poller.php > /dev/null 2>&1

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

    6. 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.

POST-INSTALL
#!/bin/sh

# change according your root password for mysql
pw=password

mysqladmin --user=root --password=$pw --force drop cacti 
mysqladmin --user=root --password=$pw create cacti
mysql --user=root --password=$pw cacti < /var/www/htdocs/cacti/cacti.sql

echo "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY '${pw}'" | mysql --user=root --password=$pw cacti
echo "flush privileges" | mysql --user=root --password=$pw cacti

sed -i -e "s|\$database_password = \"cacti\";|\$database_password = \"${pw}\";|g" /var/www/htdocs/cacti/include/config.php

