Skip to content

Instantly share code, notes, and snippets.

@molzieyy
Created June 13, 2019 18:10
Show Gist options
  • Save molzieyy/81d97c1d5fdcaf1af0f8286454f83500 to your computer and use it in GitHub Desktop.
Save molzieyy/81d97c1d5fdcaf1af0f8286454f83500 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
#######################################
# Bash script to install apps on a new system (Ubuntu)
# Written by @slackware from slackware609[at]gmail.com
#######################################
#CHANGING DIRECTORY TO TEMP
echo '##...Downloading Wordpress'
cd /tmp
curl -LO https://wordpress.org/latest.tar.gz
#Extract the compressed file to create the WordPress directory structure:
echo 'Extracting wp.......'
tar xzvf latest.tar.gz
#We will be moving these files into our document root momentarily.
echo 'copying sample config'
cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php
#create our site directory
echo "Enter Directory Name of where to install your wp site eg mysite ..this will be under /var/www/mysite";
read WP_DIR;
sudo mkdir -p /var/www/${WP_DIR}
#We are using the -a flag to make sure our permissions are maintained.
echo "Copying files to /var/www/"${WP_DIR}
sudo cp -a /tmp/wordpress/. /var/www/${WP_DIR}
#assign ownership them to the www-data
sudo chown -R www-data:www-data /var/www/${WP_DIR}
#We can set the setgid bit on every directory in our WordPress installation by typing:
sudo find /var/www/${WP_DIR} -type d -exec chmod g+s {} \;
#There are a few other fine-grained permissions we'll adjust. First, we'll give group write access to the wp-content directory so that the web interface can make theme an$
sudo chmod g+w /var/www/${WP_DIR}/wp-content
#As part of this process, we will give the web server write access to all of the content in these two directories:
sudo chmod -R g+w /var/www/${WP_DIR}/wp-content/themes
sudo chmod -R g+w /var/www/${WP_DIR}/wp-content/plugins
@molzieyy
Copy link
Author

molzieyy commented Jun 8, 2024

echo "Enter Directory Name of where to install your wp site eg mysite ..this will be under /var/www/mysite";
read WP_DIR;
sudo mkdir -p /var/www/${WP_DIR}
#We are using the -a flag to make sure our permissions are maintained.
echo "Copying files to /var/www/"${WP_DIR}

#assign ownership them to the www-data
sudo chown -R www-data:www-data /var/www/${WP_DIR}
#We can set the setgid bit on every directory in our WordPress installation by typing:
sudo find /var/www/${WP_DIR} -type d -exec chmod g+s {} ;
#There are a few other fine-grained permissions we'll adjust. First, we'll give group write access to the wp-content directory so that the web interface can make theme an$
sudo chmod g+w /var/www/${WP_DIR}/wp-content

#As part of this process, we will give the web server write access to all of the content in these two directories:
sudo chmod -R g+w /var/www/${WP_DIR}/wp-content/themes
sudo chmod -R g+w /var/www/${WP_DIR}/wp-content/plugins``

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment