How to install the GLPI from scratch?

Raphael Konno
7 min readApr 17, 2021

Hello, my second article here and today I will tell how to configure a GLPI 9.5.3 server. In my study-servers I’m testing Fedora Server 33 with it we will deploy this application today.

Before talking about installation, we need to prepare our environment. For this we need update your Fedora Server current packages to the last version. We need to configure our server for the GLPI requirements. They are a web-server with PHP and a database, which can be MySQL or Maria DB. We will use Apache Server and Maria DB for this case:

sudo dnf update

Install Apache web server:

sudo dnf install httpd

Enable the Apache web-server service and start it:

sudo systemctl enable httpd.service
sudo systemctl start httpd.service

We need to see the status of service:

sudo systemctl status httpd.service

We have finished installing Apache, we can see the status as “active (running)” which indicates that we can go to the next step.

The next step is install MariaDB, you can do this with the command below:

sudo dnf install mariadb-server

Enable the MariaDB service and start it:

sudo systemctl enable mariadb.service
sudo systemctl start mariadb.service

After this installation process, we need to run the secure installation script to secure MariaDB instance:

sudo mysql_secure_installation

Here we found a many adjusts for realized in your application, in my case, I selected these options:

  • Enter current password for root [I used my root password].
  • Switch to unix_socket authentication [N].
  • Change the root password? [N].
  • Re-enter new password: [I used my root password].
  • Remove anonymous users? [Y].
  • Disallow root login remotely? [Y].
  • Remove test database and access to it? [Y].
  • Reload privilege tables now? [Y].

We need to see a status of service:

sudo systemctl status mariadb

We have finished configure Maria DB, we can see the status as “active (running)” which indicates that we can go to the next step.

Other requisite for GLPI is PHP, we will work on installing it now:

sudo dnf install php php-common

Speaking of requirements, GLPI needs several PHP modules to work, so let’s install these modules with the following command:

sudo dnf install php-mysqlnd php-xml php-json php-gd php-mbstring
sudo dnf install php-apcu php-gd php-intl php-json php-ldap php-mbstring php-opcache php-pear-CAS php-sodium php-xmlrpc php-zip

Here the current version in my environment.

Like any good application, we need enable firewall access for protocols HTTP and HTTPS. In Fedora the command for this are “firewall-cmd”. Next you need to reload the firewall daemon to apply these changes:

sudo firewall-cmd –-permanent –-add-service=http
sudo firewall-cmd –-permanent –-add-service=https
sudo systemctl reload firewalld

We need to test the installation, for this we will create a phpinfo() function file in Apache default document root. It is locate in /var/www/html. If you don’t have “vim” in your server use “yum install vim for install the text editor.

After create the php file, restart the Apache HTTP Server:

sudo vim /var/www/html/phpinfo.php
systemctl restart httpd
<?php
phpinfo();
/?>

You can access this page test with your IP address “/phpinfo.php” (no quotation marks):

We have done several processes so far, from now on we will effectively talk about installing GLPI. So let’s start using our “wget” to download the version that we will install in this tutorial, version 9.5.3.

First, we install “tar” and “wget” tool if you don’t have them installed:

sudo yum update
sudo yum install tar wget

That done, let’s download the GLPI:

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

Now, we will decompress the GLPI files in our Apache web server folder, locate in “/var/www/”:

sudo tar xf glpi-9.5.3.tgz -C /var/www/

As the application needs to write in the directory, we will change the folder permission:

sudo chown -R apache: /var/www/glpi/

By default SELinux is actives in Fedora 33. Therefore, we need to create a context of read/write for web service, we can do this using this commands:

sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/glpi(/.*)?"

We apply this context with this command:

sudo restorecon -R /var/www/glpi/

Also we need to allow many access to web service, like network access, database access and mail access:

sudo setsebool -P httpd_can_network_connect on
sudo setsebool -P httpd_can_network_connect_db on
sudo setsebool -P httpd_can_sendmail on

How about we configure our web service now? For this using the “nano” we will make the following configurations:

sudo nano /etc/httpd/conf.d/glpi.conf

These parameters:

Alias /glpi /var/www/glpi
<Directory /var/www/glpi>
AllowOverride all
</Directory>

Now, reload the Apache HTTP Server:

sudo systemctl reload httpd

Our last steps before final configurations are the creation of our database, for that:

mysql -u root -pcreate database glpi;create user glpi@localhost identified by 'InsertYourPassHere';
  • Attention in quotation marks, you need pass you password in this field.

The Next step is grant privileges at user on database and the time zone tables in MariaDB.

grant all privileges on glpi.* to glpi@localhost;grant select on mysql.time_zone_name to glpi@localhost;exit

Using our IP Address slash glpi we can access this page:

After select your language, you need to accept the license of GLPI:

In the next step, you need select the “Install” option:

The application does a check on all requirements, do tests and the results must be all green.

(It even gives me peace to see that everything has worked out so far, without failing in any requirements).

(Believe me I did this process three times until I was sure what to write here).

Here we configure the database connections, the credentials are those that we create in our database:

We select our database:

To send usage statistics, GLPI is a free and highly competent tool. You can return it in a good way using the data for improvement or make a donate in the next pass.

Our installation has been completed. Ready for one last adjustment?

We can initially log in to the tool using a standard credential:

  • User: glpi
  • Password: glpi

Log on! Here, we will make only one last adjustment, the most important adjustments, the security ones. We need to remove the installation files there on our server, for that, you can use the following command:

sudo rm /var/www/glpi/install/install.php

After that, change the password of your GLPI user in the “preferences” tab, the fields are marked in the image below:

Well done! Here we finish the process and you can start to customize your environment.

For those who have come this far, congratulations and we meet in a next guide?

Any questions, you can send me in the comments. Like grammatical corrections, this is my second guide written in English.

Contribute with the project: https://glpi-project.org/

See you soon!

--

--