Created
September 13, 2019 10:23
-
-
Save itechnotion/9dde7cff79db0bfa153831dca067fd34 to your computer and use it in GitHub Desktop.
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 -p | |
clear | |
echo "============================================" | |
echo "WordPress Install Script" | |
echo "============================================" | |
echo "DB Host: " | |
read dbhost | |
echo "Database Name: " | |
read dbname | |
echo "Database User: " | |
read dbuser | |
echo "Database Password: " | |
read dbpass | |
echo "run install? (y/n)" | |
read run | |
if [ "$run" == n ] ; then | |
exit | |
else | |
echo "============================================" | |
echo "A robot is now installing WordPress for you." | |
echo "============================================" | |
echo "Database Password: $dbpass " $dbpass | |
#download wordpress | |
curl -O https://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 -i "s/localhost/$dbhost/g" wp-config.php | |
sed -i "s/database_name_here/$dbname/g" wp-config.php | |
sed -i "s/username_here/$dbuser/g" wp-config.php | |
sed -i "s/password_here/$dbpass/g" wp-config.php | |
#set WP salts | |
perl -i -pe' | |
BEGIN { | |
@chars = ("a" .. "z", "A" .. "Z", 0 .. 9); | |
push @chars, split //, "!@#$%^&*()-_ []{}<>~\`+=,.;:/?|"; | |
sub salt { join "", map $chars[ rand @chars ], 1 .. 64 } | |
} | |
s/put your unique phrase here/salt()/ge | |
' wp-config.php | |
#create uploads folder and set permissions | |
mkdir wp-content/uploads | |
chmod 775 wp-content/uploads | |
echo "Cleaning..." | |
#remove zip file | |
rm latest.tar.gz | |
#remove bash script | |
rm wp.sh | |
echo "=========================" | |
echo "Installation is complete." | |
echo "=========================" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment