Cacti 0.8 Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action – installing Spine

  1. You now need to prepare the development environment for Spine. On CentOS you can do this by issuing the following command:
    yum install gcc mysql-devel net-snmp-devel autoconf automake libtool
    
    Time for action – installing Spine
  2. Download the spine source code. For this, go to http://www.cacti.net and click on Download under the Spine (Cactid) section. Right-click on Spine Source in the tar.gz format and copy the link address.
  3. Navigate to /tmp/ and issue the following command:
    wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.7g.tar.gz
    
  4. Extract the file:
    tar –xzvf cacti-spine-0.8.7g.tar.gz
    
  5. Navigate to the newly created cacti-spine-0.8.7g directory.
  6. Prepare the directory for compilation. Please note that this step may not work on other distributions, or additional steps need to be taken to accomplish it:
    ./bootstrap
    
  7. Configure the compiling environment:
    ./configure
    
  8. Compile Spine:
    make
    
  9. Once the make command finishes, install Spine:
    make install
    
  10. You now have Spine installed, but it needs to be configured. Therefore, copy the sample configuration file to a location where Spine will find it:
    cp /usr/local/spine/etc/spine.conf.dist /etc/spine.conf
    
  11. Edit the file in vi:
    vi /etc/spine.conf
    
  12. Change the database configuration to match the settings from earlier.
  13. Create a symbolic link in /sbin to the spine binary:
    ln -s /usr/local/spine/bin/spine /sbin/spine
    

What just happened?

You just set up a basic development environment for compiling Spine, compiled it, and then installed it. You also configured Spine to use the correct database information.

Tip

Compiling Spine on other Linux distributions

When compiling Spine on other Linux distributions such as Ubuntu, you will have to go through some additional steps. Look at the following URL for more information on how to do so:

http://docs.cacti.net/manual:087:1_installation.1_install_unix.6_install_and_configure_spine.

Differences between source and APT/Yum installations

The main difference between installing Cacti from source and using APT/Yum-based installations is the location of configuration files and availability of patches. Cacti, by default, does not follow the Filesystem Hierarchy Standard (FHS) defined for the Linux operating systems. The FHS defines directories where applications should add their configuration or log files. APT/Yum-based installations usually follow this standard. Due to this, add-ons such as the Plugin Architecture may not be available on all platforms using APT/Yum.

The main advantage of using APT/Yum-based installations is the ease of installation but as we've just seen, installing Cacti isn't very difficult.

However, the disadvantage of using APT or Yum is the availability of newer Cacti versions. Source-based Cacti installations can be upgraded to the latest version as soon as it is available on the Cacti website, while APT/Yum-based installations might need to wait until the package maintainers update their repositories.

Have a go hero – remote server for database hosting

Here is a little challenge for you. It's not difficult but it will allow you to alter the installation to suit your needs. What if you want to use a remote database server? Maybe you want to use an existing dedicated MySQL server, instead of hosting the database on the same system as Cacti, or you want to separate the roles to allow more growth. Can you figure out what to change?

Solution: Create the MySQL database on the remote system using the same command as if you were installing it locally, but this time use the -h <hostname> option to specify the remote server. When creating the user and granting it permissions, use the following command, assuming the Cacti server has the IP '192.168.0.10':

GRANT ALL ON cacti.* TO cactiuser@'192.168.0.10' IDENTIFIED BY 'MyV3ryStr0ngPassword'; 
flush privileges; 
exit

This will allow the Cacti user access to the database from the Cacti server. Now change $database_hostname in config.php and DB_Host in spine.conf on the Cacti server to point to your remote database server.