Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Sat Aug 19, 2017 1:44 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Tue Feb 07, 2017 2:57 pm 
Offline

Joined: Tue Feb 07, 2017 12:25 pm
Posts: 2
**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.

Items in blue can be modified to the installers preference.
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
Quote:
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
Quote:
useradd cactiuser

3. Add the timezone tables to the MySQL database
Quote:
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql

4. Access the MySQL interface
Quote:
mysql -u root -p

5. Create the cacti database, user, and set permissions.
Quote:
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
Quote:
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
Quote:
mysql -u root -p cactidb < /opt/cacti/cacti.sql

8. Configure cacti to access the database
Quote:
nano /opt/cacti/include/config.php

Edit the following to match your install
Quote:
$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
Quote:
chown -R www-data:www-data /opt/cacti/

10. Change permissions to the rra and log directories
Quote:
chown -R cactiuser /opt/cacti/rra/ /opt/cacti/log/ /opt/cacti/cache/

11. Create a link for the cacti web directory
Quote:
ln -s /opt/cacti/ /var/www/html/cacti

12. Restart MySQL
Quote:
systemctl restart mysql

13. Restart Apache
Quote:
systemctl restart apache2

14. Add the poller to cron.
Quote:
echo "*/5 * * * * cactiuser php /opt/cacti/poller.php > /dev/null 2>&1" > /etc/cron.d/cacti

15. Connect to the website.
Quote:
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
Quote:
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
Quote:
systemctl restart mysql

18. Restart Apache
Quote:
systemctl restart apache2

19. Refresh your browser window or navigate back to your Cacti installation
Quote:
http://<ip address>/cacti

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

Installing Spine

1. Install dependencies
Quote:
apt install libmysqlclient-dev libssl-dev libmysqlclient-dev libsnmp-dev help2man

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

3. Extract the package and enter directory
Quote:
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
Quote:
./configure

5. Make
Quote:
make

6. Make install
Quote:
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.
Quote:
/usr/local/spine/bin/spine --version

You should get this in return:
Quote:
SPINE 1.0.? Copyright 2004-2017 by The Cacti Group

7. Edit the spine configuration file
Quote:
nano /usr/local/spine/etc/spine.conf.dist

Modify this part of the file to match your servers settings
Quote:
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:
Quote:
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.

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

Upgrading

Along with the modification of the install due to the frequent releases, I also create a simple copy/paste upgrade process. This process is based on the install above so use caution if you installed in any other way. I have this saved in a txt doc with my own db/user/pass options set and just copy/paste every time I need to upgrade.

Be sure not to skip release versions. You must update all in order. Some updates have db changes and if those are skipped, later updates may fail. If you need to install a specific version, find and replace "latest" with the version number. (changing cacti-latest.tar.gz to this cacti-1.1.6.tar.gz)

Systems and installs very but I am able to preform the complete upgrade in between my 5 minute polls. This allows for no "missing" data.

Quote:
#Download latest version from www.cacti.net

cd ~/
rm cacti-latest.tar.gz | rm –r cactin #removes any previous files that may have a name conflict with the new file.
wget http://www.cacti.net/downloads/cacti-latest.tar.gz
ver=$(tar -tf cacti-latest.tar.gz | head -n1 | tr -d /) #getting the version number
tar -xvf cacti-latest.tar.gz && mv $ver cacti #extracting the file and renaming the directory
chown -R www-data:www-data ~/cacti/ #changing the owner of the new directory
chown -R cactiuser ~/cacti/rra/ ~/cacti/log/ ~/cacti/cache/ #changing the owner of specific sub-directories
systemctl stop mysql apache2 #stopping the services
sed -ie "s/\$database_username =.*;/\$database_username = 'cactiuser';/g" ~/cacti/include/config.php
sed -ie "s/\$database_password =.*;/\$database_password = 'cactipassword';/g" ~/cacti/include/config.php
sed -ie "s/\$database_default =.*;/\$database_default = 'cactidb';/g" ~/cacti/include/config.php
cp -r cacti/* /opt/cacti/ #copy the new files into your cacti directory
systemctl start mysql apache2 #starting services

#Upgrading Spine

cd /opt/
rm –r cacti-spine-* | rm cacti-spine-latest.tar.gz #removes any previous files that may have a name conflict with the new file.
wget http://www.cacti.net/downloads/spine/cacti-spine-latest.tar.gz
ver=$(tar -tf cacti-spine-latest.tar.gz | head -n1 | tr -d /) #getting the version number
tar -xvf /opt/cacti-spine-latest.tar.gz #extracting file
cd /opt/$ver/
./configure
make
make install
sed -ie "s/DB_User.*/DB_User cactiuser /g" /usr/local/spine/etc/spine.conf.dist
sed -ie "s/DB_Database.*/DB_Database cactidb /g" /usr/local/spine/etc/spine.conf.dist
sed -ie "s/DB_Pass.*/DB_Pass cactipassword /g" /usr/local/spine/etc/spine.conf.dist
/usr/local/spine/bin/spine --version #showing version for verification


Last edited by ruehlb on Mon May 22, 2017 6:48 am, edited 12 times in total.

Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0.1 on Ubuntu 16.0
PostPosted: Tue Feb 07, 2017 3:03 pm 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2598
Location: Kressbronn, Germany
In Step 16 for the my.cnf (mysql config) you should also add a setting for the timezone. Example:

Code:
default-time-zone='Europe/Berlin'


Otherwise you may be off some hours on the rrd files ( did see this on my Centos test-system. Initial rrd file update was ok, the second one way off )

_________________
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code:
CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061


Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0.1 on Ubuntu 16.0
PostPosted: Fri Feb 10, 2017 7:04 am 
Offline
Cacti User
User avatar

Joined: Mon Jan 05, 2015 10:10 am
Posts: 479
You missed ownership of the cache directory for realtime, snmpagnt, etc (Step 10). Otherwise perfect!

_________________
Before history, there was a paradise, now dust.


Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Tue Feb 28, 2017 1:01 pm 
Offline

Joined: Fri Dec 16, 2016 12:52 pm
Posts: 32
This worked! Cacti 1.0.4 is working for me now................except one small thing. All of the interface pages are blank. See the attached screenshots. All pages, no matter what I click on on the left pane, look exactly like that. Just a blank black field.


Attachments:
blankPages.JPG
blankPages.JPG [ 82.64 KiB | Viewed 9445 times ]
Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Tue Feb 28, 2017 3:16 pm 
Offline

Joined: Fri Dec 16, 2016 12:52 pm
Posts: 32
Also, the my.cnf file only has two 'includes' directories in it. There are no places to change the settings that Cacti calls for.


Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Tue Feb 28, 2017 3:37 pm 
Offline

Joined: Fri Dec 16, 2016 12:52 pm
Posts: 32
I stand corrected. Turns out 1.0.3-4 are not the greatest on Chrome. It works perfectly on IE, Edge, and Firefox. Bad for me, seeing that I'm a primarily Chrome user. :x


Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Tue Feb 28, 2017 11:08 pm 
Offline
Developer

Joined: Thu Apr 07, 2005 3:29 pm
Posts: 2609
Location: B/CS Texas
Its working fine on Chrome for me (I primarily use Chrome for all my developing of Cacti). Please check your javascript console and report any errors you see.

_________________
CactiEZ CD


Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Wed Mar 01, 2017 9:22 am 
Offline

Joined: Fri Dec 16, 2016 12:52 pm
Posts: 32
Console is blank. There are no errors


Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Wed Mar 01, 2017 12:05 pm 
Offline

Joined: Fri Dec 16, 2016 12:52 pm
Posts: 32
Yup. My bad. Chrome does work. It was an extension I had that was messing with it.


Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Tue Apr 25, 2017 2:19 pm 
Offline
Cacti User

Joined: Fri Sep 14, 2007 12:43 pm
Posts: 65
Thanks so much for posting this procedure! Worked well and I had cacti up and running in just a few minutes. Kudos!!


Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Fri Jun 02, 2017 5:50 pm 
Offline

Joined: Mon Jul 27, 2015 10:03 am
Posts: 7
perhaps someone can help me it looks like poller is not running i am on debain 8.8 i add the cron job to it and it only runs manually it wont run automatic i chown my cacti directly with -R www-data.www-data

so i know it ok but i do not understand why is not running

*/5 * * * * cacti php /var/www/html/cacti/poller.php > /dev/null 2>&1
yes that is the location of poller.php

i used cacti 8.8b just fine but i wanted to try this new UI it looks nice but i am not sure what i am doing wrong and the log files are not helpful they only show when i run it manually

any Help


Top
 Profile  
 
 Post subject: Re: How to install Cacti and Spine ver. 1.0 on Ubuntu 16.04
PostPosted: Sat Jul 08, 2017 8:39 pm 
Offline
Cacti User
User avatar

Joined: Mon Jan 05, 2015 10:10 am
Posts: 479
Debian unstable has cacti 1.x package. You should try it.

_________________
Before history, there was a paradise, now dust.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group