# Day 45 : Deploy WordPress website on AWS

WordPress is a highly popular and versatile **content management system (CMS)** that allows users to create and manage websites easily.

## Task:

* As WordPress requires a MySQL database to store its data ,create an RDS as you did in [Day 44.](https://sahilkaushal.hashnode.dev/day-44-relational-database-service-in-aws)
    

To configure this WordPress site, you will create the following resources in AWS:

* An Amazon EC2 instance to install and host the WordPress application.
    
* An Amazon RDS for MySQL database to store your WordPress data.
    
* Setup the server and post your new WordPress app.
    

### Solution:

* Installing WordPress.
    
    ```bash
    cd /tmp && wget https://wordpress.org/latest.tar.gz
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724700757022/89f7bb8d-4f06-4896-8adb-aa9d58243b9f.png align="center")
    
* Extract file using tar.
    
    ```bash
    tar -xvf latest.tar.gz
    ```
    
* Copy the **wordpress** folder to `/var/www/html/` path.
    
    ```bash
    sudo cp -R wordpress /var/www/html/
    ```
    
    ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724701087834/8fb9a213-90ee-4c61-945a-497529bed024.png align="center")
    
* For WordPress functionality, PHP along with some necessary extensions are required.
    
    ```bash
    sudo apt install -y php php-common php-mysql php-xml php-xmlrpc php-curl php-gd php-imagick php-cli php-dev php-imap php-mbstring php-soap php-zip php-intl
    ```
    
* Install some other additional PHP modules.
    
    ```bash
    sudo apt install -y php-mysql php-cgi php-cli php-gd
    ```
    
* Now, restart the Apache to apply the changes.
    
    ```bash
    sudo systemctl restart apache2
    ```
    
* Change ownership for the **Apache** server.
    
    ```bash
    sudo chown -R www-data:www-data /var/www/
    ```
    
* Create **uploads** directory.
    
    ```bash
    sudo mkdir /var/www/html/wordpress/wp-content/uploads
    ```
    
* Change ownership.
    
    ```bash
    sudo chown -R www-data:www-data /var/www/html/wordpress/wp-content/uploads/
    ```
    

### Let's **Setup WordPress.**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724771154911/3e644a39-65cc-4847-8e87-eedec77ed51a.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724771355118/e30c8806-a8ae-4470-b758-2a69d3c4b0c7.png align="center")

Add database connection details based on your own RDS configurations.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724771735420/b9b7dcda-a389-4bb4-9d94-00a3d8b83f85.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724771758521/7d8c4b17-8b67-445b-b053-4375eb9f173e.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724771871274/71eb8cf1-19ab-4fe4-8916-121ccbcfa530.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724771924275/9ed3acdc-2e5a-4791-b226-fb4b97b2c3d5.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724771983505/de588d8c-a86d-4814-84a6-6296eed8015d.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724772047947/364302f3-8679-4b48-8aab-32f7976b6d84.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1724772184521/abb11b56-7937-45e0-a111-e0a6c588873f.png align="center")

Thank you for reading😉.
