dev-scripts/scripts/octobercms/local-install-octobercms.sh

47 lines
1.5 KiB
Bash
Raw Permalink Normal View History

2020-12-30 16:26:41 +00:00
#!/bin/sh
# NOTE - if changing the user, then the will need to edit apache config also
_user="www-data"
sudo apt install -y php php-ctype php-fileinfo php-sqlite3 php-cli php-mysql php-zip php-json php-gd php-mbstring php-curl php-xml php-pear php-bcmath php-pdo openssl mariadb-server vim unzip curl
sudo mysql -uroot << EOSQL
UPDATE mysql.user SET plugin = 'mysql_native_password' WHERE User = 'root';
CREATE USER 'october'@'localhost' IDENTIFIED BY 'october';
CREATE DATABASE october;
GRANT ALL ON october.* TO 'october'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EOSQL
sudo apt -y install apache2 libapache2-mod-php
mkdir /srv/octobercms && cd /srv/octobercms
php -r "eval('?>'.file_get_contents('https://octobercms.com/api/installer'));"
sudo chown -R "$_user":"$_user" /srv/octobercms
sudo -u "$_user" php artisan october:install
cat << 'EOF' > octobercms.conf
<VirtualHost *:80>
DocumentRoot /srv/octobercms/
ServerName october.home
ServerAlias october.home
<Directory /srv/octobercms/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/octobercms-error.log
CustomLog /var/log/apache2/octobercms-access.log combined
</VirtualHost>
EOF
sudo mv octobercms.conf /etc/apache2/sites-enabled/
sudo chown root:root /etc/apache2/sites-enabled/octobercms.conf
sudo rm /etc/apache2/sites-available/000-default.conf
sudo a2enmod rewrite
sudo systemctl restart apache2
echo "Now open 'http://localhost/backend/'"