|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +RED='\033[1;31m' |
| 4 | +NC='\033[0m' |
| 5 | + |
| 6 | +echo -e "${RED} |
| 7 | +################################################################################################################ |
| 8 | +# Your MarketPlace App has been deployed successfully! # |
| 9 | +# Passwords are stored under /root/ # |
| 10 | +# Please spend 2 minutes for configuration # |
| 11 | +# Kindly update the below configuration to complete the setup # |
| 12 | +################################################################################################################ |
| 13 | +${NC}" |
| 14 | + |
| 15 | +echo |
| 16 | +echo -e "${RED}This message will be removed in the next login!${NC}" |
| 17 | +echo |
| 18 | +echo |
| 19 | +echo -e "${RED}Use the Below Password for logging into MySQL${NC}" |
| 20 | +echo |
| 21 | +cat /root/.mysql_root_password |
| 22 | +echo |
| 23 | +echo -e "${RED}Use the Below Password for logging into Phpmyadmin${NC}" |
| 24 | +echo |
| 25 | +cat /root/.phpmyadmin_password |
| 26 | +echo |
| 27 | +echo -e "${RED}Refer to the below wordpress database login details${NC}" |
| 28 | +echo |
| 29 | +cat /root/.wordpress_database_details |
| 30 | +echo |
| 31 | + |
| 32 | +# WordPress Salts |
| 33 | +for i in `seq 1 8` |
| 34 | +do |
| 35 | + wp_salt=$(</dev/urandom tr -dc 'a-zA-Z0-9!@#$%^&*()\-_ []{}<>~`+=,.;:/?|' | head -c 64 | sed -e 's/[\/&]/\\&/g') |
| 36 | + sed -e "0,/put your unique phrase here/s/put your unique phrase here/${wp_salt}/" \ |
| 37 | + -i /var/www/html/wp-config.php; |
| 38 | +done |
| 39 | + |
| 40 | +#Cleanup script |
| 41 | +rm -rf /usr/local/src/ |
| 42 | +mkdir -p /usr/local/src/ |
| 43 | +rm -rf /var/lib/cloud/instances/* |
| 44 | +rm -rf /var/lib/cloud/data/* |
| 45 | +find /var/log -mtime -1 -type f -exec truncate -s 0 {} \; |
| 46 | +rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-???????? |
| 47 | +cat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp |
| 48 | +apt-get -y autoremove >/dev/null 2>&1 |
| 49 | +apt-get -y autoclean >/dev/null 2>&1 |
| 50 | +history -c |
| 51 | +cat /dev/null > /root/.bash_history |
| 52 | +unset HISTFILE |
| 53 | + |
| 54 | +#To replace the Domain Name in the apache configuration |
| 55 | +a=0 |
| 56 | +while [ $a -eq 0 ] |
| 57 | +do |
| 58 | + echo -e "${RED}To cancel setup, press Ctrl+C. This script will run again on your next login:${NC}" |
| 59 | + echo -e "${RED}Enter the domain name for your new WordPress site:${NC}" |
| 60 | + echo -e "${RED}(ex. example.org or test.example.org) do not include www or http/s:${NC}" |
| 61 | + read -p "Domain/Subdomain name: " dom |
| 62 | + if [ -z "$dom" ] |
| 63 | + then |
| 64 | + a=0 |
| 65 | + echo -e "${RED}Please provide a valid domain or subdomain name to continue to press Ctrl+C to cancel${NC}" |
| 66 | + else |
| 67 | + a=1 |
| 68 | +fi |
| 69 | +done |
| 70 | + |
| 71 | +sed -i "s/\$domain/$dom/g" /etc/apache2/sites-available/001-default.conf |
| 72 | + |
| 73 | +a2enconf block-xmlrpc >/dev/null 2>&1 |
| 74 | + |
| 75 | +wp plugin install smartarget-contact-us --activate --allow-root --path="/var/www/html" |
| 76 | +wp plugin install woocommerce --activate --allow-root --path="/var/www/html" |
| 77 | +wp plugin install wp-fail2ban --allow-root --path="/var/www/html" |
| 78 | +wp plugin activate wp-fail2ban --allow-root --path="/var/www/html" |
| 79 | + |
| 80 | +chown -Rf www-data.www-data /var/www/ |
| 81 | + |
| 82 | +systemctl restart apache2 |
| 83 | + |
| 84 | +rm -rf /root/.bashrc |
| 85 | +cp /etc/skel/.bashrc /root |
0 commit comments