Skip to content

Linux Installation

Linegod edited this page Jan 31, 2017 · 8 revisions

==== Configure PHP ====

There are numerous ways to package php. The main configuration is done in the so called ini file, e.g. ///etc/php.ini//. The following hints are meant as a guideline. Your distro's setup may vary.

=== Safe Mode ===

Cacti uses external commands, e.g. rrdtool. Thus it is required to have

; Safe Mode ; http://www.php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode safe_mode = Off

=== Date and Time ===

Since PHP Version 5.3, it is advised to define a http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone to avoid warnings on time/date functions. Use e.g.

; Defines the default timezone used by the date functions ; http://www.php.net/manual/en/datetime.configuration.php#ini.date.timezone date.timezone = "Europe/Berlin"

=== Enable Template Import ===

If you want to allow import of templates, uncomment the following line:

file_uploads = On

=== Enable exec() Calls ===

Cacti uses e.g. the //exec()// call, so please make sure to have

safe_mode = Off

=== Configure PHP Extensions ===

Cacti uses the following php extensions

  • mysql
  • session
  • sockets
  • xml
  • pcre It is recommended to use
  • snmp as well. As a replacement for php-snmp, you may use net-snmp support (sometimes called net-snmp-utils)

Plugins may use additional PHP modules like

  • gd (e.g. used by reportit)
  • dom (e.g. used by cli scripts, available with PHP version 5 only)

Using newer php versions, you may find a hint like ;;;; ; Note: packaged extension modules are now loaded via the .ini files ; found in the directory /etc/php.d; these are loaded by default. ;;;; In this case, there's nothing special to do but to verify, that the relevant .ini files are available in that very directory to reflect PHP support for those modules.

For older versions of PHP, youu may have to edit the php.ini file and add:

extension_dir = /etc/php.d

This will enable PHP to find more configuration directives in that very directory. The /path/to/extension_dir may vary for different linux distros; e.g. extension_dir=/usr/lib/php/modules

Activate the MySQL extension via <extension_dir>/mysql.ini

; Enable mysql extension module extension=mysql.so

Activate the SNMP extension via <extension_dir>/snmp.ini

; Enable snmp extension module extension=snmp.so

If using PHP 4.3.5 or less include the following line. If using 4.3.6 or greater, you should remove this line if present.

session.save_path=/tmp

==== Configure the Webserver (Apache) ====

If you are using Apache 1.3.x, installation of PHP 5 is not recommended.

Please find the file "/etc/httpd/conf/httpd.conf" or equivalent and make sure it includes:

# Load config files from the config directory "/etc/httpd/conf.d". Include conf.d/*.conf

Now, please locate the PHP configuration file at "/etc/httpd/conf.d/php.conf"

If using PHP 5, then make sure to have the following lines.

# PHP is an HTML-embedded scripting language which attempts to make it # easy for developers to write dynamically generated webpages. LoadModule php5_module modules/libphp5.so # # Cause the PHP interpreter to handle files with a .php extension. AddHandler php5-script .php AddType text/html .php # # Add index.php to the list of files that will be served as directory # indexes. DirectoryIndex index.php

In case you do not install Cacti to the default web directory, put the following as cacti.conf into /etc/httpd/conf.d. Change /your/cacti/dir to your cacti directory name. Change the Allow from 127.0.0.1 directive to whatever you need (e.g. the subnets in your company). Follow the hints given in the comments, especially when using SELinux!

# Cacti - the complete rrdtool-based graphing solution # # Allows only localhost by default # # Allowing cacti to anyone other than localhost should be considered # dangerous unless properly secured by SSL

Make sure, that httpd can read your cacti directories.

At minimum, you need

chmod ugo+r -R /your/cacti/dir

Make sure to replace with your directories

When using SELinux, set the following:

chcon -R -h -t httpd_sys_content_t /your/cacti/dir

when using SELinux and you private homedir, enable

setsebool -P httpd_enable_homedirs 1

setsebool -P httpd_read_user_content 1

Alias /cacti /your/cacti/dir <Directory /your/cacti/dir> AllowOverride None Order Deny,Allow Deny from all Allow from 127.0.0.1 Allow from ::1 Options Indexes Includes FollowSymLinks

These directories do not require access over HTTP

<Directory /your/cacti/dir/cli> Order Deny,Allow Deny from All Allow from None

Make sure that the //httpd// web service is started as given by 1_installation.1_install_unix.5a_start_system_services.