Wordpress Setup
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

wordpress-setup.sh 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #!/bin/bash
  2. # Wordpress install script
  3. # Written by Joshua Mudge
  4. # Ad Mejorem Dei Glorium
  5. version="v1.1.0"
  6. curl -s "https://gitlab.daplie.com/sysadmin/daplie-snippets/raw/master/dss/setup.sh" | bash
  7. dss --user $USER init
  8. #sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
  9. sudo apt-get install nginx unzip php-fpm php-xml php-xmlrpc software-properties-common php-mysql mysql-server zip php-gd php-bcmath php-curl php-imagick -y
  10. wget https://wordpress.org/latest.zip
  11. sudo mkdir /var/www/wordpress
  12. unzip latest.zip
  13. sudo mv wordpress/* /var/www/website/
  14. sudo add-apt-repository -y ppa:certbot/certbot
  15. sudo apt-get update
  16. sudo apt-get install -y python-certbot-nginx certbot
  17. # user input required
  18. echo "Update Nginx configuration in /etc/nginx/sites-enabled/ using example configuration."
  19. echo "run: sudo certbot --authenticator webroot --installer nginx after configuring default_server and root directory. You will have to input the server root directory."
  20. # You could also run: sudo certbot certonly --webroot --webroot-path=/var/www/wordpress -d www.youdomain.com -d yourdomain.com"
  21. # For permalinks, add: try_files $uri $uri/ /index.php?$args; in place of the other try_files in configuration.
  22. # Fix perms sudo chown -R www-data:www-data /var/www/dir
  23. #Run: sudo mysql_secure_installation
  24. # Change Table prefix in interface if you have multiple sites.
  25. # mysql -u root mysql -p
  26. #CREATE DATABASE wordpress;
  27. #CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'newpassword';
  28. #GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost';
  29. #FLUSH PRIVILEGES;
  30. #quit
  31. # Install WP-CLI
  32. curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
  33. sudo chmod +x wp-cli.phar
  34. sudo mv wp-cli.phar /usr/local/bin/wp
  35. #https://askubuntu.com/questions/705458/ubuntu-15-10-mysql-error-1524-unix-socket
  36. #https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04
  37. # Create root crontab: 0 5 20 * * sudo letsencrypt renew --force-renew && sudo service nginx restart
  38. # Crontab for BASH autoupdate: * * * * 0 bash "cd /var/www/wordpress && wp core update && wp plugin update --all && wp theme update --all"
  39. # Make sure you get both default and default80 configs setup and have /var/www/wordpress setup properly and not at /var/www/wordpress/wordpress/
  40. # WP-CLI