How to Install GLPI Inventory Management on CentOS

GLP is a free and open source asset and helpdesk management solution that allows you to manage and track your IT inventory via a web browser. It supports all IT products such as servers, PCs, routers, monitors, printers, switches and many more. It allows you to control the flow of all technical devices and also includes a ticket system to report incidents. With GLPI, you can track the entire lifecycle of your IT assets and view the real-time status of your software and licenses.

If you are looking for a solution to manage your IT infrastructure with advanced inventory, asset and mobile device management features, GLPI is the best choice for you.

In this tutorial, we will show you how to install the GLPI IT Asset Management System on CentOS 8.

Prerequisites

  • A server running CentOS 8.
  • A root password is set up on your server.

Install the LAMP server

First you need to install the Apache web server, MariaDB database server, PHP and other PHP extensions on your system. You can install them all with the following command:

dnf install httpd mariadb-server php-curl php php-gd php-json php-fileinfo php-xml php-cli php-mbstring php-mysqli php-session php-zlib php-simplexml php-ldap php-apcu php-xmlrpc php-domxml php-opcache -y

When all packages are installed, start the Apache and MariaDB services and activate them with the following command so that they start after a system reboot:

systemctl start httpd
systemctl enable httpd
systemctl start mariadb
systemctl enable mariadb

Configure MariaDB database

By default, MariaDB is not backed up in CentOS 8. Therefore, you need to secure the MariaDB installation.

Execute the following command to back up MariaDB:

mysql_secure_installation

This script sets the MariaDB root password, removes anonymous users, disallows remote root login, and removes the test database and access to it (see below):

Enter current password for root (enter for none): 
OK, successfully used password, moving on...
Set root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

Once MariaDB is secured, log into the MariaDB shell with the following command:

mysql -u root -p

Enter your root password when prompted, and create a database and user for GLPI with the following command:

MariaDB [(none)]> create database glpi;
MariaDB [(none)]> create user 'glpi'@'%' IDENTIFIED BY 'password';

Next, grant all permissions to the GLPI database with the following command:

MariaDB [(none)]> grant all privileges on `glpi`.* TO 'glpi'@'%';

Delete the permissions and exit the MariaDB shell with the following command:

MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit;

Once MariaDB is configured, you can proceed to the next step.

Install GLPI

First, you need to download the latest version of GLPI from the Git repository. You can download it with the following command:

wget -c https://github.com/glpi-project/glpi/releases/download/9.4.5/glpi-9.4.5.tgz

Once the download is complete, unzip the downloaded file with the following command:

tar -xvzf glpi-9.4.5.tgz

Next, move the unzipped directory to the Apache root directory:

mv glpi /var/www/html/

Next, give the glpi directory the correct permissions with the following command:

chown -R apache:apache /var/www/html/glpi
chmod -R 775 /var/www/html/glpi

Finally, restart the Apache service to apply the changes:

systemctl restart httpd

Configure firewall and SELinux

Next, you need to allow Apache via the firewall. You can allow it with the following command:

firewall-cmd --zone=public --add-service=http --permanent

Next, you need to reload the firewalld so that the changes are applied:

firewall-cmd --reload

By default, SELinux is enabled in CentOS 8. Therefore, you need to configure SELinux for GLPI to work properly. You can enable some required SELinux configurations with the following command:

setsebool -P httpd_can_network_connect on
setsebool -P httpd_can_network_connect_db on

When you are done with that, you can proceed to the next step.

Accessing the GLPI web interface

Now open your web browser and enter the URL http://your-server-ip/glpi. You will be redirected to the GLPI SETUP page as shown below:

Select your desired language and click the OK button. You should see the GLPI License Agreement page (see below):

Accept the license agreement and click the " Next" button. You should see the following page:

Click on the Install button to start the installation. You should see the following page:

Make sure all required components are installed, then click the Next button. You should see the database connection setup page:

Enter your username and password for the database and click the Next button. You should see the following page:

Select your database and click the Next button. You should see the page for initializing the database (see below):

Click the Next button. You should see the Collect data page:

Click the Next button. You should see the following page:

Click the Continue button. Once the installation is complete, you should see the following page:

Click on the Use GLPI button. You will be redirected to the GLPI login page:

Enter the default username and password glpi/glpi and click the Post button. On the following page you should see the default GLPI dashboard:

For security reasons, it is recommended to change the default password as shown below:

Remove the installation file after you have completed the installation:

rm -rf /var/www/html/glpi/install/install.php

Conclusion

Congratulations! You have successfully installed the GLPI IT Asset Management System on CentOS 8. You can now explore the GLPI dashboard to discover more features. If you have any questions, please feel free to contact me.