Versão avaliada: Debian 10.6 Buster + PHP 7.3 + Nginx + GLPI 9.5.2
Pré-requisitos de instalação
Pacotes para instalação
# apt-get install nginx-extras curl git composer zip unzip bzip2 unrar-free vim ntpdate net-tools
Versão 7.3 do PHP
# apt install php7.3 php7.3-fpm php7.3-gd php7.3-mysql php7.3-intl php7.3-mbstring php7.3-xml php7.3-curl php7.3-ldap php7.3-json php7.3-readline php7.3-cli php7.3-common php7.3-bcmath php7.3-imap php7.3-xmlrpc php7.3-soap php7.3-pspell php7.3-recode php7.3-sqlite3 php7.3-tidy php7.3-xsl php7.3-bz2 php7.3-zip php-memcache php-imagick php-apcu php-cas php-apcu php-pecl-http php-pear libmcrypt-dev
Versão 7.4 do PHP (Em avaliação)
php7.3-recode <- Não tem ainda para versao 7.4
# apt install php7.4 php7.4-fpm php7.4-gd php7.4-mysql php7.4-intl php7.4-mbstring php7.4-xml php7.4-curl php7.4-ldap php7.4-json php7.4-readline php7.4-cli php7.4-common php7.4-bcmath php7.4-imap php7.4-xmlrpc php7.4-soap php7.4-pspell php7.4-sqlite3 php7.4-tidy php7.4-xsl php7.4-bz2 php7.4-zip php-memcache php-imagick php-apcu php-cas php-apcu php-pecl-http php-pear libmcrypt-dev
Caso for utilizar a base de dados no mesmo servidor instalar o pacote abaixo e inicializar a database. (Opcional)
# apt-get install mariadb-server
Criar database
# mysql -u root -p
> CREATE DATABASE servicedesk CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
> GRANT ALL PRIVILEGES ON glpi.* TO 'glpi'@'localhost' IDENTIFIED BY '<SENHA>';
> FLUSH PRIVILEGES;
> quit
Nota: Altere localhost para "%" ou IP desejado
Não usar caracteres especiais para a senha.
Preparando os arquivos do GLPI, utilize o link para baixar.
# cd /home/RepositorioWeb/webapps/
# wget https://github.com/glpi-project/glpi/releases/download/9.5.2/glpi-9.5.2.tgz
# mkdir glpi/files/_cache <- Este diretório ajuda na performance
# find glpi -type d -exec chmod 755 "{}" \; && \
find glpi -type f -exec chmod 644 "{}" \; && \
chmod -R 777 glpi/plugins && \
chmod -R 777 glpi/files/_log && \
chown -R www-data.www-data glpi/
Ajustar parametros minimos para funcionamento do PHP
# vi /etc/php/7.3/fpm/php.ini
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=512
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=10000
opcache.revalidate_freq=180
opcache.consistency_checks=0
[apcu]
apc.enabled=1
apc.enable_cli=1
apc.shm_size=128M
apc.ttl=7200
apc.serializer=php
cgi.fix_pathinfo=0
magic_quotes_sybase = off ;
register_globals = off ; // not mandatory but adviced
date.timezone = America/Sao_Paulo
upload_max_filesize = 2M
max_file_uploads = 20
--- Recomendações
memory_limit = 64M ; // max memory limit
file_uploads = on ;
max_execution_time = 600 ; // not mandatory but recommended
session.auto_start = off ;
session.use_trans_sid = 0 ; // not mandatory but recommended
session.cookie_httponly = on
Crie o arquivo para o site
# vi /etc/nginx/sites-available/servicedesk.conf
server {
listen 80;
listen [::]:80;
client_max_body_size 20M;
charset utf-8;
access_log /var/log/nginx/glpi.access.log;
error_log /var/log/nginx/glpi.error.log;
root /home/RepositorioWeb/webapps/glpi;
index index.php;
server_name glpi.dominio.com.br;
location / {
try_files $uri $uri/ =404;
autoindex on;
}
location /api {
rewrite ^/api/(.*)$ /apirest.php/$1 last;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
#fastcgi_param SERVER_NAME $host; <- Caso use http://IP/glpi
}
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
access_log off;
log_not_found off;
expires 365d;
}
location ~ /\. {
access_log off;
log_not_found off;
deny all;
}
# Security for 'files' directory
location /config/ {
#try_files $uri /index.php;
deny all;
}
# Security for 'files' directory
location /files/ {
try_files $uri /index.php;
deny all;
}
}
Disponibilize o site
# ln -s /etc/nginx/sites-available/servicedesk.conf /etc/nginx/sites-enabled/servicedesk
Avaliar a configuração do NGINX
# nginx -t <- Se ok então reinicie os serviços
Reinicie os serviços
# systemctl restart nginx.service php7.3-fpm.service
# systemctl restart mariadb.service
Permissão de acesso (APAGAR)
location ~ ^/glpi/files/(.+)$ {
deny all;
}
location ~ ^/glpi/config/(.+)$ {
deny all;
}
Acesse a pagina WEB
Para as versões mais novas 9.5 é possível realizar o registro de conta GLPI para poder utilizar alguns recursos, pora isso acesse https://services.glpi-network.com/ e proceda com a criação de conta.
Fazer o backup do diretório glpi e da base de dados.
Disponibilizar o novo arquivo de versão e popular os arquivos.
# mv glpi glpi.APAGAR && tar zvxf glpi-9.5.3.tgz && \
cd glpi && mv pics/ pics.00 && mv plugins/ plugins.00 && \
mv files/ files.00 && cp -a ../glpi.APAGAR/pics/ . && \
cp -a ../glpi.APAGAR/files/ . && cp -a ../glpi.APAGAR/plugins/ . && \
cp -a ../glpi.APAGAR/config/glpicrypt.key config/
Redefinir as permissões.
# cd .. && find glpi -type d -exec chmod 755 "{}" \; && \
find glpi -type f -exec chmod 644 "{}" \; && \
chmod -R 777 glpi/plugins && chmod -R 777 glpi/files/_log && \
chown www-data.www-data -R glpi
Reiniciar os serviços.
# systemctl restart nginx.service php7.3-fpm.service
Visualizar as configurações de acesso a banco.
# cat glpi.APAGAR/config/config_db.php
Abrir interface web e configurar e seguir os passo, muito parecido com a instalação.
Remover os arquivos de instalação.
# cd glpi && mv install/ install.00
Por motivos de segurança remova o arquivo install/install.php após o processo de instalação. Desabilite ou troque as senhas dos usuarios default.