DEV Community

ADEBI Châ-Fine Ayédoun
ADEBI Châ-Fine Ayédoun

Posted on

How to Install and Configure GLPI on Mx Linux (Debian base) (Apache, PHP, MariaDB)

✅ 1. System Requirements & Packages

🔧 Install Apache, PHP, and MariaDB/MySQL:

sudo apt update sudo apt install apache2 mariadb-server php php-mysql php-gd php-intl php-curl php-mbstring php-xml php-bz2 php-zip unzip wget 
Enter fullscreen mode Exit fullscreen mode

🔧 Enable the required Apache modules:

sudo a2enmod rewrite sudo systemctl restart apache2 
Enter fullscreen mode Exit fullscreen mode

✅ 2. Download and Install GLPI

cd /tmp wget https://github.com/glpi-project/glpi/releases/download/10.0.14/glpi-10.0.14.tgz tar -xvzf glpi-10.0.14.tgz sudo mv glpi /var/www/ sudo chown -R www-data:www-data /var/www/glpi 
Enter fullscreen mode Exit fullscreen mode

✅ 3. Apache Configuration

Create a configuration file for the VirtualHost:

sudo nano /etc/apache2/sites-available/glpi.conf 
Enter fullscreen mode Exit fullscreen mode

Paste the following:

<VirtualHost *:80>  ServerName glpi.localhost DocumentRoot /var/www/glpi/public <Directory /var/www/glpi/public>  Require all granted AllowOverride All RewriteEngine On RewriteCond %{HTTP:Authorization} ^(.+)$ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] </Directory> </VirtualHost> 
Enter fullscreen mode Exit fullscreen mode

Enable the site:

sudo a2ensite glpi.conf sudo systemctl reload apache2 
Enter fullscreen mode Exit fullscreen mode

✅ 4. Edit /etc/hosts

Add this domain for local development:

sudo nano /etc/hosts 
Enter fullscreen mode Exit fullscreen mode

Add the following line:

127.0.0.1 glpi.localhost 
Enter fullscreen mode Exit fullscreen mode

✅ 5. Database Configuration

Start MySQL and create the database and user:

sudo mysql -u root -p 
Enter fullscreen mode Exit fullscreen mode

In the MySQL terminal:

CREATE DATABASE glpidb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'glpiuser'@'localhost' IDENTIFIED BY 'strongpassword'; GRANT ALL PRIVILEGES ON glpidb.* TO 'glpiuser'@'localhost'; FLUSH PRIVILEGES; EXIT; 
Enter fullscreen mode Exit fullscreen mode

✅ 6. Access via Browser

Open your browser and go to:

http://glpi.localhost 
Enter fullscreen mode Exit fullscreen mode

You should see the GLPI installer 🎉


✅ Fixing the GLPI session.cookie_httponly warning:

  1. Open the PHP configuration file:

Depending on your PHP version, the file might be:

 sudo nano /etc/php/8.2/apache2/php.ini 
Enter fullscreen mode Exit fullscreen mode

Replace 8.2 with your actual version if different. You can check it with:

 php -v 
Enter fullscreen mode Exit fullscreen mode
  1. Search for the following line: Press Ctrl + W and type:
 session.cookie_httponly 
Enter fullscreen mode Exit fullscreen mode
  1. Edit or add the following line:
 session.cookie_httponly = On 
Enter fullscreen mode Exit fullscreen mode
  1. Save and exit (Ctrl + O, then Enter, then Ctrl + X)

  2. Restart Apache to apply the changes:

 sudo systemctl restart apache2 
Enter fullscreen mode Exit fullscreen mode

✅ Verification

To make sure the directive is applied:

php -i | grep session.cookie_httponly 
Enter fullscreen mode Exit fullscreen mode

You should see:

session.cookie_httponly => On => On 
Enter fullscreen mode Exit fullscreen mode

Top comments (0)