bootstrap.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #!/usr/bin/env bash
  2. set -euo pipefail
  3. export DEBIAN_FRONTEND=noninteractive
  4. apt-get update
  5. apt-get install -y --no-install-recommends \
  6. apache2 \
  7. mariadb-server \
  8. php \
  9. libapache2-mod-php \
  10. php-cli \
  11. php-curl \
  12. php-gd \
  13. php-intl \
  14. php-mbstring \
  15. php-mysql \
  16. php-xml \
  17. php-zip \
  18. unzip \
  19. curl \
  20. ca-certificates
  21. a2enmod rewrite headers expires
  22. echo "ServerName desktop-support.test" >/etc/apache2/conf-available/servername.conf
  23. a2enconf servername
  24. cat >/etc/apache2/sites-available/desktop-support.conf <<'APACHE'
  25. <VirtualHost *:80>
  26. ServerName desktop-support.test
  27. DocumentRoot /vagrant/public
  28. <Directory /vagrant/public>
  29. Options Indexes FollowSymLinks
  30. AllowOverride All
  31. Require all granted
  32. </Directory>
  33. ErrorLog ${APACHE_LOG_DIR}/desktop-support-error.log
  34. CustomLog ${APACHE_LOG_DIR}/desktop-support-access.log combined
  35. </VirtualHost>
  36. APACHE
  37. a2dissite 000-default.conf
  38. a2ensite desktop-support.conf
  39. cat >/etc/php/development-overrides.ini <<'PHP'
  40. display_errors = On
  41. display_startup_errors = On
  42. error_reporting = E_ALL
  43. date.timezone = America/New_York
  44. PHP
  45. PHP_VERSION="$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')"
  46. ln -sf /etc/php/development-overrides.ini "/etc/php/${PHP_VERSION}/apache2/conf.d/99-development.ini"
  47. ln -sf /etc/php/development-overrides.ini "/etc/php/${PHP_VERSION}/cli/conf.d/99-development.ini"
  48. systemctl enable --now mariadb apache2
  49. mariadb <<'SQL'
  50. CREATE DATABASE IF NOT EXISTS desktop_support
  51. CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
  52. CREATE USER IF NOT EXISTS 'desktop_support'@'localhost' IDENTIFIED BY 'development_only';
  53. GRANT ALL PRIVILEGES ON desktop_support.* TO 'desktop_support'@'localhost';
  54. FLUSH PRIVILEGES;
  55. SQL
  56. apache2ctl configtest
  57. systemctl restart apache2
  58. echo "LAMP provisioning complete: http://localhost:8080"