# Lab 5-2: LAMP Stack in AWS Part 2

## Secure the database server: <a href="#secure-mariadb-lamp-server" id="secure-mariadb-lamp-server"></a>

Start the MariaDB server.

```
sudo systemctl start mariadb
```

Run **mysql\_secure\_installation**.

```
sudo mysql_secure_installation
```

1. When prompted, type a password for the root account.
   * Type the current root password. By default, the root account does not have a password set. Press Enter.
   * Type `Y` to set a password, and type a secure password twice. . Make sure to store this password in a safe place.
2. Type `Y` to remove the anonymous user accounts.
3. Type `Y` to disable the remote root login.
4. Type `Y` to remove the test database.
5. Type `Y` to reload the privilege tables and save your changes.

Set the MariaDB server to start at every boot, type the following command.

```
sudo systemctl enable mariadb
```

**Submit: Screenshot showing the mariadb status as active**

<figure><img src="https://1702353884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg4BXXN6DhMLmwASC6sFj%2Fuploads%2FTqP26jLORBMlQwsB3F8f%2Fimage.png?alt=media&#x26;token=46a06d5f-4d74-41a0-98a7-22ec7fdc4207" alt=""><figcaption></figcaption></figure>

## Install phpMyAdmin: <a href="#install-phpmyadmin-lamp-server" id="install-phpmyadmin-lamp-server"></a>

Install the required dependencies.

```
sudo yum install php-mbstring -y
```

Restart Apache.

```
sudo systemctl restart httpd
```

Restart `php-fpm`.

```
sudo systemctl restart php-fpm
```

Navigate to the Apache document root at `/var/www/html`.

```
cd /var/www/html
```

Select a source package for the latest phpMyAdmin release from <https://www.phpmyadmin.net/downloads> [Links to an external site.](https://www.phpmyadmin.net/downloads). To download the file directly to your instance, copy the link and paste it into a **wget** command, as in this example:

```
wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
```

Create a `phpMyAdmin` folder and extract the package into it with the following command.

```
mkdir phpMyAdmin && tar -xvzf phpMyAdmin-latest-all-languages.tar.gz -C phpMyAdmin --strip-components 1
```

Delete the `phpMyAdmin-latest-all-languages.tar.gz` tarball.

```
rm phpMyAdmin-latest-all-languages.tar.gz
```

**SUBMIT: Screenshot showing successful PHP MyAdmin Login**

<figure><img src="https://1702353884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg4BXXN6DhMLmwASC6sFj%2Fuploads%2FNiVULIgLSkF1JSstR684%2Fimage.png?alt=media&#x26;token=626fb6b0-4b66-4c07-ae5a-ae12a67fa83a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://1702353884-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fg4BXXN6DhMLmwASC6sFj%2Fuploads%2Fm5rTxaUkz9xOWMi6LBA0%2Fimage.png?alt=media&#x26;token=2d881bc3-1b23-4923-9a35-8c4392765505" alt=""><figcaption></figcaption></figure>
