|
| 1 | +<h1 align="center">GLPI - IT Asset Management</h1> |
| 2 | + |
| 3 | +<p align='justify'> |
| 4 | + |
| 5 | +<a href="https://glpi-project.org">GLPI</a> - is an open source IT Asset Management, issue tracking system and service desk system. This software is written in PHP and distributed as open-source software under the GNU General Public License. |
| 6 | + |
| 7 | +GLPI is a web-based application helping companies to manage their information system. The solution is able to build an inventory of all the organization's assets and to manage administrative and financial tasks. The system's functionalities help IT Administrators to create a database of technical resources, as well as a management and history of maintenances actions. Users can declare incidents or requests (based on asset or not) thanks to the Helpdesk feature. |
| 8 | +</p> |
| 9 | + |
| 10 | +- [GLPI Docker Image](#glpi-docker-image) |
| 11 | +- [Install GLPI docker container](#install-glpi-docker-container) |
| 12 | + - [Setup Timezone](#setup-timezone) |
| 13 | + - [Setup General](#setup-general) |
| 14 | + - [Setup Plugins via CLI](#setup-plugins-via-cli) |
| 15 | + - [Setup OCS Inventory NG](#setup-ocs-inventory-ng) |
| 16 | + - [Setup Mailgate](#setup-mailgate) |
| 17 | + - [Setup Memcached](#setup-memcached) |
| 18 | + |
| 19 | +## GLPI Docker Image |
| 20 | +Image is based on [Alpine 3.17](https://hub.docker.com/repository/docker/johann8/bacularis/general) |
| 21 | + |
| 22 | +| pull | size | version | platform | |
| 23 | +|:---------------------------------:|:----------------------------------:|:--------------------------------:|:--------------------------------:| |
| 24 | +|  |  | [](https://hub.docker.com/r/johann8/alpine-glpi/tags "Version badge") |  | |
| 25 | + |
| 26 | +## Install GLPI docker container |
| 27 | +- create folders |
| 28 | + |
| 29 | +```bash |
| 30 | +DOCKERDIR=/opt/inventory |
| 31 | +mkdir -p ${DOCKERDIR}/data/ocsinventory/{perlcomdata,ocsreportsdata,varlibdata,httpdconfdata} |
| 32 | +mkdir -p ${DOCKERDIR}/data/nginx/{config,certs,auth} |
| 33 | +chown -R 101:101 ${DOCKERDIR}/data/ocsinventory/perlcomdata/ |
| 34 | +chown -R 101:101 ${DOCKERDIR}/data/ocsinventory/ocsreportsdata/ |
| 35 | +chown -R 101:101 ${DOCKERDIR}/data/ocsinventory/varlibdata/ |
| 36 | +mkdir -p ${DOCKERDIR}/data/{glpi,crond,crontabs,mariadb} |
| 37 | +mkdir -p ${DOCKERDIR}/data/glpi/{files,plugins,config} |
| 38 | +mkdir -p ${DOCKERDIR}/data/crond/{5min,15min,30min,hourly,daily,weekly,monthly} |
| 39 | +chown -R 100:101 ${DOCKERDIR}/data/glpi/* |
| 40 | +mkdir -p ${DOCKERDIR}/data/mariadb/{config,dbdata,socket} |
| 41 | +cd ${DOCKERDIR} |
| 42 | +tree -d -L 3 ${DOCKERDIR} |
| 43 | +``` |
| 44 | + |
| 45 | +- Download config files |
| 46 | + |
| 47 | +```bash |
| 48 | +DOCKERDIR=//opt/inventory |
| 49 | +cd ${DOCKERDIR} |
| 50 | +wget https://raw.githubusercontent.com/johann8/alpine-glpi/master/docker-compose.yml |
| 51 | +wget https://raw.githubusercontent.com/johann8/alpine-glpi/master/docker-compose.override.yml |
| 52 | +wget https://raw.githubusercontent.com/johann8/alpine-glpi/master/.env |
| 53 | +``` |
| 54 | + |
| 55 | +- Customize variable in .env file |
| 56 | + |
| 57 | +- Generate passwords for MariaDB |
| 58 | +```bash |
| 59 | +DOCKERDIR=/opt/inventory |
| 60 | +PASSWORD_OCS=$(pwgen -1cnsB 25 1); sed -i "s/MyPassword123/${PASSWORD_OCS}/" ${DOCKERDIR}/.env |
| 61 | +PASSWORD_GLPI=$(pwgen -1cnsB 25 1); sed -i "s/MyPassword456/${PASSWORD_GLPI}/" ${DOCKERDIR}/.env |
| 62 | +PASSWORD_ROOT=$(pwgen -1cnsB 30 1); sed -i "s/MySuperPassword789/${PASSWORD_ROOT}/" ${DOCKERDIR}/.env |
| 63 | +cat ${DOCKERDIR}/.env |
| 64 | +``` |
| 65 | +- Generate Nginx certificate for FQDN: ocsinventory.changeme.de |
| 66 | +```bash |
| 67 | +# Generate private key |
| 68 | +openssl genrsa -out /etc/pki/tls/private/ca.key 2048 |
| 69 | + |
| 70 | +# Generate CSR (Common Name is ocsinventory.changeme.de) |
| 71 | +openssl req -new -key /etc/pki/tls/private/ca.key -out /etc/pki/tls/private/ca.csr |
| 72 | + |
| 73 | +# Generate Self Signed Key |
| 74 | +openssl x509 -req -days 3650 -in /etc/pki/tls/private/ca.csr -signkey /etc/pki/tls/private/ca.key -out /etc/pki/tls/certs/ca.crt |
| 75 | +openssl x509 -in /etc/pki/tls/certs/ca.crt -text -noout |
| 76 | + |
| 77 | +# convert crt to pem |
| 78 | +cd /etc/pki/tls/certs && openssl x509 -in ca.crt -out cacert.pem |
| 79 | +cd - |
| 80 | +openssl x509 -in /etc/pki/tls/certs/cacert.pem -text -noout |
| 81 | + |
| 82 | +# copy certificates |
| 83 | +DOCKERDIR=/opt/inventory |
| 84 | +cp /etc/pki/tls/private/ca.key ${DOCKERDIR}/data/nginx/certs/ocs.key |
| 85 | +cp /etc/pki/tls/certs/ca.crt ${DOCKERDIR}/data/nginx/certs/ocs.crt |
| 86 | +cp /etc/pki/tls/certs/cacert.pem ${DOCKERDIR}/ |
| 87 | +``` |
| 88 | +- Run all docker container |
| 89 | + |
| 90 | +```bash |
| 91 | +DOCKERDIR=/opt/glpi |
| 92 | +cd ${DOCKERDIR} |
| 93 | +docker-compose up -d |
| 94 | + |
| 95 | +# show logs |
| 96 | +docker-compose logs |
| 97 | + |
| 98 | +# show running containers |
| 99 | +docker-compose ps |
| 100 | +``` |
| 101 | +- Create GLPI Database |
| 102 | +```bash |
| 103 | +DOCKERDIR=/opt/inventory |
| 104 | +docker-compose exec mariadb bash |
| 105 | +mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "create database "${MARIADB_GLPI_DATABASE}" character set utf8mb4" |
| 106 | +mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "CREATE USER "${MARIADB_GLPI_USER}"" |
| 107 | +mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "grant all on "${MARIADB_GLPI_DATABASE}".* to '${MARIADB_GLPI_USER}'@'%' identified by '${MARIADB_GLPI_PASSWORD}'" |
| 108 | +mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "FLUSH PRIVILEGES" |
| 109 | +mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "show databases;" |
| 110 | +mysql --batch --user=root --password=${MARIADB_ROOT_PASSWORD} -e "select Host,User,Password from mysql.user;" |
| 111 | +exit |
| 112 | +``` |
| 113 | +### Install Install OCS Inventory |
| 114 | +- Go to http://ocs.int.brg-recht.de/ocsreports/ |
| 115 | + |
| 116 | +### Install GLPI |
| 117 | +- Go to http://glpi.mydomain.de |
| 118 | +- Enter the database connection details as shown in the picture |
| 119 | + |
| 120 | +- Choose the database glpi |
| 121 | + |
| 122 | + |
| 123 | +- Run through the installation wizard and log in with glpi / glpi |
| 124 | + |
| 125 | +Enjoy! |
0 commit comments