Skip to content

Instantly share code, notes, and snippets.

@nicolasguzca
Last active April 25, 2023 22:16
Show Gist options
  • Save nicolasguzca/a08ebab82c1b2fab06376484d5c61633 to your computer and use it in GitHub Desktop.
Save nicolasguzca/a08ebab82c1b2fab06376484d5c61633 to your computer and use it in GitHub Desktop.
install_wordpress.sh
#!/bin/bash
#delete vesta default files
rm index.html
rm robots.txt
# Update packages and install necessary tools
sudo apt-get update
sudo apt-get install -y wget unzip
# Download and extract the latest WordPress package
#script for installing wordpress from a vps
wget https://wordpress.org/latest.zip
unzip latest.zip
# Move the extracted files to the current directory
mv wordpress/* .
# Set appropriate permissions
# Replace 'www-data' with the appropriate user and group for your web server
sudo chown -R www-data:www-data .
sudo chmod -R 755 .
# Clean up downloaded files
rm -f latest.zip
rm -rf wordpress
echo "WordPress has been downloaded and installed in the current directory!"
#vesta fixes
for i in `$VESTA/bin/v-list-sys-users | awk '{if(NR>2)print}'`; do
find /home/$i/web/ -name 'public_*html' -type d -print0 | xargs -0 -I {} find '{}' -type f -print0 | xargs -0 -I {} chmod 0644 {};
find /home/$i/web/ -name 'public_*html' -type d -print0 | xargs -0 -I {} find '{}' -type f -print0 | xargs -0 -I {} chown $i:$i {};
find /home/$i/web/ -name 'public_*html' -type d -print0 | xargs -0 -I {} find '{}' -type d -print0 | xargs -0 -I {} chmod 0755 {};
find /home/$i/web/ -name 'public_*html' -type d -print0 | xargs -0 -I {} find '{}' -type d -print0 | xargs -0 -I {} chown $i:$i {};
done
echo "Fixed user permissions."
#vesta PHP
for i in `/usr/local/vesta/bin/v-list-sys-users | awk '{if(NR>2)print}'`; do find /home/$i/web/ -name 'public_*html' -type d -print0 | xargs -0 -I {} chown $i:nginx {}; done
echo "All Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment