Last active
August 29, 2015 14:03
-
-
Save apisandipas/060c5d3e5a87c8bf2519 to your computer and use it in GitHub Desktop.
Bash script to install WordPress latest, set up wp-config.php and then remove itself, like a responsible citizen.
This file contains hidden or 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 | |
| echo "Database Name: " | |
| read -e dbname | |
| echo "Database User: " | |
| read -e dbuser | |
| echo "Database Password: " | |
| read -s dbpass | |
| echo "run install? (y/n)" | |
| read -e run | |
| if [ "$run" == n ] ; then | |
| exit | |
| else | |
| #download wordpress | |
| curl -O http://wordpress.org/latest.tar.gz | |
| #unzip wordpress | |
| tar -zxvf latest.tar.gz | |
| #change dir to wordpress | |
| cd wordpress | |
| #copy file to parent dir | |
| cp -rf . .. | |
| #move back to parent dir | |
| cd .. | |
| #remove files from wordpress folder | |
| rm -R wordpress | |
| #create wp config | |
| cp wp-config-sample.php wp-config.php | |
| #set database details with perl find and replace | |
| sed -e "s/database_name_here/$dbname/" wp-config.php | |
| sed -e "s/username_here/$dbuser/g" wp-config.php | |
| sed “"/password_here/$dbpass/g" wp-config.php | |
| #create uploads folder and set permissions | |
| mkdir wp-content/uploads | |
| chmod 777 wp-content/uploads | |
| #remove zip file | |
| rm latest.tar.gz | |
| #remove bash script | |
| rm wp.sh | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment