About GLPI Packaging

Various Linux distributions provides packages (deb/rpm/...) for GLPI (Debian, Mandriva, Fedora, Redhat/CentOS, ...) and for some plugins.

Here is some information about using and creating package

  • for users to understand how GLPI is installed
  • for support to understand how GLPI work on this installation
  • for packager

Filesystem Hirerarchie Standard

Most distribution requires than package follow The F.H.S.

  • /etc/glpi : configuration files : config_db.php and config_db_slave.php. Other files still in glpi/config
  • /usr/share/glpi : the web pages (read only dir)
  • /var/lib/glpi/files : the GLPI data and state information (session, uploaded documents, cache, cron, ...)
  • /var/log/glpi : the various GLPI log files

The magic file : /usr/share/glpi/config/config_path.php (not provided in the tarball)

// for packaging defaults

define("GLPI_CONFIG_DIR",     "/etc/glpi");

define("GLPI_DOC_DIR",        "/var/lib/glpi/files");
define("GLPI_DUMP_DIR",       "/var/lib/glpi/files/_dumps");
define("GLPI_CACHE_DIR",      "/var/lib/glpi/files/_cache/");
define("GLPI_CRON_DIR",       "/var/lib/glpi/files/_cron");
define("GLPI_SESSION_DIR",    "/var/lib/glpi/files/_sessions");
define("GLPI_PLUGIN_DOC_DIR", "/var/lib/glpi/files/_plugins");
define("GLPI_LOCK_DIR",       "/var/lib/glpi/files/_lock/");
define("GLPI_GRAPH_DIR",      "/var/lib/glpi/files/_graphs/");

define("GLPI_LOG_DIR",        "/var/log/glpi");

Apache Configuration File

Here is a configuration file sample for the web server :

# To access via http://servername/glpi/
Alias /glpi /usr/share/glpi

# some people prefer a simple URL like http://glpi.example.com
#<VirtualHost *:80>
#  [[DocumentRoot]] /usr/share/glpi
#  [[ServerName]] glpi.example.com

<Directory /usr/share/glpi>
    Options None
    [[AllowOverride]] None

    # to overwrite default configuration which could be less than recommanded value
    php_value memory_limit 64M

    Order Deny,Allow
    Allow from all

<Directory /usr/share/glpi/install>

    # 15" should be enough for migration in most case
    php_value max_execution_time 900
    php_value memory_limit 128M


# This sections remplace the .htaccess files provided in the tarball 

<Directory /usr/share/glpi/config>
    Order Allow,Deny
    Deny from all

<Directory /usr/share/glpi/locales>
    Order Allow,Deny
    Deny from all

<Directory /usr/share/glpi/install/mysql>
    Order Allow,Deny
    Deny from all

<Directory /usr/share/glpi/scripts>
    Order Allow,Deny
    Deny from all

Rotation of Log files

Here is a logrotate sample configuration file : /etc/logrotate.d/glpi

# Rotate GLPI logs daily, only if not empty
# Save 14 days old logs under compressed mode
/var/log/glpi/*.log {
    rotate 14
    create 644 apache apache

SELinux stuff

For SELinux enabled distribution, you need to declare the right Context for the folders :

For example and for Redhat based distribution :

  • /etc/glpi : httpd_sys_script_rw_t (apache need to write the config file in this folder)
  • /var/log/glpi : httpd_log_t (apache log type : write only, no delete right)
  • /var/lib/glpi : httpd_sys_script_rw_t

Use system cron

GLPI provides an internal cron for automated tasks

Using a system cron allow a more consistent and regular execution, for example, when no user connected on GLPI.

Sample configuration file : /etc/cron.d/glpi

# GLPI core
# Run cron from to execute task even when no user connected
*/4 * * * * apache /usr/bin/php /usr/share/glpi/front/cron.php

Note : cron.php should be run as the web server user (apache or www-data)

See attached glpi-cron.patch

Using system libraries rather than bundled ones

Most distributions prefers the use of system libraries (maintened separately)

PEAR Cache_Lite : required version is 1.7.4 or greater

Simply add in /usr/share/glpi/config/config_path.php (if "pear" dir present in include_path) :

define("GLPI_CACHE_LITE_DIR", "Cache");

PHP Mailer : required version is 2.2.1 or 5.0.2

Starting with GLPI 0.72, simply add in /usr/share/glpi/config/config_path.php

define("GLPI_PHPMAILER_DIR", "/path/to/phpmailer");

phpCAS : required version is 1.2.0

Starting with GLPI 0.78, simply add in /usr/share/glpi/config/config_path.php

Distribution should use system wide PHP CAS. This is a list of the situation per distribution

define("GLPI_PHPCAS", "/path/to/CAS.php");

ezComponent : required versions are Base 1.8 and Graph 1.5 (from 2009.2)

Starting with GLPI 0.78, simply add in /usr/share/glpi/config/config_path.php

define('GLPI_EZC_BASE', '/path/to/ezc/Base/base.php');

htmLawed : required version is 1.1.11

Starting with GLPI 0.83.3, simply add in /usr/share/glpi/config/config_path.php

define('GLPI_HTMLAWED', '/usr/share/htmlawed/htmLawed.php');

Starting with GLPI 0.84, simply add in /usr/share/glpi/config/config_path.php

SimplePie : required version is 1.3.1

define("GLPI_SIMPLEPIE_PATH", '/usr/share/php/php-simplepie');

Starting with GLPI 0.84.3, simply add in /usr/share/glpi/config/config_path.php

ZendFramework2 : required version >= 2.0.5

define('GLPI_ZEND_PATH', '/usr/share/php/Zend');

Other libraries need more work.

Using system fonts rather than bundled ones

Some distribution prefers the use of system fonts (maintened separately)


Starting with GLPI 0.78, simply add in /usr/share/glpi/config/config_path.php

define('GLPI_FONT_FREESANS',  '/path/to/FreeSans.ttf');


This informations are taken from the Fedora/EPEL spec file.
Feel free to add information about other specific distribution tips.

glpi-cron.patch - Patch to set all tasks to run in CLI mode instead of GLPI mode (1.4 kB) remi, 06/13/2011 09:42 am

glpi-0.83-cron.patch - Patch to set all poosible tasks (except "watcher") to run in CLI mode instead of GLPI mode for GLPI 0.83 (1.4 kB) remi, 04/19/2012 08:32 pm