Day 3 Deliverable

Today you will configure a Linux user for managing WordPress, configure SSH access using authorized_keys, install MySQL, create a database for WordPress, and configure directory permissions so Apache (www-data) can write to the WordPress directory.

Part 1 – Create a Linux User

Create a new system user for managing the WordPress server.

sudo adduser wordpress

Add the user to the sudo group.

sudo usermod -aG sudo wordpress

Verify the user is in the sudo group.

groups wordpress

Part 2 – Configure SSH Access with authorized_keys

Create the SSH directory.

sudo mkdir /home/wordpress/.ssh

Set the correct permissions.

sudo chmod 700 /home/wordpress/.ssh

Create the authorized_keys file.

sudo nano /home/wordpress/.ssh/authorized_keys

Paste your public SSH key into the file.

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCexamplekey student@laptop

Set proper permissions on the file.

sudo chmod 600 /home/wordpress/.ssh/authorized_keys

Set ownership.

sudo chown -R wordpress:wordpress /home/wordpress/.ssh

Part 3 – Install MySQL on Debian

sudo apt update
sudo apt install -y mysql-server

Enable and start the MySQL service.

sudo systemctl enable mysql
sudo systemctl start mysql

Verify it is running.

sudo systemctl status mysql

Part 4 – Secure the MySQL Installation

sudo mysql_secure_installation

Recommended settings:

Part 5 – Create the WordPress Database

Login to MySQL.

sudo mysql

Create the database.

CREATE DATABASE wordpress DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

Part 6 – Create the WordPress Database User

CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'StrongPasswordHere';

Grant permissions.

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX
ON wordpress.* TO 'wp_user'@'localhost';

Apply changes and exit.

FLUSH PRIVILEGES;
EXIT;

Part 7 – Configure WordPress Directory Permissions

Set ownership to Apache.

sudo chown -R www-data:www-data /var/www/html/wordpress

Set directory permissions.

chmod -R 775 /var/www/html/wordpress

Part 8 – Test the Database User

mysql -u wp_user -p

Inside MySQL:

SHOW DATABASES;
USE wordpress;
SHOW TABLES;
EXIT;

Deliverable

Submit the following:


End of Day 3 Deliverable