A robust, zero-dependency Python CLI tool designed to automate and secure the upgrade process of GLPI instances.
Even with modern versions like GLPI 10+, the official upgrade process remains entirely manual. As detailed in technical documentation (e.g., IT-Connect), administrators must manually:
- Download and unzip archives.
- Identify and backup specific configuration folders (
config,files,plugins...). - Delete old system files (to prevent "ghost" PHP files).
- Move the new files.
- Restore the configuration folders one by one.
- Fix file permissions (
chown/chmod).
This manual workflow is error-prone, time-consuming, and stressful in production environments.
This tool automates the entire workflow using a "Safe Swap" strategy to ensure production integrity:
- Download: Fetches the specific release directly from GitHub.
- Atomic Backup: The current production folder is renamed instead of being overwritten.
- Clean Install: The new version is extracted into a fresh directory.
- Surgical Restore: Critical data folders are automatically copied from the backup to the new instance.
- Permissions: Automatically reapplies web-server ownership (
chown).
- OS: Linux (Debian/Ubuntu/RHEL/CentOS)
- Python: 3.6 or higher (Standard library only, no pip dependencies required).
- Privileges:
rootorsudoaccess (required to manipulate/var/www).
Clone this repository on your GLPI server:
git clone https://github.com/maximerauch/glpi-update.git
cd glpi-update
chmod +x glpi_upgrade.pyThe basic syntax only requires the target version number. The script defaults to /var/www/html/glpi.
# Upgrade to version 10.0.10
sudo ./glpi_upgrade.py 10.0.10You can specify custom paths or users if your installation differs from the standard layout:
# Example for a custom path with Nginx user
sudo ./glpi_upgrade.py 10.0.11 \
--path /opt/glpi \
--owner nginx \
--group nginx| Argument | Description | Default |
|---|---|---|
version |
Required. Target GLPI version (e.g., 10.0.10). |
- |
--path |
Absolute path to the GLPI installation. | /var/www/html/glpi |
--owner |
System user owning the files. | www-data |
--group |
System group owning the files. | www-data |
This script manages file system operations. It does not touch the database to prevent unintended corruption. Once the script completes successfully, you must trigger the database migration:
- Go to the GLPI directory:
cd /var/www/html/glpi - Run the GLPI console migration command:
(Alternatively, log in to the web interface to trigger the wizard).
php bin/console db:update
Here is what a successful execution looks like:
$ sudo ./glpi_upgrade.py 10.0.10
[INFO] Target path: /var/www/html/glpi
[INFO] Downloading GLPI 10.0.10 from GitHub...
[SUCCESS] Download complete.
[INFO] Backing up current instance to: /var/www/html/glpi_backup_20251012_143000
[INFO] Extracting new version...
[SUCCESS] New version extracted.
[INFO] Restoring configuration and data files...
-> Restored: config
-> Restored: files
-> Restored: plugins
-> Restored: marketplace
-> Restored: certs
[INFO] Applying permissions (Owner: www-data:www-data)...
[SUCCESS] Permissions fixed.
===================================================
[SUCCESS] File system upgrade to 10.0.10 complete!
===================================================
IMPORTANT NEXT STEPS:
1. Database Migration is REQUIRED.
Run this command now:
php /var/www/html/glpi/bin/console db:update
2. A backup of the old version is available at:
/var/www/html/glpi_backup_20251012_143000
Contributions are welcome! Feel free to open an Issue or Pull Request to suggest improvements (e.g., automatic rollback on failure, Slack notifications, etc.).