-
Notifications
You must be signed in to change notification settings - Fork 0
/
new-wp-install.sh
74 lines (68 loc) · 2.47 KB
/
new-wp-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# GET ALL USER INPUT
tput setaf 2; echo "Domain Name (eg. example.com)?"
read DOMAIN
tput setaf 2; echo "Username (eg. database name)?"
read USERNAME
tput setaf 2; echo "Updating OS................."
sleep 2;
tput sgr0
sudo apt-get update
tput setaf 2; echo "Sit back and relax :) ......"
sleep 2;
tput sgr0
cd /etc/nginx/sites-available/
sudo wget -qO "$DOMAIN" https://raw.githubusercontent.com/alexyz41/High-Traffic-wordpress-server-configuration/master/sites-available/example.com.conf
sudo sed -i -e "s/example.com/$DOMAIN/" "$DOMAIN"
sudo sed -i -e "s/www.example.com/$DOMAIN/" "$DOMAIN"
sudo ln -s /etc/nginx/sites-available/"$DOMAIN" /etc/nginx/sites-enabled/
sudo mkdir -p /var/www/"$DOMAIN"/public
cd /var/www/"$DOMAIN/public"
sudo systemctl restart nginx.service
sudo certbot --nginx -d "$DOMAIN" -d www."$DOMAIN" --redirect
cd /etc/nginx/sites-available
sudo sed -i "/ssl_dhparam \/etc\/letsencrypt\/ssl-dhparams.pem; # managed by Certbot/a ssl_trusted_certificate \/etc\/letsencrypt\/live\/$DOMAIN\/chain.pem;" "$DOMAIN"
sudo systemctl restart nginx.service
cd ~
PASS=`pwgen -s 14 1`
sudo mysql -uroot <<MYSQL_SCRIPT
CREATE DATABASE $USERNAME;
CREATE USER '$USERNAME'@'localhost' IDENTIFIED BY '$PASS';
GRANT ALL PRIVILEGES ON $USERNAME.* TO '$USERNAME'@'localhost';
FLUSH PRIVILEGES;
MYSQL_SCRIPT
cd /var/www/"$DOMAIN/public"
tput setaf 2; echo "Downloading Latest Wordpress...."
sleep 2;
tput sgr0
sudo wp core download --locale=es_ES --allow-root
sudo wp config create --dbname="$USERNAME" --dbuser="$USERNAME" --dbpass="$PASS" --allow-root
tput setaf 2; echo "Site title?"
read TITLE
tput setaf 2; echo "Wordpress username?"
read WPUSERNAME
tput setaf 2; echo "Wordpress email?"
read EMAIL
sudo wp core install --url="$DOMAIN" --title="$TITLE" --admin_user="$WPUSERNAME" --admin_password="$PASS" --admin_email="$EMAIL" --allow-root
sudo chown www-data:www-data -R /var/www/"$DOMAIN"/public
sudo systemctl restart nginx.service
echo
echo
tput setaf 2; echo "Here is your Credentials"
echo "--------------------------------"
echo "Website: https://$DOMAIN"
echo "Dashboard: https://$DOMAIN/wp-admin"
echo
tput setaf 4; echo "Database Name: $USERNAME"
tput setaf 4; echo "Database Username: $USERNAME"
tput setaf 4; echo "Database Password: $PASS"
echo "--------------------------------"
tput sgr0
echo
echo
tput setaf 3; echo "Installation & configuration succesfully finished."
echo
echo "Twitter @bajpangosh"
echo "E-mail: [email protected]"
echo "Bye! Your boy KLOUDBOY!"
tput sgr0