12 C
Texas
angeloma
Senior Writer and partner

How to install GLPI with Nginx on Debian 10?

As you know Debian 10 Buster is a warranty as an operating system on a server. Since the server is one of the main elements of a network, it is important that the system installed is efficient. In the same way, in this server, there could be many different applications and services. One of them is the GLPI this software that allows having controlled your computer park. In this post, you will learn how to install GLPI whit Nginx on Debian 10.

Install GLPI on Debian 10

First, connect to your server. To do this, connect to your server using the following command:

:~$ ssh [your-user]@[your-server]

Once you are on the server we can continue.

1.- Upgrade the system

- Advertisement -

Before starting any installation, it is recommended to upgrade the entire operating system. To do this you need to be a root user. If you do not have the password and your user can use sudo, you can do it like this.

:~$ sudo apt update && sudo apt upgrade

With this, the server will have installed all the security patches that have been published. This will make Debian 10 Buster more robust and stable.

2.- Install LEMP on Debian 10

Nginx has amazing results on performance issues. So in this case it will be chosen along with MariaDB and PHP. In short, we are talking about the LEMP stack.

To install it, I recommend you read our about it.

How to install LEMP on Debian 10?

Then, we can continue.

3) Preparing the system for GLPI

Before installing GLPI you need to install some PHP libraries first. This will make it run smoothly. It is likely that your system already has them installed but it is better to be sure of it.

:~$ sudo apt install php7.3 php7.3-curl php7.3-zip php7.3-gd php7.3-intl php-pear php-imagick php7.3-imap php-memcache php7.3-pspell php7.3-recode php7.3-tidy php7.3-xmlrpc php7.3-xsl php7.3-mbstring php-gettext php7.3-ldap php-cas php-apcu php7.3-mysql php7.3-fpm

These are all of them.

Then you have to configure a little PHP-FPM to make it compatible with Nginx.

Open the configuration file:

sudo nano /etc/php/7.3/fpm/pool.d/www.conf

And change these two lines of the file so that they look like this:

;listen = /var/run/php7-fpm.sock
listen = 127.0.0.1:9000

Then save the changes by pressing CTRL + O and close it with CTRL + X.

Finally, apply the changes by restarting both services.

~$ sudo systemctl restart nginx php7.3-fpm

4) Creating the new database and user for GLPI

The next step is to create a new database for GLPI. We will do this from the MariaDB console.

Also, for security reasons, it is recommended to create a new user dedicated to that database. This way you will have a more orderly view of the MariaDB instance.

So, go to the MariaDB console:

:~$ sudo mysql -u root -p

And create the database and the user with their respective permissions.

> CREATE DATABASE glpidb;
> GRANT ALL PRIVILEGES ON glpidb.* TO 'glpiuser'@'localhost' IDENTIFIED BY 'password';
> FLUSH PRIVILEGES;
> exit;
1.- Creating the new database for GLPI
1.- Creating the new database for GLPI

Of course, you can modify the parameters to make it your own. Especially the password.

5) Install GLPI with Nginx on Debian 10 (I)

We now proceed to download and install GLPI. To do this we first navigate to the temporary folder and proceed to start the download with wget. At the time of writing this post, the last stable version is 9.4.4.

:~$ cd /tmp/
:~$ wget -c https://github.com/glpi-project/glpi/releases/download/9.4.4/glpi-9.4.4.tgz
2.- Download and install GLPI with Nginx on Debian 10
2.- Download and install GLPI with Nginx on Debian 10

Then, unzip the folder and assign the appropriate permissions to ensure the proper functioning of the application.

:~$ tar -xvf glpi-9.4.4.tgz
:~$ sudo mv glpi /var/www/html/*
:~$ sudo chmod 755 -R /var/www/html/*
:~$ sudo chown $USER:$USER -R /var/www/html/*

The next step is to create a new Nginx configuration for GLPI. In this sense, it is convenient to make a new server block.

:~$ sudo nano /etc/nginx/sites-available/glpi

And add the following:

server {
 listen 80;
 server_name glpi.osradar.test;
 root /var/www/html/glpi;
 index index.php;
 location / {try_files $uri $uri/ index.php;}
 location ~ \.php$ {
 fastcgi_pass 127.0.0.1:9000;
 fastcgi_index index.php;
 include /etc/nginx/fastcgi_params;
 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
 include fastcgi_params;
 fastcgi_param SERVER_NAME $host;
 }
location ~ /files{
deny all;
}
 }
3.- Configuring Nginx to work with GLPI
3.- Configuring Nginx to work with GLPI

Of course, you can replace the server_name by yours.

Then, enable the new configuration.

:~$ sudo ln -s /etc/nginx/sites-available/glpi /etc/nginx/sites-enabled/glpi.conf

Finally, restart both services:

:~$ sudo systemctl restart nginx php7.3-fpm

Now, we can continue the installation using the web browser.

6) Install GLPI with Nginx on Debian 10 (II)

Now, open your web browser and go to http://your-server and complete the installation. You will see the following:

4.- GLPI initial setup
4.- GLPI initial setup

So, choose your language and click OK.

Next, accept the license terms.

5.- License terms of GLPI
5.- License terms of GLPI

Once you have accepted them, you will see the following screen.

6.- Install GLPI with Nginx on Debian 10
6.- Install GLPI with Nginx on Debian 10

Once we have clicked on the install button. The wizard will determine the requirements of the application.

7.- GLPI setup
7.- GLPI setup

Now, enter MariaDB’s credentials.

8.- Database credentials
8.- Database credentials

Press the Continue button. Next, select the Database.

9.- Select the database
9.- Select the database

Then, initialize the database.

10.- Installing GLPI with Nginx on Debian 10
10.- Installing GLPI with Nginx on Debian 10

After this, you will have the option to collaborate with the project by sending anonymous statistics on the use of the application.

11.- GLPI usage statistics
11.- GLPI usage statistics

If everything went well, you will see the following screen with the contact credentials of the first users. Of course, you can change this later.

12.- GLPI correctly installed
12.- GLPI correctly installed

So, log in with the default credentials.

13.- GLPI log in screen
13.- GLPI log in screen

Finally, you will see the dashboard.

14.- GLPI with Nginx on Debian 10
14.- GLPI with Nginx on Debian 10

And that is it.

Conclusion

In this post, you have learned to install GLPI with Nginx on Debian 10. GLPI is an application to control the informatics equipment of your company. It is an administrative tool, more than anything. It is created in PHP and uses MariaDB as a database manager.

If you prefer Apache over Nginx you can read this post

How to install GLPI on Debian 10 Buster?

Please share this post with your friends. And join our Telegram channel.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

6 COMMENTS

  1. Hi,
    very nice tutorial, but I have question how you resolve this problem (from pic no 7.):

    “Web access to files directory is protected
    Web access to the files directory should not be allowed
    Check the .htaccess file and the web server configuration.”

    nginx not support .htaccess….

  2. Thank you for the turorial and efforts!
    I found that there is a backslash missing in the part:
    The next step is to create a new Nginx configuration for GLPI. In this sense, it is convenient to make a new server block.
    And add the following:
    in the text you have
    location ~ .php$ {
    and in the picrture you have
    location ~ \.php$ {
    If users copy the text, it would be wrong

  3. Secondly to avoid the error: Web access to the files directory should not be allowed
    Add these lines to /etc/nginx/sites-available/glpi:
    location ~ /files{
    deny all;
    }

    It should look like this:
    server {
    listen 80;
    server_name glpi.osradar.test;;

    root /var/www/html/glpi;
    index index.php;

    location / {try_files $uri $uri/ index.php;}

    location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    include /etc/nginx/fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    fastcgi_param SERVER_NAME $host;
    }
    location ~ /files{
    deny all;
    }
    }

  4. Hello I am new to webserver. Whenever i want to access the page for glpi i get an error 502 bad gateway although i followed all instructions

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article