-
Notifications
You must be signed in to change notification settings - Fork 0
/
wordpress.sh
52 lines (36 loc) · 1.35 KB
/
wordpress.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
#!/bin/bash -x
MYSQL_VERSION=mysql80-community-release-el7-3.noarch.rpm
# Download MySQL server
wget -q -O /tmp/$MYSQL_VERSION https://dev.mysql.com/get/$MYSQL_VERSION
# Resolve and install mysql dependencies
sudo yum localinstall -y /tmp/$MYSQL_VERSION
# Install mysql server
sudo yum install -y mysql-community-server
# Enable service on startup
sudo systemctl enable mysqld
# Start mysql service
sudo systemctl start mysqld
# Wait for service start
sleep 5
# PHP wordpress dependency, must be version 5.20 at least
sudo amazon-linux-extras install php7.2 -y
# Apache server
sudo yum -y install httpd
# Enable httpd service on startup
sudo systemctl enable httpd
# Start httpd service
sudo systemctl start httpd
# Download wordpress
wget -q -O /tmp/latest.tar.gz https://wordpress.org/latest.tar.gz
# Extracting latest.tar.gz on tmp directory
sudo tar -xzf /tmp/latest.tar.gz -C /tmp/
# Move wordpress directory content to apache directory
sudo mv /tmp/wordpress/* /var/www/html/
# Changing permission of wordpress files
sudo chmod -R 755 /var/www/html/*
# Create user and grant permission to wordpress database
sudo mysql -u ${master_rds_user} -h ${host} -p"${master_rds_user_password}" << EOF
CREATE USER ${wordpress_user}@"%" IDENTIFIED BY "${wordpress_user_password}";
GRANT ALL PRIVILEGES ON ${wordpress_database}.* TO ${wordpress_user}@"%";
FLUSH PRIVILEGES;
EOF