#!/bin/bash -e APP_DB='q2w' APP_DB_PASS=$(< /dev/urandom tr -dc _A-Za-z0-9 | head -c32); DATA_DIR='/var/www/data' CACHE_DIR='/var/www/cache' APPS_DIR='/var/www/html/apps' if [ ! -d installer ]; then echo "Usage: ./installer/app-installer.sh" exit 1 fi # 1. Install packages (assume PG is preinstalled) apt-get -y install apache2 libapache2-mod-php php-{pgsql,zip,gd} proftpd # setup apache a2enmod ssl headers expires cp installer/apache2.conf /etc/apache2/sites-available/default-ssl.conf a2ensite default-ssl a2dissite 000-default systemctl reload apache2 sed -i.save ' s/#DefaultRoot~/DefaultRoot ~/ s/# RequireValidShelloff/RequireValidShell off/' /etc/proftpd/proftpd.conf systemctl enable proftpd systemctl restart proftpd # 2. Create db su postgres <> /root/auth.txt mkdir -p "${APPS_DIR}" mkdir -p "${CACHE_DIR}" mkdir -p "${DATA_DIR}" chown -R www-data:www-data "${APPS_DIR}" chown -R www-data:www-data "${CACHE_DIR}" chown -R www-data:www-data "${DATA_DIR}" cat >admin/incl/const.php < CAT_EOF cp -r . /var/www/html/ chown -R www-data:www-data /var/www/html rm -rf /var/www/html/installer systemctl restart apache2 # create group for all FTP users groupadd qatusers # install ftp user creation script for f in create delete; do cp installer/${f}_ftp_user.sh /usr/local/bin/ chown www-data:www-data /usr/local/bin/${f}_ftp_user.sh chmod 0550 /usr/local/bin/${f}_ftp_user.sh done cat >/etc/sudoers.d/q2w <