# D:\Documents\GitHub\itil-helpdesk\Advanced\deploy_itsm_v10016.sh GLPI VERSION 10.0.16 updated: 03/07/2024 # Code Deploy itil server On-premise: # Install Itil 10.0.16 on Ubuntu 20.04 linux server OS: # GLPI is a powerful open source IT service management (ITSM) software tool designed to help you plan and easily manage your IT operations. # This is source code deploy for Multi-tenance for more instance ITIL - ITSM. #!/bin/bash ############### Tham số cần thay đổi ở đây ################### echo "FQDN: e.g: demo.company.vn" # Đổi địa chỉ web thứ nhất Website Master for Resource code - để tạo cùng 1 Source code duy nhất read -e FQDN echo "dbname: e.g: itildata" # Tên DBNane read -e dbname echo "dbuser: e.g: userdata" # Tên User access DB lmsatcuser read -e dbuser echo "Database Password: e.g: P@$$w0rd-1.22" read -s dbpass echo "phpmyadmin folder name: e.g: phpmyadmin" # Đổi tên thư mục phpmyadmin khi add link symbol vào Website read -e phpmyadmin echo "ITIL Folder Data: e.g: itildata" # Tên Thư mục chưa Data vs Cache read -e FOLDERDATA echo "dbtype name: e.g: mariadb" # Tên kiểu Database read -e dbtype echo "dbhost name: e.g: localhost" # Tên Db host connector read -e dbhost echo "Your Email address fro Certbot e.g: thang@company.vn" # Địa chỉ email của bạn để quản lý CA read -e emailcertbot GitGLPIversion="10.0.16" echo "run install? (y/n)" read -e run if [ "$run" == n ] ; then exit else #Step 1. Install NGINX sudo apt-get update -y sudo apt-get install nginx -y sudo systemctl stop nginx.service sudo systemctl start nginx.service sudo systemctl enable nginx.service #Step 2. Install MariaDB/MySQL #Run the following commands to install MariaDB database for Moode. You may also use MySQL instead. sudo apt-get install mariadb-server mariadb-client -y #Like NGINX, we will run the following commands to enable MariaDB to autostart during reboot, and also start now. sudo systemctl stop mysql.service sudo systemctl start mysql.service sudo systemctl enable mysql.service #Run the following command to secure MariaDB installation. #password mysql mariadb , i'm fixed: M@tKh@uS3cr3t --> you must changit. sudo mysql_secure_installation < /etc/php/8.3/fpm/php.ini < /etc/mysql/mariadb.conf.d/50-server.cnf < /etc/hosts < Users. # This marks the end of installing GLPI on Ubuntu 20.04/18.04. The next sections are about adding assets and other IT Management stuff for your # infrastructure/environment. For this, please refer to the #Step 8. Configure NGINX #Them dong lenh xoa noi dung cau hinh trong file conf truoc khi dien thong tin chuan moi: cat > /etc/nginx/conf.d/${FQDN}.conf <> /etc/nginx/conf.d/$FQDN.conf echo ' root '/var/www/html/${FQDN}';'>> /etc/nginx/conf.d/$FQDN.conf echo ' index index.php index.html index.htm;'>> /etc/nginx/conf.d/$FQDN.conf echo ' server_name '${FQDN}';'>> /etc/nginx/conf.d/$FQDN.conf echo ' client_max_body_size 512M;'>> /etc/nginx/conf.d/$FQDN.conf echo ' autoindex off;'>> /etc/nginx/conf.d/$FQDN.conf echo ' location / {'>> /etc/nginx/conf.d/$FQDN.conf echo ' try_files $uri $uri/ =404;'>> /etc/nginx/conf.d/$FQDN.conf echo ' }'>> /etc/nginx/conf.d/$FQDN.conf echo ' location /dataroot/ {'>> /etc/nginx/conf.d/$FQDN.conf echo ' internal;'>> /etc/nginx/conf.d/$FQDN.conf echo ' alias '/var/www/html/$FOLDERDATA/';'>> /etc/nginx/conf.d/$FQDN.conf echo ' }'>> /etc/nginx/conf.d/$FQDN.conf echo ' location ~ [^/].php(/|$) {'>> /etc/nginx/conf.d/$FQDN.conf echo ' include snippets/fastcgi-php.conf;'>> /etc/nginx/conf.d/$FQDN.conf echo ' fastcgi_pass unix:/run/php/php8.3-fpm.sock;'>> /etc/nginx/conf.d/$FQDN.conf echo ' fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;'>> /etc/nginx/conf.d/$FQDN.conf echo ' include fastcgi_params;'>> /etc/nginx/conf.d/$FQDN.conf echo ' }'>> /etc/nginx/conf.d/$FQDN.conf echo ' location ~ ^/(doc|sql|setup)/{'>> /etc/nginx/conf.d/$FQDN.conf echo ' deny all;'>> /etc/nginx/conf.d/$FQDN.conf echo ' }'>> /etc/nginx/conf.d/$FQDN.conf echo '}'>> /etc/nginx/conf.d/$FQDN.conf #Save and close the file then verify the Nginx for any syntax error with the following command: nginx -t #Step 9. Setup and Configure PhpMyAdmin sudo apt update -y sudo apt install phpmyadmin -y #Step 10. gỡ bỏ apache: sudo service apache2 stop sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common sudo apt-get purge apache2 apache2-utils apache2-bin apache2.2-common sudo apt-get autoremove whereis apache2 apache2: /etc/apache2 sudo rm -rf /etc/apache2 sudo ln -s /usr/share/phpmyadmin /var/www/html/$FQDN/$phpmyadmin sudo chown -R root:root /var/lib/phpmyadmin sudo nginx -t #Step 11. Nâng cấp PhpmyAdmin lên version 5.2.1: sudo mv /usr/share/phpmyadmin/ /usr/share/phpmyadmin.bak sudo mkdir /usr/share/phpmyadmin/ cd /usr/share/phpmyadmin/ sudo wget https://files.phpmyadmin.net/phpMyAdmin/5.2.1/phpMyAdmin-5.2.1-all-languages.tar.gz sudo tar xzf phpMyAdmin-5.2.1-all-languages.tar.gz #Once extracted, list folder. ls #You should see a new folder phpMyAdmin-5.2.1-all-languages #We want to move the contents of this folder to /usr/share/phpmyadmin sudo mv phpMyAdmin-5.2.1-all-languages/* /usr/share/phpmyadmin ls /usr/share/phpmyadmin mkdir /usr/share/phpMyAdmin/tmp # tạo thư mục cache cho phpmyadmin sudo systemctl restart nginx systemctl restart php8.3-fpm.service #Step 12. Install Certbot sudo apt install certbot python3-certbot-nginx -y sudo certbot --nginx -d $FQDN --email $emailcertbot --agree-tos --redirect --hsts # You should test your configuration at: # https://www.ssllabs.com/ssltest/analyze.html?d=$FQDN #/etc/letsencrypt/live/$FQDN/fullchain.pem # Your key file has been saved at: # /etc/letsencrypt/live/$FQDN/privkey.pem # Your cert will expire on yyyy-mm-dd. To obtain a new or tweaked # version of this certificate in the future, simply run certbot again # with the "certonly" option. To non-interactively renew *all* of # your certificates, run "certbot renew" fi