#!/bin/bash
R='\033[0;31m'
G='\033[0;32m'
B='\033[0;96m'
IP='{ip}'
SITE='{domain}'
DBUSER='{user}'
DBPASSWORD='{password}'
DBNAME='{db}'
WPUSER='{admin}'
WPPASSWORD='{pass}'
WPEMAIL='{email}'
LOCAL='en_US'
echo -e "${G}Add ${SITE} to hosts..."
echo "${IP} ${SITE}" >> /etc/hosts
sleep 1
clear
echo -e "${G}Add ${SITE} Vhost..."
touch "/etc/apache2/sites-available/${SITE}.conf"
echo "<VirtualHost *:80>
ServerAdmin {user}@${SITE}
ServerName ${SITE}
ServerAlias www.${SITE}
DocumentRoot \"/var/www/html/${SITE}\"
DirectoryIndex index.php
<Directory \"/var/www/html/${SITE}/\">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>" > "/etc/apache2/sites-available/${SITE}.conf"
a2ensite ${SITE}
service apache2 restart
sleep 1
clear
echo -e "${G}Creating ${SITE} database..."
mysql -u root -e "CREATE USER '${DBUSER}'@'localhost' IDENTIFIED BY '${DBPASSWORD}';"
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO '${DBUSER}'@'localhost' WITH GRANT OPTION;"
mysql -u root -e "FLUSH PRIVILEGES;"
mysql -u root -e "CREATE DATABASE IF NOT EXISTS ${DBNAME};"
echo -e "${G}Creating ${SITE}..."
mkdir ${SITE}
cd ${SITE}
wp core download --locale=${LOCAL} --skip-content --allow-root
wp config create --dbname=${DBNAME} --dbuser=${DBUSER} --dbpass=${DBPASSWORD} --allow-root --extra-php <<PHP
define('WP_DEBUG', true);
define('WP_DEBUG_DISPLAY', true);
define('WP_DEBUG_LOG', true);
PHP
wp core install --url=${SITE} --title=Debug --admin_user=${WPUSER} --admin_password=${WPPASSWORD} --admin_email=${WPEMAIL} --skip-email --allow-root
wp theme install twentytwentythree --allow-root
wp theme install generatepress --activate --allow-root
wp plugin install wp-crontrol --activate --allow-root
wp plugin install transients-manager --activate --allow-root
wp plugin install query-monitor --activate --allow-root
wp plugin install debug-bar --activate --allow-root
wp plugin install health-check --activate --allow-root
wp plugin install wp-reset --allow-root
sleep 1
clear
- Jihad Sinnaour - Jakiboy (Initial work)
Please give it a Star if you like the project.