Last active
June 6, 2016 10:49
-
-
Save chriskonnertz/83ce97acafab430284d9 to your computer and use it in GitHub Desktop.
Contentify DigitalOcean Installation Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
clear | |
echo "--- Contentify DigitalOcean Installation Script ---" | |
# Set variables | |
RELEASEFILE="contentify_1_2_0" | |
CMSURL="contentify.org/share/releases/" | |
# Activate the mod_rewrite module | |
sudo a2enmod rewrite | |
# Change the document root | |
/bin/cat <<EOM >/etc/apache2/sites-available/000-default.conf | |
<VirtualHost *:80> | |
ServerAdmin webmaster@localhost | |
DocumentRoot /var/www/html/public | |
<Directory "/var/www/html/public/"> | |
Options Indexes FollowSymLinks MultiViews | |
AllowOverride All | |
Order allow,deny | |
allow from all | |
</Directory> | |
ErrorLog /var/www/error.log | |
CustomLog /var/www/access.log combined | |
</VirtualHost> | |
EOM | |
# Install the PHP mcrypt extension | |
sudo php5enmod mcrypt | |
# Create database | |
echo "" | |
echo "--- Creating Database ---" | |
# Show the 5. line of the "Message of the Day" file where the pw is stored | |
sed '5!d' /etc/motd.tail | |
echo "Please enter the password shown above: " | |
read SQLPW | |
mysql --user=root --password=$SQLPW -e "CREATE DATABASE contentify CHARACTER SET=utf8 COLLATE=utf8_unicode_ci" | |
# Secure the database | |
mysql --user=root --password=$SQLPW -e "DROP USER ''@'localhost'" | |
mysql --user=root --password=$SQLPW -e "DROP USER ''@'$(hostname)'" | |
mysql --user=root --password=$SQLPW -e "DROP DATABASE test" | |
mysql --user=root --password=$SQLPW -e "FLUSH PRIVILEGES" | |
# Restart Apache | |
sudo service apache2 restart | |
# Install unzip | |
apt-get install unzip | |
# Go to www dir | |
cd /var/www/ | |
# Remove html dir | |
rm -rf html | |
# Download the CMS | |
wget ${CMSURL}${RELEASEFILE}.zip | |
# Unzip | |
unzip -q ${RELEASEFILE}.zip >/dev/null | |
# Delete zip file | |
rm ${RELEASEFILE}.zip | |
# Rename dir | |
mv $RELEASEFILE html | |
# Change access permissions | |
cd html | |
chmod -R 777 storage | |
chmod -R 777 bootstrap/cache | |
chmod -R 777 public/uploads | |
chmod -R 777 public/rss | |
chmod -R 777 public/share | |
# Save the MySQL password | |
sed -i '65s/.*/"password" => env("DB_PASSWORD", "'$SQLPW'"),/' config/database.php | |
clear | |
echo "" | |
echo "--- Done. You are ready to install Contentify! ---" | |
echo "--- With your browser, navigate to your website. ---" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment