Hi all.
It’s been a busy time this summer so my posts have been very light as of late. But I thought I would go ahead and share with you a bash script for installing WordPress.
#!/bin/bash #Created by Bynw Analrye #Copyleft June 2013 AD clear #clears screen for a fresh start #Obtain Information for the WP Install read -p "Linux User Account: " luan read -p "Installation Path: " installdir read -r -p "WP URL (mywebsite.com): " wpURL read -p "MySQL Root Password: " -s msroot echo "" read -p "WP MySQL Username: " wpsqlun read -p "WP MySQL Password: " -s wpsqlpw echo "" read -p "WP MySQL Database Name: " wpsqldbn #Starting Install Proceedures echo "Setting up the MySQL database" echo "CREATE DATABASE $wpsqldbn;" | mysql -u root -p$msroot echo "CREATE USER '$wpsqlun'@'localhost' IDENTIFIED BY '$wpsqlpw';" | mysql -u root -p$msroot echo "GRANT ALL PRIVILEGES ON $wpsqldbn.* to '$wpsqlun'@'localhost';" | mysql -u root -p$msroot echo "FLUSH PRIVILEGES;" | mysql -u root -p$msroot echo "Successfully created $wpsqldbn MySQL database" #Creating Apache Virtual Host echo " ServerName $wpURL DocumentRoot $installdir DirectoryIndex index.php Options -Indexes FollowSymLinks AllowOverride All " > /etc/apache2/sites-available/$wpURL #Creating the Directory, Download, Unpack & Install WordPress echo "WP installation starting ... " mkdir -p $installdir wget -q "http://wordpress.org/latest.tar.gz" | tar --strip=1 -xzf latest.tar.gz -C $installdir rm latest.tar.gz echo "WP installation completed." #Setting Permissions usermod -a -G $luan www-data chmod g+w $installdir chmod -R g+w ${installdir}/wp-content # Enable the site a2ensite $wpURL a2enmod rewrite service apache2 restart echo "Your WP site named $wpURL is now active" echo "Please go to http://$wpURL or it's IP address and finish the installation" echo "You will need the following information: " echo "Your WordPress MySQL Database Name is: $wpsqldbn" echo "Your WordPress MySQL Username is: $wpsqlun" echo "Your WordPress MySQL Password is: $wpsqlpw" #EOF