#!/bin/bash # Exit on any error set -e # Define MySQL root password and Snipe-IT DB info MYSQL_ROOT_PASSWORD="StrongRootPass123!" SNIPEIT_DB="snipeit" SNIPEIT_USER="snipeuser" SNIPEIT_PASS="SnipeUserPass456!" echo "Updating system..." apt update && apt upgrade -y echo "Installing required packages..." apt install -y apache2 mariadb-server php php-mysql php-curl php-gd php-mbstring php-xml php-bcmath php-zip php-tokenizer unzip git curl composer echo "Starting and securing MySQL..." systemctl enable mariadb systemctl start mariadb mysql -u root < /etc/apache2/sites-available/snipeit.conf ServerAdmin admin@example.com DocumentRoot /var/www/snipeit/public Options Indexes FollowSymLinks AllowOverride All Require all granted ErrorLog \${APACHE_LOG_DIR}/snipeit_error.log CustomLog \${APACHE_LOG_DIR}/snipeit_access.log combined EOF echo "Enabling Apache config..." a2enmod rewrite a2ensite snipeit a2dissite 000-default systemctl reload apache2 echo "Snipe-IT installation completed!" echo "Access it at: http:///"