How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04

**Edit: updated to install latest version available since the 1.1.x versions are frequently being updated.
**Edit2: Added upgrade procedure at the bottom.

With the release of 1.0 and it not existing the the Ubuntu repo’s, I found no directions that helped with the install. During several failed attempts, I finally found the right match of dependencies and libraries needed to install both Cacti and Spine versions 1.0. and up.
Most all of these commands require root permissions and were written to be preformed by a root user. You can elevate the local users permissions by running sudo -s if permitted. Use caution when running commands with root privileges.

 

Installing Cacti

1. Install dependencies

apt install apache2 php libapache2-mod-php php-mcrypt php-mysql php-snmp php-xml php-ldap php-mbstring php-gmp snmp php-gd rrdtool mysql-server libssl-dev

 

2. Create a new user for cacti

useradd cactiuser

 

3. Add the timezone tables to the MySQL database

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

 

4. Access the MySQL interface

mysql -u root -p

 

5. Create the cacti database, user, and set permissions.

create database cactidb;
CREATE USER 'cactiuser'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL ON cactidb.* TO 'cactiuser'@'localhost'; 
GRANT SELECT ON `mysql`.`time_zone_name` TO 'cactiuser'@'localhost';
flush privileges;
exit

 

6. Download and extract the Cacti package

cd /opt/
wget http://www.cacti.net/downloads/cacti-latest.tar.gz
ver=$(tar -tf cacti-latest.tar.gz | head -n1 | tr -d /)
tar -xvf cacti-latest.tar.gz && mv $ver cacti

 

7. Import the cacti database file

mysql -u root -p cactidb < /opt/cacti/cacti.sql

 

8. Configure cacti to access the database

nano /opt/cacti/include/config.php

 

Edit the following to match your install

$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "<password>";
$database_port = "3306";
$database_ssl = false;

 

9. Change permissions to the cacti directory

chown -R www-data:www-data /opt/cacti/

 

10. Change permissions to the rra and log directories

chown -R cactiuser /opt/cacti/rra/ /opt/cacti/log/ /opt/cacti/cache/

11. Create a link for the cacti web directory

ln -s /opt/cacti/ /var/www/html/cacti

 

12. Restart MySQL

systemctl restart mysql

13. Restart Apache

systemctl restart apache2

14. Add the poller to cron.

echo "*/5 * * * * cactiuser php /opt/cacti/poller.php > /dev/null 2>&1" > /etc/cron.d/cacti

15. Connect to the website.

http://<ip address>/cacti

16. Follow the directions on the web page. You may need to alter some MySQL „minimum“ settings for Cacti. The items that need to be changed will be in red text and >= value will be provided. These values may very from machine to machine but this can be used as a template.

*Edit: default-time-zone added. Reference MySQL docs for assistance: https://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html

mv /etc/mysql/my.cnf /etc/mysql/my.cnf-bkup
echo "
[mysqld]

max_heap_table_size = 1073741824
max_allowed_packet = 16777216
tmp_table_size = 134217728
join_buffer_size = 134217728
innodb_buffer_pool_size = 4294967296
innodb_doublewrite = OFF
innodb_flush_log_at_timeout = 10
innodb_read_io_threads = 32
innodb_write_io_threads = 16
default-time-zone = 'America/New_York'
" > /etc/mysql/my.cnf

17. Restart MySQL

systemctl restart mysql

18. Restart Apache

systemctl restart apache2

19. Refresh your browser window or navigate back to your Cacti installation

http://<ip address>/cacti

Cacti is now installed. Continue on to install Spine
––––––––––––––––––

Installing Spine

1. Install dependencies

apt install libmysqlclient-dev libssl-dev libmysqlclient-dev libsnmp-dev help2man

2. Download spine

cd /opt/
wget http://www.cacti.net/downloads/spine/cacti-spine-latest.tar.gz

3. Extract the package and enter directory

ver=$(tar -tf cacti-spine-latest.tar.gz | head -n1 | tr -d /)
tar -xvf /opt/cacti-spine-latest.tar.gz
cd /opt/$ver/

4. Configure

./configure

5. Make

make

6. Make install

make install

*Optional* Spine is installed into the /usr/local/spine/bin directory which is not part of the system path. If you want to verify that the install worked, you will have to use the full directory.

/usr/local/spine/bin/spine --version

You should get this in return:

SPINE 1.0.? Copyright 2004-2017 by The Cacti Group

7. Edit the spine configuration file

nano /usr/local/spine/etc/spine.conf.dist

Modify this part of the file to match your servers settings

DB_Host localhost
DB_Database cactidb
DB_User cactiuser
DB_Pass <password>
DB_Port 3306

The rest of the setting will have to be made via the web interface.

8. Go to Configuration -> Settings and click on the Paths tab.

Under the Alternate Poller Path, set the following:

Spine Binary File Location = /usr/local/spine/bin/spine
Spine Config File Path = /usr/local/spine/etc/spine.conf.dist

Click Save at the bottom right.

9. Last is to make spine the active poller. Switch to the Poller tab and click on the drop down menu for Poller Type.
Select spine
Click save in the bottom right.

Your Cacti and Spine installation is now complete.

###################################################################################

Вашият коментар

Вашият имейл адрес няма да бъде публикуван. Задължителните полета са отбелязани с *

Този сайт използва Akismet за намаляване на спама. Научете как се обработват данните ви за коментари.