1. System environment preparation
1. Installation required dependencies
# Update the system
sudo yum update -y
# Install EPEL repository
sudo yum install -y epel-release
# Install the necessary components
sudo yum install -y httpd mariadb-server mariadb php php-mysql php-gd php-ldap php-json php-xml php-mbstring php-zip php-curl php-bcmath php-imap php-apcu wget unzip
2. Configure the firewall
# Turn on firewall service
sudo systemctl start firewalld
sudo systemctl enable firewalld
# Open HTTP and HTTPS ports
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
2. Database configuration
1. Start MariaDB and set up startup
sudo systemctl start mariadb
sudo systemctl enable mariadb
2. Secure configuration of MariaDB
(As prompts, set the root password and complete the security configuration)
3. Create a GLPI database
mysql -u root -p -e "CREATE DATABASE glpidb CHARACTER SET utf8 COLLATE utf8_unicode_ci;"
mysql -u root -p -e "CREATE USER 'glpiuser'@'localhost' IDENTIFIED BY 'YourStrongPassword123';"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON glpidb.* TO 'glpiuser'@'localhost';"
mysql -u root -p -e "FLUSH PRIVILEGES;"
3. Install GLPI
1. Download and unzip GLPI
cd /var/www/html
sudo wget /glpi-project/glpi/releases/download/10.0.7/glpi-10.0.
sudo tar -xvzf glpi-10.0.
sudo mv glpi glpi-web
sudo chown -R apache:apache /var/www/html/glpi-web
sudo chmod -R 755 /var/www/html/glpi-web
2. Configure Apache
sudo tee /etc/httpd// <<EOF
<VirtualHost *:80>
ServerAdmin admin@
DocumentRoot /var/www/html/glpi-web
ServerName
<Directory /var/www/html/glpi-web>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/glpi_error.log
CustomLog /var/log/httpd/glpi_access.log combined
</VirtualHost>
EOF
3. Adjust PHP configuration
sudo sed -i 's/^memory_limit =.*/memory_limit = 256M/' /etc/
sudo sed -i 's/^upload_max_filesize =.*/upload_max_filesize = 64M/' /etc/
sudo sed -i 's/^post_max_size =.*/post_max_size = 64M/' /etc/
sudo sed -i 's/^max_execution_time =.*/max_execution_time = 600/' /etc/
4. Restart the service
sudo systemctl restart httpd
sudo systemctl enable httpd
4. GLPI initialization and installation
-
Access through the browser
http://your-server-ip/glpi-web
-
Follow the wizard to complete the installation and use the database information you created before
-
After completing the installation, delete the installation directory: sudo rm -rf /var/www/html/glpi-web/install/
V. System integration configuration
1. Integration with CMDB
GLPI itself is a CMDB system, but can be integrated with other CMDB systems:
# Install the FusionInventory plug-in to achieve automatic discovery
cd /var/www/html/glpi-web/plugins
sudo wget /fusioninventory/fusioninventory-for-glpi/releases/download/glpi10.0%2B1.1/fusioninventory-10.0+1..bz2
sudo tar -xjf fusioninventory-10.0+1..bz2
sudo chown -R apache:apache /var/www/html/glpi-web/plugins/fusioninventory
Then activate the FusionInventory plug-in in the GLPI interface and configure the automatic discovery task.
2. Integrate with the service desk system
GLPI has built-in help desk functionality, but can be integrated with external help desks:
# Install the REST API plugin
cd /var/www/html/glpi-web/plugins
sudo wget /pluginsGLPI/webservices/releases/download/2.7.0/glpi-webservices-2.7..bz2
sudo tar -xjf glpi-webservices-2.7..bz2
sudo chown -R apache:apache /var/www/html/glpi-web/plugins/webservices
Activate the Webservices plug-in and configure API access in the GLPI interface.
6. Install Python scripts with one click
createglpi_installer.py
document:
#!/usr/bin/env python3
import os
import subprocess
import getpass
def run_command(cmd):
process = (cmd, shell=True, stdout=, stderr=)
stdout, stderr = ()
if != 0:
print(f"Error executing: {cmd}")
print(())
exit(1)
return ()
def install_glpi():
print("=== Start installing GLPI ===")
# Installation dependencies
print("Installation system dependencies...")
run_command("yum update -y")
run_command("yum install -y epel-release")
run_command("yum install -y httpd mariadb-server mariadb php php-mysql php-gd php-ldap php-json php-xml php-mbstring php-zip php-curl php-bcmath php-imap php-apcu wget unzip")
# Configure the firewall
print("Configure the firewall...")
run_command("systemctl start firewalld")
run_command("systemctl enable firewalld")
run_command("firewall-cmd --permanent --add-service=http")
run_command("firewall-cmd --permanent --add-service=https")
run_command("firewall-cmd --reload")
# Configure MariaDB
print("Configure database...")
run_command("systemctl start mariadb")
run_command("systemctl enable mariadb")
# Secure configuration database
db_password = ("Set MariaDB root password: ")
run_command(f"mysql -e \"ALTER USER 'root'@'localhost' IDENTIFIED BY '{db_password}';\"")
run_command("mysql -e \"DELETE FROM WHERE User='';\"")
run_command("mysql -e \"DELETE FROM WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');\"")
run_command("mysql -e \"DROP DATABASE IF EXISTS test;\"")
run_command("mysql -e \"DELETE FROM WHERE Db='test' OR Db='test\\_%';\"")
run_command("mysql -e \"FLUSH PRIVILEGES;\"")
# Create a GLPI database
glpi_db = input("Input the GLPI database name (default glpidb): ") or "glpidb"
glpi_user = input("Input GLPI database user (default glpiuser): ") or "glpiuser"
glpi_pass = ("Enter the GLPI database password: ")
run_command(f"mysql -u root -p{db_password} -e \"CREATE DATABASE {glpi_db} CHARACTER SET utf8 COLLATE utf8_unicode_ci;\"")
run_command(f"mysql -u root -p{db_password} -e \"CREATE USER '{glpi_user}'@'localhost' IDENTIFIED BY '{glpi_pass}';\"")
run_command(f"mysql -u root -p{db_password} -e \"GRANT ALL PRIVILEGES ON {glpi_db}.* TO '{glpi_user}'@'localhost';\"")
run_command(f"mysql -u root -p{db_password} -e \"FLUSH PRIVILEGES;\"")
# Download and install GLPI
print("Download and install GLPI...")
run_command("cd /var/www/html && wget /glpi-project/glpi/releases/download/10.0.7/glpi-10.0.")
run_command("cd /var/www/html && tar -xvzf glpi-10.0.")
run_command("mv /var/www/html/glpi /var/www/html/glpi-web")
run_command("chown -R apache:apache /var/www/html/glpi-web")
run_command("chmod -R 755 /var/www/html/glpi-web")
# Configure Apache
print("Configure Apache...")
server_name = input("Enter the server domain name (such as): ")
with open("/etc/httpd//", "w") as f:
(f"""<VirtualHost *:80>
ServerAdmin admin@{server_name}
DocumentRoot /var/www/html/glpi-web
ServerName {server_name}
<Directory /var/www/html/glpi-web>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/glpi_error.log
CustomLog /var/log/httpd/glpi_access.log combined
</VirtualHost>""")
# Adjust PHP configuration
print("Adjust PHP configuration...")
run_command("sed -i 's/^memory_limit =.*/memory_limit = 256M/' /etc/")
run_command("sed -i 's/^upload_max_filesize =.*/upload_max_filesize = 64M/' /etc/")
run_command("sed -i 's/^post_max_size =.*/post_max_size = 64M/' /etc/")
run_command("sed -i 's/^max_execution_time =.*/max_execution_time = 600/' /etc/")
# Restart the service
print("Restart the service...")
run_command("systemctl restart httpd")
run_command("systemctl enable httpd")
print("\n=== GLPI installation is completed ===")
print(f"Please access through the browser: http://{server_name}/glpi-web to complete subsequent configuration")
print(f"Database Information:")
print(f" database name: {glpi_db}")
print(f" Username: {glpi_user}")
print(f" Password: {glpi_pass}")
if __name__ == "__main__":
install_glpi()
Instructions for use:
-
Save the above script as
glpi_installer.py
-
Add execution permissions:
chmod +x glpi_installer.py
-
Run as root:
sudo ./glpi_installer.py
-
Follow the prompts to enter the necessary information
7. Subsequent configuration suggestions
-
Regular backup: Set up automatic backup of GLPI data and databases
-
Safety reinforcement: Configure HTTPS, regularly update the system and GLPI
-
monitor: Set up system monitoring to ensure service availability
-
Plug-in Management: Install other GLPI plug-in extension functions as needed
This deployment scenario provides a complete GLPI installation process, including the basics of integration with CMDB and service desk systems. Depending on actual needs, it may be necessary to further configure automatic discovery rules, API integration details, etc.