Setting Up a WordPress Environment: Implementation Guide
■ Implementation Phase - 2022/03/27
Picking up where we left off, it's time to actually set up the WordPress environment.
Check out the previous article here.
I'll be using this guide as a reference.
https://qiita.com/cherubim1111/items/b259493a39e36f5d524b
I'm documenting the process as I go along for my own notes.
For now, I'll try installing the software directly onto my existing AWS EC2 Minecraft server.
– Logging into EC2 (Current Minecraft Server) via SSH –
Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.11.0-1028-aws x86_64)Documentation: https://help.ubuntu.com
Management: https://landscape.canonical.com
Support: https://ubuntu.com/advantage System information as of Sun Mar 27 11:04:03 JST 2022 System load: 0.02 Processes: 113
Usage of /: 67.3% of 7.69GB Users logged in: 0
Memory usage: 78% IPv4 address for eth0: 172.31.45.138
Swap usage: 0%
Ubuntu Pro delivers the most comprehensive open source security and
compliance features. https://ubuntu.com/aws/pro
52 updates can be applied immediately.
To see these additional updates run: apt list –upgradable
Looking at the current memory usage, we might already be in trouble! Memory capacity depends on the scale of your AWS server tier.
Designations like 't2' or 'micro' determine things like the server's CPU type, number of cores, and memory.
Getting a rough grasp of this was tricky when I first built the Minecraft server, but I'll talk about that separately.
t2.micro: 1GB … What I'm using now
t2.nano: 0.5GB … Cheapest, but no way
Useful information gathered upon logging in:
Currently,
・67.3% of the 7.69GB storage is in use.
・Memory usage is at 78%, out of an estimated total of 1GB.
I'd love to build a system that automatically emails me these stats without needing to log in manually.
Also, it's telling me there are updates available. I'll take care of those later.
– Checking the Timezone –
It's set to Asia/Tokyo, so we're good.
If yours isn't, you can configure it using `timedatectl`.
— Checking timezone
$sudo timedatectl
Local time: Sun 2022-03-27 13:15:16 JST
Universal time: Sun 2022-03-27 04:15:16 UTC
RTC time: Sun 2022-03-27 04:15:16
Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
– Installing Apache2
・Let's refocus and install Apache2.
- Checking disk space before installation
ubuntu@ip-172-31-45-138:~$ df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 8065444 5427640 2621420 68% /
Why is this slightly different from the percentage at login? Maybe this one rounds up decimals?
- Installation
–aptの更新と、apacheの確認
$sudo apt -y update
$sudo apt show apache2
Package: apache2
Version: 2.4.41-4ubuntu3.10
Priority: optional
Section: web
Origin: Ubuntu
略
I'm not entirely sure, but Apache2 seems to be available and ready for installation.
– Proceeding with the installation.
$ sudo apt -y install apache2
Once finished,
– Check storage capacity
$df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 8065444 5437156 2611904 68% /
5437156−5427640 = 9516kbyte…10Mバイトくらい。微量
– Start the service
$ sudo systemctl enable apache2
$ sudo systemctl start apache2
– Verification
Accessing via web browser...No response....
[No Image]
- Opening Port 80 on the AWS EC2 Server
That's right, I suddenly remembered that AWS requires you to open ports manually!
I believe pretty much everything is closed by default, so let's open up port 80 for web traffic!

[Image: AWS Port Settings]
I'll open four ports in total: port 80 for HTTP and port 443 for HTTPS, for both IPv4 and IPv6.
After opening the ports and checking via web browser again, the default welcome page appeared.

If you just want to put up a simple custom page without WordPress, like "Welcome to Minecraft!", you can apparently just edit:
/var/www/html/index.html
Simply edit this file.
Memory usage right after starting Apache2
*(Forgot to take a screenshot beforehand)*
$free –mega
total used free shared buff/cache available
Mem: 1015 756 67 1 191 100
Swap: 0 0 0
– Installing PHP
Install both `php` and `php-mysql`.
$sudo apt -y install php7.4 php7.4-mysql
略
$df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 8065444 5545836 2503224 69% /
5545836−5437156 = 108,680 108M、結構使った。
The tutorial I followed specified version numbers for installation, but generally, specifying a version like "7.4" isn't necessary. `php-mysql` should automatically pull in the version that matches your environment.
- Installing MariaDB 10.3
$sudo apt -y install mariadb-server mariadb-client
–なんか途中でとまった—
Setting up libhttp-message-perl (6.22-1) …
Setting up mariadb-client (1:10.3.34-0ubuntu0.20.04.1) …
Setting up libcgi-pm-perl (4.46-1) …
Setting up libhtml-template-perl (2.97-1) …
Setting up mariadb-server (1:10.3.34-0ubuntu0.20.04.1) …
Setting up libcgi-fast-perl (1:2.15-1) …
Processing triggers for systemd (245.4-4ubuntu3.15) …
Processing triggers for man-db (2.9.1-1) …
Processing triggers for libc-bin (2.31-0ubuntu9.7) …
^C
After waiting around 10 minutes with no response, I force-quit using `^C`.
– Not knowing what state things were in, I ran the install command one more time —
$sudo apt install mariadb-server mariadb-client
Reading package lists… Done
Building dependency tree
Reading state information… Done
mariadb-client is already the newest version (1:10.3.34-0ubuntu0.20.04.1).
mariadb-server is already the newest version (1:10.3.34-0ubuntu0.20.04.1).
The following packages were automatically installed and are no longer required:
autoconf g++-9 gcc gcc-9 git-man icu-devtools libasan5 libatomic1 libc-dev-bin libc6-dev libcc1-0
libcrypt-dev libdpkg-perl liberror-perl libfile-fcntllock-perl libgcc-9-dev libicu-dev libitm1 liblsan0
libpcre2-16-0 libpcre2-32-0 libpcre2-dev libpcre2-posix2 libquadmath0 libselinux1-dev libsepol1-dev
libstdc++-9-dev libtsan0 libubsan1 linux-libc-dev m4 manpages-dev
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 43 not upgraded.
It told me it was already installed, so hopefully that's okay?
Afterward, it suggested removing some unused dependencies from an update to save space, so I went ahead and removed them to squeeze out every megabyte.
sudo apt autoremove
:
Removing manpages-dev (5.05-1) …
Processing triggers for man-db (2.9.1-1) …
Processing triggers for install-info (6.7.0.dfsg.2-5) …
Processing triggers for libc-bin (2.31-0ubuntu9.7) …
As expected, it hung around `libc-bin`... Is `libc-bin` broken? This planted a seed of worry that it might cause issues later on.
— Running `autoremove` again
$ sudo apt autoremove
Reading package lists… Done
Building dependency tree
Reading state information… Done
0 upgraded, 0 newly installed, 0 to remove and 43 not upgraded.
Looks like it worked!
$df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 8065444 5741772 2307288 72% /
5,741,772 - 5,437,156 = 304,616 (~300MB), that's actually quite substantial.
– Clearing the apt cache here
Since I want to keep the EC2 disk space as small as possible, I'll clear the apt cache right here now that the installations are done.
$ sudo apt clean
$ df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 8065444 5637348 2411712 71% /
5,637,348 - 5,741,772 = −104,424
A 100MB reduction, likely accounting for the archives of Apache2, PHP, and MariaDB!
– Fire up Maria! –
$ sudo systemctl enable mariadb
$ sudo systemctl start mariadb
$ free –mega
total used free shared buff/cache available
Mem: 1015 826 73 3 116 49
Swap: 0 0 0
Free memory actually increased from 67 → 73. Did something get swapped out? Not entirely sure.
Do you really need both `enable` and `start` for systemctl? Are they different? `enable` makes it start on reboot, while `start` boots it up right now, I suppose?
- Installing WordPress
– Downloading (don't forget to delete this later) –
My EC2 server doesn't have a GUI desktop environment, so I'm using the `wget` command, which accesses the web via the CUI (Command Line Interface). I installed this previously.
wget https://ja.wordpress.org/latest-ja.tar.gz
$ mkdir webserver
$ ls
HowToUseRemoteXonSsh.txt MinecraftServerBedrock webserver
$ cd webserver/
~/webserver$ ls
~/webserver$ wget https://ja.wordpress.org/latest-ja.tar.gz
–2022-03-27 12:36:19– https://ja.wordpress.org/latest-ja.tar.gz
Resolving ja.wordpress.org (ja.wordpress.org)… 198.143.164.252
Connecting to ja.wordpress.org (ja.wordpress.org)|198.143.164.252|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 19519460 (19M) [application/octet-stream]
Saving to: ‘latest-ja.tar.gz’
latest-ja.tar.gz 100%[=========================================>] 18.61M 6.05MB/s in 3.1s
2022-03-27 12:36:23 (6.05 MB/s) – ‘latest-ja.tar.gz’ saved [19519460/19519460]
~/webserver$ ls
latest-ja.tar.gz
It's 18.6MB. Pretty lightweight.
– Moving to the WordPress extraction folder –
$ cd /var/www/html
– Extract and change ownership –
$ sudo tar xvf ~/webserver/latest-ja.tar.gz
$ sudo chown -R www-data:www-data .
`www-data` appears to be the default httpd user and group built into Ubuntu.
– Verification –
/var/www/html$ sudo chown -R www-data:www-data .
/var/www/html$ ls -l
total 16
-rw-r–r– 1 www-data www-data 10918 Mar 27 11:17 index.html
drwxr-xr-x 5 www-data www-data 4096 Mar 18 23:00 wordpress
Something feels off. As it stands, only `index.html` will be displayed.
Shouldn't everything inside the WordPress folder be directly under `/var/www/html`?
Or is that just my imagination? When posting articles, would I access `http://xxxx/wordpress`? Or does the site display `http://xxx/index.html`?
No, I'm not imagining things. Even left like this, tweaking the settings would let me view WordPress posts at `http://xxx/`, but that's a hassle.
It seems WordPress is designed to extract into a `wordpress` directory by default to keep things tidy, assuming it will be copied to a server or personal folder.
Either way, I decided to copy all files inside the `wordpress` folder directly under `/var/www/html` after this.
*(Using `mv` is fine; make sure to rename Apache2's default `index.html`)*
$ cp -r wordpress/* .
- Creating a Database for WordPress
– Log into MariaDB as root. Even though it's MariaDB, the commands are the same as standard MySQL. –
The `-u root` argument specifies the server user ID, and `-p` prompts you to enter the password after running the command.
/var/www/html$ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 37
Server version: 10.3.34-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the current input statement.
MariaDB [(none)]>
- Create a database named `wordpress` with UTF-8 character encoding in MariaDB –
CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8;
I really dislike how DB queries seem to have their own quirky syntax culture.
If you forget the semicolon ";" and hit enter, just type a semicolon on the next line.
– Create a DB user –
GRANT ALL ON wordpress.* TO 'username'@'localhost' IDENTIFIED BY 'p*a*s*s*w*o*r*d';
FLUSH PRIVILEGES;
This command grants access privileges to the database, but if the user doesn't exist yet, it will create them as well.
Choose your own `username`. Obvious names invite hacking. It's also best to make it different from your WordPress login ID.
Replace `'password'` with your actual secure password. Mine's a secret.
You'll need this info later for the initial WordPress installation.
–– Sequence of logs for DB configuration ––
MariaDB [(none)]> CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8;
Query OK, 1 row affected (0.047 sec)
MariaDB [(none)]> GRANT ALL ON wordpress.* TO 'username'@'localhost' IDENTIFIED BY 'p*a*s*s*w*o*r*d';
Query OK, 0 rows affected (0.013 sec)
MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.003 sec)
MariaDB [(none)]> quit
Bye
SQL commands can be written in lowercase.
Don't forget the single quotes around things like `'username'`.
Omitting the password part in the `GRANT` statement will result in a missing user error.
Handy SQL commands if things go wrong:
・`show databases;` - Lists databases. Check here to ensure the DB you created exists and has the correct name.
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| wordpress |
+--------------------+
4 rows in set (0.001 sec)
・`select user,host from mysql.user;` - Displays the user list.
MariaDB [(none)]> select user,host from mysql.user ;
+------+-----------+
| user | host |
+------+-----------+
| wpuser | localhost |
| root | localhost |
+------+-----------+
2 rows in set (0.001 sec)
– Configuring WordPress
– Access WordPress via Web Browser –
https://the-world-star.com/wordpress/
*(If you copied files directly under `/var/www/html`, it's just https://the-world-star.com/)*

Enter the credentials you created in MariaDB. After clicking "Let's go!", you'll be taken to another input screen [DB Settings Image]—oops, forgot to take a screenshot.

[WordPress Image] This ID and password are newly created for logging into WordPress itself.
After running the installation, it froze... The server response slowed down to an absolute crawl.
Something must have gone wild. I checked with `ps`, but nothing stood out. Was it because the MariaDB installation halted halfway? Who knows.
ubuntu@ip-172-31-45-138:/var/www/html$ ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.7 168748 7488 ? Ds Mar03 0:42 /sbin/init
root 2 0.0 0.0 0 0 ? S Mar03 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? I< Mar03 0:00 [rcu_gp]
root 4 0.0 0.0 0 0 ? I< Mar03 0:00 [rcu_par_gp]
root 6 0.0 0.0 0 0 ? I< Mar03 0:00 [kworker/0:0H-events_highpri]
root 9 0.0 0.0 0 0 ? I< Mar03 0:00 [mm_percpu_wq]
root 10 0.0 0.0 0 0 ? S Mar03 0:00 [rcu_tasks_rude_]
root 11 0.0 0.0 0 0 ? S Mar03 0:00 [rcu_tasks_trace]
root 12 0.0 0.0 0 0 ? S Mar03 0:13 [ksoftirqd/0]
root 13 0.0 0.0 0 0 ? I Mar03 0:18 [rcu_sched]
root 14 0.0 0.0 0 0 ? S Mar03 0:04 [migration/0]
root 15 0.0 0.0 0 0 ? S Mar03 0:00 [idle_inject/0]
root 16 0.0 0.0 0 0 ? S Mar03 0:00 [cpuhp/0]
root 17 0.0 0.0 0 0 ? S Mar03 0:00 [kdevtmpfs]
root 18 0.0 0.0 0 0 ? I< Mar03 0:00 [netns]
root 19 0.0 0.0 0 0 ? I< Mar03 0:00 [inet_frag_wq]
root 20 0.0 0.0 0 0 ? S Mar03 0:00 [kauditd]
root 21 0.0 0.0 0 0 ? S Mar03 0:00 [khungtaskd]
root 22 0.0 0.0 0 0 ? S Mar03 0:00 [oom_reaper]
root 23 0.0 0.0 0 0 ? I< Mar03 0:00 [writeback]
root 24 0.0 0.0 0 0 ? S Mar03 0:36 [kcompactd0]
root 25 0.0 0.0 0 0 ? SN Mar03 0:00 [ksmd]
root 26 0.0 0.0 0 0 ? SN Mar03 0:02 [khugepaged]
root 72 0.0 0.0 0 0 ? I< Mar03 0:00 [kintegrityd]
root 73 0.0 0.0 0 0 ? I< Mar03 0:00 [kblockd]
root 74 0.0 0.0 0 0 ? I< Mar03 0:00 [blkcg_punt_bio]
root 75 0.0 0.0 0 0 ? S Mar03 0:00 [xen-balloon]
root 76 0.0 0.0 0 0 ? I< Mar03 0:00 [tpm_dev_wq]
root 77 0.0 0.0 0 0 ? I< Mar03 0:00 [ata_sff]
root 78 0.0 0.0 0 0 ? I< Mar03 0:00 [md]
root 79 0.0 0.0 0 0 ? I< Mar03 0:00 [edac-poller]
root 80 0.0 0.0 0 0 ? I< Mar03 0:00 [devfreq_wq]
root 81 0.0 0.0 0 0 ? S Mar03 0:00 [watchdogd]
root 83 0.0 0.0 0 0 ? I< Mar03 0:22 [kworker/0:1H-kblockd]
root 85 0.1 0.0 0 0 ? R Mar03 46:48 [kswapd0]
root 86 0.0 0.0 0 0 ? S Mar03 0:00 [ecryptfs-kthrea]
root 88 0.0 0.0 0 0 ? I< Mar03 0:00 [kthrotld]
root 89 0.0 0.0 0 0 ? I< Mar03 0:00 [acpi_thermal_pm]
root 90 0.0 0.0 0 0 ? S Mar03 0:00 [xenbus]
root 91 0.0 0.0 0 0 ? S Mar03 0:00 [xenwatch]
root 92 0.0 0.0 0 0 ? I< Mar03 0:00 [nvme-wq]
root 93 0.0 0.0 0 0 ? I< Mar03 0:00 [nvme-reset-wq]
root 94 0.0 0.0 0 0 ? I< Mar03 0:00 [nvme-delete-wq]
root 95 0.0 0.0 0 0 ? S Mar03 0:00 [scsi_eh_0]
root 96 0.0 0.0 0 0 ? I< Mar03 0:00 [scsi_tmf_0]
root 97 0.0 0.0 0 0 ? S Mar03 0:00 [scsi_eh_1]
root 98 0.0 0.0 0 0 ? I< Mar03 0:00 [scsi_tmf_1]
root 100 0.0 0.0 0 0 ? I< Mar03 0:00 [vfio-irqfd-clea]
root 101 0.0 0.0 0 0 ? I< Mar03 0:00 [ipv6_addrconf]
root 110 0.0 0.0 0 0 ? I< Mar03 0:00 [kstrp]
root 113 0.0 0.0 0 0 ? I< Mar03 0:00 [zswap-shrink]
root 114 0.0 0.0 0 0 ? I< Mar03 0:00 [kworker/u31:0]
root 119 0.0 0.0 0 0 ? I< Mar03 0:00 [charger_manager]
root 120 0.0 0.0 0 0 ? S Mar03 0:09 [jbd2/xvda1-8]
root 121 0.0 0.0 0 0 ? I< Mar03 0:00 [ext4-rsv-conver]
root 161 0.0 0.4 70084 4612 ? D<s Mar03 0:36 /lib/systemd/systemd-journald
root 191 0.0 0.2 8568 2484 ? Ss Mar03 0:01 /lib/systemd/systemd-udevd
root 203 0.0 0.0 0 0 ? I< Mar03 0:00 [cryptd]
root 273 0.0 0.0 0 0 ? I< Mar03 0:00 [kaluad]
root 274 0.0 0.0 0 0 ? I< Mar03 0:00 [kmpath_rdacd]
root 275 0.0 0.0 0 0 ? I< Mar03 0:00 [kmpathd]
root 276 0.0 0.0 0 0 ? I< Mar03 0:00 [kmpath_handlerd]
root 277 0.0 1.8 280208 18000 ? SLsl Mar03 1:35 /sbin/multipathd -d -s
root 287 0.0 0.0 0 0 ? S< Mar03 0:00 [loop0]
root 290 0.0 0.0 0 0 ? D< Mar03 0:09 [loop1]
root 300 0.0 0.0 0 0 ? S< Mar03 0:00 [loop3]
root 304 0.0 0.0 0 0 ? S< Mar03 0:00 [loop5]
root 308 0.0 0.0 0 0 ? S< Mar03 0:00 [loop7]
root 312 0.0 0.0 0 0 ? S< Mar03 0:00 [loop8]
root 325 0.0 18.1 712728 180072 ? Ssl Mar03 30:40 s3fs minecraft-nyanpu /mnt/s3 -o rw,allow_o
systemd+ 357 0.0 0.3 89972 3312 ? Ssl Mar03 0:02 /lib/systemd/systemd-timesyncd
systemd+ 402 0.0 0.3 26704 3344 ? Ss Mar03 0:09 /lib/systemd/systemd-networkd
systemd+ 404 0.0 0.6 23868 5988 ? Ss Mar03 0:04 /lib/systemd/systemd-resolved
root 442 0.0 0.2 241832 2520 ? Ssl Mar03 0:35 /usr/lib/accountsservice/accounts-daemon
root 443 0.0 0.0 2548 668 ? Ss Mar03 0:00 /usr/sbin/acpid
root 450 0.0 0.2 8544 2104 ? Ss Mar03 0:02 /usr/sbin/cron -f
message+ 451 0.0 0.3 7804 3384 ? Ss Mar03 0:03 /usr/bin/dbus-daemon –system –address=sys
root 460 0.0 1.0 29284 10184 ? Ss Mar03 0:00 /usr/bin/python3 /usr/bin/networkd-dispatch
syslog 461 0.0 0.1 224500 1892 ? Ssl Mar03 0:04 /usr/sbin/rsyslogd -n -iNONE
root 462 0.0 0.6 1235064 6856 ? Dsl Mar03 4:17 /snap/amazon-ssm-agent/5163/amazon-ssm-agen
root 466 0.0 0.4 17828 4880 ? Ss Mar03 0:02 /lib/systemd/systemd-logind
root 468 0.0 0.1 394768 1932 ? Dsl Mar03 0:01 /usr/lib/udisks2/udisksd
daemon 469 0.0 0.1 3800 1944 ? Ss Mar03 0:00 /usr/sbin/atd -f
root 486 0.0 0.1 7360 1896 ttyS0 Ss+ Mar03 0:00 /sbin/agetty -o -p — u –keep-baud 115200
root 500 0.0 0.1 5836 1488 tty1 Ss+ Mar03 0:00 /sbin/agetty -o -p — u –noclear tty1 lin
root 516 0.0 0.1 236428 1712 ? Ssl Mar03 0:00 /usr/lib/policykit-1/polkitd –no-debug
root 582 0.0 1.0 108112 10908 ? Ssl Mar03 0:00 /usr/bin/python3 /usr/share/unattended-upgr
root 701 0.0 0.3 12180 3324 ? Ss Mar03 0:12 sshd: /usr/sbin/sshd -D -o AuthorizedKeysCo
root 728 0.0 1.0 1247272 10468 ? Sl Mar03 4:26 /snap/amazon-ssm-agent/5163/ssm-agent-worke
ubuntu 854 0.0 0.3 18224 3080 ? Ss Mar03 0:00 /lib/systemd/systemd –user
ubuntu 855 0.0 0.3 103032 3200 ? S Mar03 0:00 (sd-pam)
root 19815 0.0 0.0 0 0 ? I< Mar05 0:00 [xfsalloc]
root 19816 0.0 0.0 0 0 ? I< Mar05 0:00 [xfs_mru_cache]
ubuntu 30005 0.0 0.2 8884 2040 ? Ss Mar06 0:00 SCREEN -S minecraft sh ./start_server.sh
ubuntu 30006 0.0 0.0 2616 480 pts/1 Ss+ Mar06 0:00 sh ./start_server.sh
ubuntu 30008 2.4 39.1 1016820 388084 pts/1 Dl+ Mar06 744:16 ./bedrock_server
root 68726 0.0 0.0 0 0 ? S< Mar10 0:00 [loop9]
root 98306 0.0 0.0 0 0 ? I Mar14 1:07 [kworker/0:1-events]
root 109094 0.0 0.0 0 0 ? D< Mar15 0:06 [loop4]
root 109136 0.0 1.6 734456 16688 ? Ssl Mar15 3:45 /usr/lib/snapd/snapd
root 139131 0.0 0.0 0 0 ? S< Mar18 0:00 [loop10]
root 159511 0.0 0.0 0 0 ? I Mar21 0:00 [kworker/0:0-events]
root 213481 0.0 0.0 0 0 ? S< Mar26 0:00 [loop2]
root 221262 0.0 0.4 13796 4068 ? Ss 11:04 0:00 sshd: ubuntu [priv]
ubuntu 221361 0.0 0.3 13928 3128 ? D 11:04 0:01 sshd: ubuntu@pts/0
ubuntu 221362 0.0 0.2 10080 2912 pts/0 Ss 11:04 0:02 -bash
root 230506 0.0 0.8 194084 8496 ? Ds 11:45 0:02 /usr/sbin/apache2 -k start
www-data 230510 0.0 0.6 194580 6136 ? S 11:45 0:00 /usr/sbin/apache2 -k start
www-data 230511 0.0 0.6 194660 6320 ? S 11:45 0:00 /usr/sbin/apache2 -k start
www-data 230512 0.0 0.5 194588 5892 ? S 11:45 0:00 /usr/sbin/apache2 -k start
www-data 230513 0.0 3.7 207700 37148 ? S 11:45 0:00 /usr/sbin/apache2 -k start
mysql 231369 0.6 6.3 1252044 62608 ? Ssl 11:57 1:02 /usr/sbin/mysqld
www-data 232214 0.0 3.0 201400 30064 ? S 11:58 0:00 /usr/sbin/apache2 -k start
www-data 232215 0.0 0.5 194588 5632 ? S 11:58 0:00 /usr/sbin/apache2 -k start
www-data 233479 0.0 3.1 201400 31520 ? S 13:36 0:00 /usr/sbin/apache2 -k start
www-data 233480 0.0 0.6 194580 6020 ? S 13:36 0:00 /usr/sbin/apache2 -k start
www-data 233481 0.0 3.2 201436 32136 ? S 13:36 0:00 /usr/sbin/apache2 -k start
root 233483 0.0 0.0 0 0 ? I 13:37 0:00 [kworker/u30:1-events_power_efficient]
www-data 233490 0.0 1.0 194620 10820 ? S 13:39 0:03 /usr/sbin/apache2 -k start
root 233553 0.0 0.0 0 0 ? I 13:42 0:00 [kworker/u30:2-events_power_efficient]
root 233565 0.0 0.1 10220 1880 ? S 14:00 0:00 /usr/sbin/CRON -f
ubuntu 233569 0.0 0.0 2616 472 ? Ss 14:06 0:00 /bin/sh -c /home/ubuntu/MinecraftServerBedr
ubuntu 233572 0.1 0.0 8624 640 ? S 14:07 0:02 /bin/bash /home/ubuntu/MinecraftServerBedro
root 233579 0.2 0.1 11968 1632 ? Ds 14:11 0:02 /usr/sbin/sshd -D -o AuthorizedKeysCommand
root 233596 0.1 0.1 10220 1960 ? S 14:30 0:00 /usr/sbin/CRON -f
ubuntu 233598 0.8 0.2 10816 2792 pts/0 R+ 14:31 0:01 ps -aux
root 233601 2.2 0.0 11868 920 ? Ds 14:33 0:01 /usr/sbin/sshd -D -o AuthorizedKeysCommand
ubuntu@ip-172-31-45-138:/var/www/html$
- Restarted EC2 from the AWS web console for recovery
I deleted WordPress, re-extracted it, dropped the WordPress database, and recreated it from scratch.
Once I did that, it finished instantly.
- Deleting WordPressJust remove the files using `sudo rm -r wordpress`.
- Deleting the DBDone via query.
$ sudo mysql -u root -p
Log into the console with this command.
Use `show databases;` to display databases. Remember that `databases` is plural, and the command won't be accepted without a semicolon at the end.
If you hit enter without typing ";", just type ";" and hit enter on the next line.
The query to delete the database is `drop database wordpress`
$ sudo mysql
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 46
Server version: 10.3.34-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> show databases
-> ;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
| wordpress |
+——————–+
4 rows in set (0.000 sec)
MariaDB [(none)]> drop database wordpress
-> ;
Query OK, 11 rows affected (0.092 sec)
MariaDB [(none)]> show databases;
+——————–+
| Database |
+——————–+
| information_schema |
| mysql |
| performance_schema |
+——————–+
3 rows in set (0.000 sec)
■ It Works!

- Finally, checked storage capacity... Huh? Storage went up. Did a reboot clean something up?
$ df /
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 8065444 4733108 3315952 59% /
- Sure enough, accessing `http://xxx.com/`pulls up the default `index.html`.
This is because I installed it in `/var/www/html/wordpress`.
Apparently, adjusting WordPress settings, editing `index.php`, and placing `index.php` directly under `html` would fix it, but what should I do?!
Having everything directly under `html/` seems easier to maintain moving forward.
Is deleting the DB and starting over too much of a hassle?
I'll delete the original `/html/index.html`. Otherwise, it takes priority.
Once deleted, it read `index.php`.
The one in `/var/www/html/wordpress`
doesn't work if you copy its `index.php` over. It just won't run.
However, accessing `http://xxxx/wordpress/` shows a 404 Not Found in the center.
Everything else works, though.
Conclusion: Dealing with all these quirks is a pain, so I decided to run things by placing all contents of `wordpress/*` directly under `/var/www/html/`.
To maintain the web pages,
go to `http://xxxx/wp-admin/`.
That's it!
