How to Install GLPI on NixOS Latest
In this tutorial, we will learn how to install GLPI on NixOS Latest. GLPI is a free and open source IT asset management software tool, which helps to manage and track the assets of an IT infrastructure.
Prerequisites
Before we begin, make sure that you have access to a terminal as a user with root privileges. Also, ensure that your NixOS system is up to date, and that you have a stable internet connection.
Step 1: Install NixOS Implementation of PHP
GLPI requires PHP to work properly. The NixOS community provides a PHP implementation that you can use. The PHP version that we will be installing is version 7.4.
To install PHP, run the following command:
sudo nix-env -i php74
This command will install PHP version 7.4.
Step 2: Install the Required PHP Extensions
In order to execute GLPI, we will have to install the required extensions. To do so, we will have to create a file named extensions.nix in the /etc/nixos/ directory.
We can do this by running the following command:
sudo nano /etc/nixos/extensions.nix
In the file extensions.nix, add the following lines:
{
packageOverrides = pkgs: with pkgs.php74; {
extensions = [
bcmath
ctype
curl
dom
gd
iconv
intl
mbstring
mysqli
openssl
pcre
pdo_mysql
soap
sockets
xml
zip
];
};
nixpkgs.config = {
packageOverrides = [
(import <nixpkgs> {}).pkgs.self // extensions
];
};
}
This file will install all the necessary PHP extensions.
After adding the above lines, save and close the file.
You can now update your NixOS configuration by running:
sudo nixos-rebuild switch
Step 3: Install the GLPI Package
Now that we have installed all the necessary extensions, we can proceed to install the GLPI package itself.
To install GLPI, we will create a new file named glpi.nix in the /etc/nixos/ directory. To create this file, run the following command:
sudo nano /etc/nixos/glpi.nix
In the glpi.nix file, add the following lines:
{ pkgs ? import <nixpkgs> {} }:
let
extensions = import /etc/nixos/extensions.nix { inherit pkgs; };
in
pkgs.php74Packages.callPackage pkgs.glpi { inherit extensions; }
This file will install the GLPI package using the PHP extensions that we installed earlier.
After adding the above lines, save and close the file.
You can now update your NixOS configuration by running:
sudo nixos-rebuild switch
Step 4: Start the GLPI Service
Once you have installed GLPI, you can start the GLPI service by running:
sudo systemctl start glpi
This command will start the GLPI service.
Step 5: Access GLPI
GLPI should now be installed and running on your NixOS system. You can access GLPI by opening your web browser and navigating to http://localhost/glpi/.
You will be prompted to go through the GLPI installation process. Follow the instructions to complete the installation.
Conclusion
In this tutorial, we have learned how to install GLPI on NixOS. Now that you have installed GLPI, you can start managing and tracking the assets of your IT infrastructure.