diff --git a/updated_install1.sh b/updated_install1.sh index 85916c1..eba8b6a 100644 --- a/updated_install1.sh +++ b/updated_install1.sh @@ -5,6 +5,7 @@ HOSTNAME="wordpress.local" IP="127.0.0.1" SITE_CONF="/etc/apache2/sites-available/wordpress.conf" WEB_ROOT="/srv/www/wordpress" +DB_PASSWORD="changeme123" # ============================ # Update system @@ -38,16 +39,33 @@ cat << EOF | sudo tee "$SITE_CONF" > /dev/null EOF # Add hostname to /etc/hosts if not already present -if grep -q "$HOSTNAME" /etc/hosts; then - echo "Entry for $HOSTNAME already exists in /etc/hosts." -else - echo "Adding $HOSTNAME to /etc/hosts..." +if ! grep -q "$HOSTNAME" /etc/hosts; then echo "$IP $HOSTNAME" | sudo tee -a /etc/hosts > /dev/null - echo "Done." fi # Enable site and modules, disable default a2ensite wordpress.conf a2enmod rewrite a2dissite 000-default.conf -systemctl reload apache2 \ No newline at end of file +systemctl reload apache2 + +# Create WordPress database and user +sudo mysql -u root <> "$WP_CONFIG"