money/firefly/ubuntu-old/script.sh

51 lines
1.6 KiB
Bash
Executable File

#! /bin/bash
set -e
set -u
apt -y update && apt -y upgrade && apt -y autoremove
DEBIAN_FRONTEND=noninteractive apt -y install tzdata
apt -y install vim locales language-pack-en-base
echo '127.0.0.1 firefly-iii-domain.com firefly-iii localhost' >> /etc/hosts
apt -y install fail2ban
apt -y install mariadb-server nginx php-fpm php7.2-mysql php-curl php-gd php-bcmath php-zip php-intl php-mbstring php-xml
service mysql start
echo 'FLUSH PRIVILEGES; ' \
'USE mysql; ' \
'UPDATE user SET authentication_string=PASSWORD("pwd") WHERE User='"'"'root'"'"'; ' \
'UPDATE user SET plugin="mysql_native_password" WHERE User='"'"'root'"'"'; ' \
| mysql -u root || true
service mysql restart
sleep 5
echo 'create database fireflyiii character set utf8 collate utf8_bin; ' \
'grant all privileges on fireflyiii.* to fireflyiii@localhost identified by '"'"'pwd'"'"'; ' \
| mysql -uroot -ppwd
service mysql restart
apt -y install curl
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
cd /opt
composer create-project grumpydictator/firefly-iii --no-dev --prefer-dist firefly-iii 4.7.4
cp /copied/env /opt/firefly-iii/.env
cd firefly-iii
php artisan migrate:refresh --seed
php artisan passport:install
chown -R www-data:www-data /opt/firefly-iii/
rm /etc/nginx/sites-enabled/default
touch /etc/nginx/sites-available/firefly-iii.conf
ln -s /etc/nginx/sites-available/firefly-iii.conf /etc/nginx/sites-enabled/firefly-iii.conf
openssl dhparam 2048 > /etc/nginx/dhparam.pem
cp /copied/firefly-iii.conf /etc/nginx/sites-enabled/firefly-iii.conf
mkdir -p /run/php