How To: Install GLPI on Ubuntu 21.04

What is GLPI?:

In short, GLPI offers both small and large businesses the ability to track their technology inventory and assets as well as offers lifecycle planning, service desk management, and much more.

GLPI can be directly integrated with OCS for seamless asset tracking automation. Check out my other blog post on how to install OCS

Read more about GLPI on their website: GLPI

Overview:

In this article, we will go step-by-step on how to install GLPI on Ubuntu Server 21.04. There are a few installation gotchas that I have overcome that are not mentioned in the GLPI documentation and I wanted to share this information so that anyone just getting into GLPI or wanting to know more about GLPI doesn’t have to go through the same pain I had to.

Just give me the commands

Prerequisites:

  • Note: All commands are done via an SSH connection in this guide.

To start you will need to open an SSH session to your Ubuntu machine, if you are on windows you can use putty or even PowerShell to achieve this.

Install the various array of applications and extensions needed to properly run GLPI.

apt-get install -y apache2 libapache2-mod-php mariadb-server mariadb-client php php-curl php-gd php-imagick php-intl php-apcu php-memcache php-imap php-mysql php-cas php-ldap php-tidy php-pear php-xmlrpc php-pspell php-mbstring php-json php-iconv php-xml php-gd php-xsl php-zip php-bz2

After installing all the needed applications and extensions update and upgrade any other system resources. If you are asked to restart various services just select “OK” and continue.

apt-get update && apt-get upgrade

Prerequisite: Command Details

Configure Apache Web Server:

After installing the prerequisites we will now work on configuring the HTTPd\Apache webserver.

Edit the httpd\apache “apache2.conf” file so GLPI does not warn on the test “Web access to files directory is protected” later on during the GLPI setup wizard.

# To edit in vim use: i
# To save and quit vim use: Esc + :wq!

vim /etc/apache2/apache2.conf

Look in the following section and change the default “AllowOverride None” to “AllowOverride All“.

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>
systemctl restart apache2

Configure Apache Web Server: Command Details

Configure the MariaDB database:

After configuring HTTPd\Apache we will work on configuring the MariaDB database for GLPI.

mysql_secure_installation

Create a password for the MariaDB root account as the default is nothing, then for the remaining initial setup wizard accept the defaults using “Y“.

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!


You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Allow MariaDB access to Ubuntu’s zone info so that MariaDB can load the time zone tables into it’s MySQL database. If we don’t do this then we won’t be able to set up a timezone in GLPI after the setup wizard is completed.

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -p -u root mysql

After running through the MariaDB setup wizard, log into the MariaDB management interface.

systemctl restart mariadb && mysql -u root -p

Prestage a database for GLPI as well as assign it a dedicated service account with full permissions. This database & service account will be used later on when it comes to the GLPI setup wizard.

The user account and password below are examples and should be adjusted to fit your needs accordingly.

#GLPI Settings
create database glpi;
CREATE USER 'GLPISA'@'localhost' IDENTIFIED BY 'Password12345';
GRANT ALL PRIVILEGES ON glpi. * TO 'GLPISA'@'localhost' IDENTIFIED BY 'Password12345';

#Timezone Settings
GRANT SELECT ON `mysql`.`time_zone_name` TO 'GLPISA'@'localhost';
FLUSH PRIVILEGES;
exit

Configure the MariaDB database: Command Details

Install GLPI:

After configuring the MariaDB database we will install and prestage GLPI.

wget https://github.com/glpi-project/glpi/releases/download/9.5.5/glpi-9.5.5.tgz
tar -xvf glpi-9.5.5.tgz
mv glpi /var/www/html

Since we are installing GLPI from the source, the folder permissions will need to be modified.

chmod -R 755 /var/www/html/glpi && chown -R www-data:www-data /var/www/html/glpi

Installing GLPI: Command Details

Configure GLPI:

After installing GLPI, we will now run through the setup wizard to finish setting up the GLPI instance.

Browse out to the following: “http://IP-OF-SERVER/GLPI“, and follow along with the setup wizard to complete the installation and setup of GLPI.

Clean up:

Rename the “install.php” file in the GLPI directory after the setup wizard is complete or GLPI will warn you when you log in.

mv /var/www/html/glpi/install/install.php /var/www/html/glpi/install/install.php.bck

Thoughts?

Thank you for taking the time to read this article, I hope that it was helpful in some way to you. If you noticed anything wrong or have a better way of doing this please don’t hesitate to comment below or send me an email.

Thank you!

    How To: Install OCS on Ubuntu 21.04 - Celerium
    3 Jul 2021
    6:28am

    […] can be directly integrated with GLPI for seamless asset tracking automation. Check out my other blog post on how to install […]

Leave A Comment