|
|
@ -13,21 +13,21 @@ NC="\e[0m" |
|
|
|
|
|
|
|
|
|
|
|
# ------------------- Step 1 - Installing / Configuring MariaDB ------------------- |
|
|
|
# ------------------- Step 1 - Installing / Configuring MariaDB ------------------- |
|
|
|
|
|
|
|
|
|
|
|
if [ -f "/etc/debian_version" ]; then |
|
|
|
if [ -f "/etc/debian_version" ]; then |
|
|
|
DISTRO="debian" |
|
|
|
DISTRO="debian" |
|
|
|
echo "Debian, Ubuntu, or Raspbian OS detected." |
|
|
|
echo "Debian, Ubuntu, or Raspbian OS detected." |
|
|
|
elif [ -f "/etc/arch-release" ]; then |
|
|
|
elif [ -f "/etc/arch-release" ]; then |
|
|
|
DISTRO="arch" |
|
|
|
DISTRO="arch" |
|
|
|
echo "Arch- or Manjaro-based OS detected." |
|
|
|
echo "Arch- or Manjaro-based OS detected." |
|
|
|
elif [ $(uname | grep -c "Darwin") -eq 1 ]; then |
|
|
|
elif [ $(uname | grep -c "Darwin") -eq 1 ]; then |
|
|
|
DISTRO="mac" |
|
|
|
DISTRO="mac" |
|
|
|
echo "MacOS detected." |
|
|
|
echo "MacOS detected." |
|
|
|
else |
|
|
|
else |
|
|
|
echo "I don't know what OS you're running! Cancelling this operation." |
|
|
|
echo "I don't know what OS you're running! Cancelling this operation." |
|
|
|
exit 1 |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
echo "" |
|
|
|
echo "" |
|
|
|
|
|
|
|
|
|
|
|
install_if_needed() { |
|
|
|
install_if_needed() { |
|
|
|
for package in "$@" |
|
|
|
for package in "$@" |
|
|
@ -114,7 +114,7 @@ while [[ -z $WP_DIR ]]; do |
|
|
|
fi |
|
|
|
fi |
|
|
|
done |
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
if [[ -z $(ls -A $WP_DIR) ]]; then |
|
|
|
if [[ -z $(ls -A $WP_DIR/wordpress) ]]; then |
|
|
|
tar -xzvf resources/wordpress.tar.gz --directory $WP_DIR |
|
|
|
tar -xzvf resources/wordpress.tar.gz --directory $WP_DIR |
|
|
|
echo "Wordpress has been extracted to $WP_DIR"! |
|
|
|
echo "Wordpress has been extracted to $WP_DIR"! |
|
|
|
else |
|
|
|
else |
|
|
@ -137,6 +137,45 @@ echo "Done!" |
|
|
|
|
|
|
|
|
|
|
|
# ------------------- Step 3 - NGINX Setup ------------------- |
|
|
|
# ------------------- Step 3 - NGINX Setup ------------------- |
|
|
|
echo "" |
|
|
|
echo "" |
|
|
|
sudo cp resources/wordpress.nginx.conf /etc/nginx/sites-available/wp |
|
|
|
echo "We might need to query DNS records here..." |
|
|
|
|
|
|
|
install_if_needed dig |
|
|
|
# Deleting location block |
|
|
|
echo "" |
|
|
|
|
|
|
|
read -p "Do you have a domain name pointing to this computer? (y/n): " -n1 boot |
|
|
|
|
|
|
|
echo "" |
|
|
|
|
|
|
|
case $boot in |
|
|
|
|
|
|
|
y | Y) |
|
|
|
|
|
|
|
echo "Good to hear! What is it?" |
|
|
|
|
|
|
|
read -p "http://" domain |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
echo "Okay, let's just configure it to your external IP for now." |
|
|
|
|
|
|
|
domain=$(dig @resolver4.opendns.com myip.opendns.com +short) |
|
|
|
|
|
|
|
echo "Looks like you're running on ${domain}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
echo "" |
|
|
|
|
|
|
|
WP_NGINX_CONF=/etc/nginx/sites-available/wp |
|
|
|
|
|
|
|
sudo cp resources/wordpress.nginx.conf $WP_NGINX_CONF |
|
|
|
|
|
|
|
sudo sed -i "s#SERVER_NAME#${domain}#" $WP_NGINX_CONF |
|
|
|
|
|
|
|
sudo sed -i "s#FILE_ROOT#${WP_DIR}/wordpress#" $WP_NGINX_CONF |
|
|
|
|
|
|
|
sudo ln -s /etc/nginx/sites-available/wp /etc/nginx/sites-enabled/ |
|
|
|
|
|
|
|
echo "" |
|
|
|
|
|
|
|
sudo systemctl reload nginx |
|
|
|
|
|
|
|
echo "Excellent! We've configured $WP_NGINX_CONF to serve your WordPress site from $domain" |
|
|
|
|
|
|
|
echo "" |
|
|
|
|
|
|
|
# ------------------- Step 4 - Certbot ------------------- |
|
|
|
|
|
|
|
read -p "Would you like to enable SSL via Certbot? (y/n): " -n1 boot |
|
|
|
|
|
|
|
echo "" |
|
|
|
|
|
|
|
case $boot in |
|
|
|
|
|
|
|
y | Y) |
|
|
|
|
|
|
|
echo "Alright, let's get Certbot in here!" |
|
|
|
|
|
|
|
install_if_needed python3 certbot python3-certbot-nginx |
|
|
|
|
|
|
|
echo "${BOLD}Take it away, Certbot${NC}" |
|
|
|
|
|
|
|
sudo certbot --nginx |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
echo "Yea, SSL is lame anyways..." |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
echo "" |
|
|
|
|
|
|
|
echo "Okay, well that's everything! You should be ready to continue your WordPress setup by opening $domain in your browser." |
|
|
|