Install GLPI On Ubuntu: A Step-by-Step Guide
Hey guys! Today, we're diving into how to install GLPI on Ubuntu, step by glorious step. GLPI, which stands for Gestionnaire Libre de Parc Informatique, is a fantastic open-source IT asset management, helpdesk, and service desk system. It's a powerful tool that helps you manage your IT infrastructure efficiently. Whether you're a seasoned sysadmin or just starting, this guide will walk you through the entire process. Let's get started!
Prerequisites
Before we jump into the installation, let's make sure we have all the necessary prerequisites in place. Think of this as gathering your tools before starting a big project. Having everything ready will make the process smoother and prevent those annoying mid-install hiccups. So, here’s what you need:
- A Running Ubuntu Server: You should have a server running Ubuntu. I recommend using the latest LTS (Long Term Support) version for stability and security. This guide assumes you have Ubuntu Server already set up and running. If not, go set it up first.
- Root or Sudo Privileges: You'll need either root access or a user account with sudo privileges to execute administrative commands. Most of the commands we'll be using require elevated permissions, so make sure you're ready to roll with the big guns.
- Basic Command-Line Knowledge: Familiarity with the Linux command line is essential. We'll be spending a lot of time in the terminal, so knowing how to navigate directories, edit files, and execute commands is crucial. If you're new to the command line, don't worry! This is a great opportunity to learn.
- Internet Connection: An active internet connection is required to download packages and dependencies. Make sure your server can access the internet.
Now that we've covered the prerequisites, let's move on to the installation steps. We're going to break this down into manageable chunks so you can follow along easily. Remember, take your time, and don't be afraid to consult documentation if you get stuck. Let’s do this!
Step 1: Update the System
First things first, before installing any new software, it's always a good idea to update your system. This ensures that you have the latest package lists and security updates. Keeping your system up-to-date is a crucial step in maintaining its stability and security. Think of it as giving your server a quick health checkup before putting it to work.
Open your terminal and run the following commands:
sudo apt update
sudo apt upgrade
The sudo apt update command updates the package lists from the repositories. This command essentially refreshes your system's knowledge of available software packages. After updating the package lists, the sudo apt upgrade command upgrades all installed packages to their latest versions. This can include security patches, bug fixes, and new features. It's like giving all your software a fresh coat of paint and making sure everything is running smoothly.
When prompted, type y to confirm the upgrade. This process might take some time depending on the age of your system and the speed of your internet connection. Be patient and let it complete. Once it's done, you'll have a system that's ready to take on the next steps.
Step 2: Install Apache, MySQL, and PHP
GLPI requires a web server (Apache), a database server (MySQL), and PHP to function correctly. These are the fundamental components that will power your GLPI installation. Installing them together is like assembling the engine, chassis, and electrical system of a car – you need all of them for it to run.
Run the following command to install Apache, MySQL, PHP, and some common PHP extensions:
sudo apt install apache2 mariadb-server php libapache2-mod-php php-mysql php-gd php-ldap php-xml php-intl php-cli php-curl php-zip php-soap
Let's break down what each package is for:
apache2: This is the Apache web server. It's responsible for serving the GLPI web interface to users.mariadb-server: This is the MariaDB database server, a drop-in replacement for MySQL. It will store all of GLPI's data, including IT assets, helpdesk tickets, and user information.php: This is the PHP interpreter. GLPI is written in PHP, so this is essential for running the application.libapache2-mod-php: This is an Apache module that allows Apache to process PHP files.php-mysql: This PHP extension allows PHP to communicate with the MySQL database.php-gd: This PHP extension is used for image manipulation.php-ldap: This PHP extension is used for connecting to LDAP directories for authentication.php-xml: This PHP extension is used for working with XML data.php-intl: This PHP extension provides internationalization support.php-cli: This is the command-line interface for PHP, useful for running scripts from the terminal.php-curl: This PHP extension allows PHP to make HTTP requests.php-zip: This PHP extension provides support for working with ZIP archives.php-soap: This PHP extension is used for creating and consuming SOAP web services.
During the installation, you may be prompted to set a password for the MySQL root user. Make sure to choose a strong password and remember it, as you'll need it later.
Once the installation is complete, you'll need to enable the rewrite module in Apache. This module allows you to use pretty URLs in GLPI.
Run the following command to enable the rewrite module:
sudo a2enmod rewrite
Then, restart Apache to apply the changes:
sudo systemctl restart apache2
Step 3: Create a Database for GLPI
Now that we have our web server, database server, and PHP set up, it's time to create a database for GLPI. This database will house all of GLPI's data, including your IT asset information, helpdesk tickets, and user details. Creating a dedicated database ensures that GLPI's data is isolated and organized, making it easier to manage and maintain.
Log in to the MySQL server as the root user:
sudo mysql -u root -p
You'll be prompted to enter the root password you set during the MySQL installation. Once you're logged in, you can create the GLPI database. Run the following SQL commands:
CREATE DATABASE glpi;
CREATE USER 'glpi'@'localhost' IDENTIFIED BY 'your_strong_password';
GRANT ALL PRIVILEGES ON glpi.* TO 'glpi'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace your_strong_password with a strong, unique password for the GLPI database user. This password will be used by GLPI to connect to the database. Make sure to choose a password that's difficult to guess and store it securely.
Let's break down these SQL commands:
CREATE DATABASE glpi;: This command creates a new database namedglpi. This is where all of GLPI's data will be stored.CREATE USER 'glpi'@'localhost' IDENTIFIED BY 'your_strong_password';: This command creates a new user namedglpithat can only connect from localhost. This user will be used by GLPI to access the database.GRANT ALL PRIVILEGES ON glpi.* TO 'glpi'@'localhost';: This command grants all privileges on theglpidatabase to theglpiuser. This allows GLPI to create, read, update, and delete data in the database.FLUSH PRIVILEGES;: This command reloads the grant tables, ensuring that the new privileges are applied.EXIT;: This command exits the MySQL shell.
Step 4: Download GLPI
Now that we've set up our database, it's time to download the latest version of GLPI. You can download it from the official GLPI website (https://glpi-project.org/). Make sure to download the latest stable version.
Navigate to the /tmp directory:
cd /tmp
Download the GLPI package using wget. You'll need to find the direct download link from the GLPI website. As of writing this, the command might look something like this (but always check the GLPI website for the latest version):
sudo wget https://github.com/glpi-project/glpi/releases/download/10.1.9/glpi-10.1.9.tgz
Important: Replace 10.1.9 with the actual version number of the latest GLPI release.
Once the download is complete, extract the GLPI package:
sudo tar -xvf glpi-10.1.9.tgz
Again, replace 10.1.9 with the actual version number of the GLPI release you downloaded.
Step 5: Move GLPI Files to the Web Directory
Now that we've downloaded and extracted GLPI, we need to move the GLPI files to the web directory. This is the directory that Apache uses to serve web pages. By default, the web directory is /var/www/html. Moving the GLPI files to this directory will make them accessible through your web browser.
Move the GLPI files to the web directory:
sudo mv glpi /var/www/html/glpi
Next, we need to set the correct permissions for the GLPI files. This ensures that the web server can access and modify the files as needed. The www-data user and group are typically used by Apache, so we'll set the ownership of the GLPI files to this user and group.
Set the ownership of the GLPI files:
sudo chown -R www-data:www-data /var/www/html/glpi
We also need to set the correct permissions for the files and config directories within the GLPI directory. These directories need to be writable by the web server.
Set the permissions for the files and config directories:
sudo chmod -R 775 /var/www/html/glpi/files
sudo chmod -R 775 /var/www/html/glpi/config
Step 6: Configure Apache for GLPI
Now that we've moved the GLPI files to the web directory and set the correct permissions, we need to configure Apache to serve the GLPI application. This involves creating a virtual host configuration file for GLPI. A virtual host is a configuration that allows Apache to host multiple websites on the same server.
Create a new Apache configuration file for GLPI:
sudo nano /etc/apache2/sites-available/glpi.conf
Add the following configuration to the file:\n
<VirtualHost *:80>
ServerName your_server_ip_or_domain
DocumentRoot /var/www/html/glpi
<Directory /var/www/html/glpi/>
Options FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/glpi_error.log
CustomLog ${APACHE_LOG_DIR}/glpi_access.log combined
</VirtualHost>
Replace your_server_ip_or_domain with the actual IP address or domain name of your server. This is the address that users will use to access the GLPI application.
Save the file and exit the editor. Then, enable the GLPI site:
sudo a2ensite glpi.conf
Finally, restart Apache to apply the changes:
sudo systemctl restart apache2
Step 7: Complete the GLPI Installation via Web Interface
With all the server-side configurations in place, the final step is to complete the GLPI installation through the web interface. This is where you'll configure GLPI's settings, connect to the database, and create your administrator account.
Open your web browser and navigate to your server's IP address or domain name (e.g., http://your_server_ip_or_domain/glpi). You should see the GLPI installation page.
Follow the on-screen instructions to complete the installation. Here's a summary of the steps:
- Language Selection: Choose your preferred language.
- License Agreement: Accept the license agreement.
- Pre-Checks: GLPI will perform some pre-checks to ensure that your system meets the requirements. If any issues are found, address them before proceeding.
- Database Connection: Enter the database connection details. Use the database name (
glpi), username (glpi), and password you created earlier. - Database Initialization: GLPI will initialize the database. This may take a few minutes.
- Default Data: Choose whether to install default data.
- Administrator Account: Create your administrator account. Make sure to choose a strong password and remember it.
- Installation Complete: Once the installation is complete, you'll be able to log in to GLPI with your administrator account.
Congratulations! You've successfully installed GLPI on Ubuntu. You can now start configuring GLPI to manage your IT assets, track helpdesk tickets, and more.
Next Steps
Now that you've got GLPI up and running, here are a few things you might want to do next:
- Configure Email Settings: Set up email notifications so GLPI can send alerts and updates.
- Import IT Assets: Start adding your IT assets to GLPI. You can do this manually or import them from a CSV file.
- Configure User Authentication: Integrate GLPI with your existing user directory (e.g., LDAP) for easier user management.
- Explore GLPI's Features: Dive into GLPI's features and learn how to use them to manage your IT infrastructure effectively.
Installing GLPI on Ubuntu might seem daunting at first, but by following these steps, you can get it up and running in no time. GLPI is a powerful tool that can help you manage your IT infrastructure more efficiently, so take the time to learn how to use it effectively. Good luck, and have fun!