Last active
August 29, 2015 14:22
-
-
Save saxenap/7378414e777405c6ef9c to your computer and use it in GitHub Desktop.
Wordpress Install.
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 | |
# | |
# Copyright (c) 2014-2017 Praveen Saxena <> | |
# License: BSD-3-Clause | |
# | |
# To get: | |
# rm -rf wordpress-install && wget -O wordpress-install https://gist.githubusercontent.com/saxenap/7378414e777405c6ef9c/raw && chmod 777 wordpress-install && ./wordpress-install | |
url=$(curl http://169.254.169.254/latest/meta-data/public-ipv4) | |
title='Test' | |
wpUser='admin' | |
wpUserPass='adminpassword' | |
wpUserEmail='[email protected]' | |
dbHost='localhost' | |
dbName='wordpress-db' | |
dbUser='wordpress-user' | |
dbPass='wordpress-password' | |
dbCharset='utf8' | |
dbCollate= | |
tablePrefix=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 1) | |
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar | |
chmod 755 wp-cli.phar | |
sudo mv wp-cli.phar /usr/local/bin/wp | |
sudo ln -s /usr/local/bin/wp /usr/bin/wp | |
echo " Installed: WP-CLI." | |
wp core config --dbname=$dbName --dbuser=$dbUser --dbpass=$dbPass --dbprefix=$tablePrefix --dbcharset=$dbCharset --extra-php <<PHP | |
define( 'WP_DEBUG', true ); | |
define( 'WP_DEBUG_LOG', true ); | |
define('WP_DEBUG_DISPLAY', true); | |
@ini_set('display_errors','On'); | |
PHP | |
echo " Generated: wp-config.php." | |
wp core install --url=$url --title=$title --admin_user=$wpUser --admin_password=$wpUserPass --admin_email=$wpUserEmail | |
echo " Installed: Wordpress." | |
sudo yum -y install mysql55-server | |
sudo service mysqld start | |
sudo chkconfig mysqld on | |
echo " Installed: Mysql." | |
mysql -u root -e "CREATE USER '"${dbUser}"'@'"${dbHost}"' IDENTIFIED BY '"${dbPass}"';" | |
mysql -u root -e "CREATE DATABASE \`${dbName}\`;" | |
mysql -u root -e "GRANT ALL PRIVILEGES ON \`${dbName}\`.* TO "\"${dbUser}\""@"\"${dbHost}\"";" | |
mysql -u root -e "FLUSH PRIVILEGES;" | |
echo " Created: Wordpress Database and User." | |
usermod -a -G www apache | |
sudo service httpd restart | |
sudo chkconfig httpd on | |
echo "Success: Wordpress Installation Finished." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment