Skip to content

Instantly share code, notes, and snippets.

@sostenesapollo
Last active May 13, 2024 15:02
Show Gist options
  • Save sostenesapollo/33fbdf77e9b6b8635f8196912f878373 to your computer and use it in GitHub Desktop.
Save sostenesapollo/33fbdf77e9b6b8635f8196912f878373 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Install PHP 5.6 and other dependencies
sudo apt-get update
sudo apt-get install -y software-properties-common ca-certificates lsb-release apt-transport-https
sudo LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
sudo apt-get update && sudo apt-get install -y php5.6-zip apache2 php5.6 php5.6-mysql php5.6-ldap curl php5.6-mcrypt mariadb-server
# Install Composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
# Install Novo SGA
sudo composer create-project novosga/novosga /var/www/novosga 1.5.1 -vvv
sudo chown -R www-data:www-data /var/www/novosga/
# Create MySQL database and user
sudo mysql -e "CREATE DATABASE sgadb;"
sudo mysql -e "CREATE USER 'sgauser'@'localhost' IDENTIFIED BY 'SenhaNovoSGA';"
sudo mysql -e "GRANT ALL PRIVILEGES ON sgadb.* TO 'sgauser'@'localhost';"
# Configure Apache
sudo sed -i 's|/var/www/html|/var/www/novosga/public|g' /etc/apache2/sites-available/000-default.conf
sudo sed -i 's|AllowOverride None|AllowOverride All|g' /etc/apache2/apache2.conf
echo 'date.timezone = America/Sao_Paulo' | sudo tee /etc/php/5.6/apache2/conf.d/datetimezone.ini
sudo a2enmod rewrite
sudo service apache2 restart
# In .bashrc
sudo service mariadb start
sudo service apache2 start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment