Day 45 Task: Deploy Wordpress website on AWS

Nilesh SahareNilesh Sahare
3 min read

Table of contents

Over 30% of all websites on the internet use WordPress as their content management system (CMS). It is most often used to run blogs, but it can also be used to run e-commerce sites, message boards, and many other popular things. This guide will show you how to set up a WordPress blog site.

Task-01

  • As WordPress requires a MySQL database to store its data, create an RDS as you did on Day 44**
    Login to the Aws console and go to RDS to create a database.**

    Name your database.

    Created database.

  • Now create an instance for WordPress.

    Now connect your instance and update the system then install MySQL
    sudo apt install mysql-client
    mysql -h <endpoint-name> -P <port-name> -u <username> -p

CREATE DATABASE wordpress;
CREATE USER 'wordpress' IDENTIFIED BY 'wordpress-pass';
GRANT ALL PRIVILEGES ON wordpress.* TO wordpress;
FLUSH PRIVILEGES;
Exit

Check whether your database was created or not

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

  • An Amazon EC2 instance to install and host the WordPress application.
    Now install Apache on your EC2 instance for WordPress run.
    use
    sudo apt-get install apache2

    Check whether your instance ip apache web server is working or not.

  • An Amazon RDS for MySQL database to store your WordPress data.

  • Set up the server and post your new WordPress app.
    Now Download and uncompress the software by using the below commands.

        wget https://wordpress.org/latest.tar.gz 
        tar -xzf latest.tar.gz
    

    Now extract the tar file.

        tar -xvzf latest.tar.gz
    

    Now change the directory and copy the default configuration file

        cd wordpress
        cp wp-config-sample.php wp-config.php
    
  • Now edit the wp-config.php file

  • Open the wp-config.php file

    • DB_NAME: your RDS database name

    • DB_USER: The name of the user you created in the database in the previous steps

    • DB_PASSWORD: The password for the user you created in the previous steps

    • DB_HOST: The hostname of the database means your database endpoint

      vim wp-config.php

To configure the Authentication Unique Keys and Salts section in the WordPress wp-config.php file, you can replace the entire content in that section with the following content:

      define('AUTH_KEY',         'N[D)?+J-}Wx<c*jX$AuW!pz>2{M[>_YT- 7tY`aT3y;*F! _LeM}Kj[t4o2v3qMm');
      define('SECURE_AUTH_KEY',  '9+>M!va% jq|B|f>kc9saFwE-cS|9-4B$xGu+2pI&3yis%-zzka =TAxq]+.Q7Fp');
      define('LOGGED_IN_KEY',    '>s4a)kHXSc(~i|$/P}SgvJPBiFp+tET.xdaW4Y%3mR~#P6;GK B)oADegQK#u)gV');
      define('NONCE_KEY',        'W-3_,k/oZcX.Mg6![$epnW@r/@z*9B@P=p#=mSIF-R9Z9X.Q+2-[+%L`]qBOQ++h');
      define('AUTH_SALT',        '<UFNBNl<x:%EuS#K+p-__>[EtE-tea]xP6-i_wz$8[%uU>>ia2_]z)-`MA}i,T8q');
      define('SECURE_AUTH_SALT', 'I`|%6X&* 0I-W%^^NlHN^{jg6`J;[^h))&?-R4&OfyF!U_^hh?P@+-:iqdgeI%AJ');
      define('LOGGED_IN_SALT',   'g96e[e61f|BG MUHkk~]Yoy%lyVHvS)5CAEjJ3]#^?ZB@~y2R<a/OM0d&ezwv.FN');
      define('NONCE_SALT',       ',FI>G~/$`NFqoAO?U~Lsw[Ko{ubrN&-]N$HT4s+U4<s0W(v9]f(bn1r_`OjV#LMH');

Deploy the WordPress site and install dependencies.

      sudo apt install php libapache2-mod-php php-mysql -y

Copy the WordPress file to the Apache root directory.

      cd ..
      sudo cp -r wordpress/* /var/www/html/
      sudo systemctl restart apache2

      #Check your wordpress wedsite is working or not
      http://<public-ip>/wp-admin
      http://3.86.95.61/wp-adm  #Check your wordpress wedsite is working or not
  • Happy Learning :)

    If you find my blog valuable, I invite you to like, share, and join the discussion. Your feedback is immensely cherished as it fuels continuous improvement. Let's embark on this transformative DevOps adventure together! ๐Ÿš€ #devops #90daysofdevop #AWS

0
Subscribe to my newsletter

Read articles from Nilesh Sahare directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Nilesh Sahare
Nilesh Sahare

๐ŸŽ“ I hold a Post Graduate Diploma in Advanced Computing, which has equipped me with a strong foundation in cutting-edge computing technologies like C++ Programming (VS Code editor), MySQL Database (MySQL 8 on both Command Line client and Workbench), Data Structures and Algorithms using Java (Eclipse IDE), HTML 5, CSS 3, JavaScript (VS Code editor), MERN (VS Code editor), Ms.Net Framework with C# Programming (Visual Studio .Net 2019), Software Development Methodologies (SDLC, STLC, JIRA, POSTMAN), JDBC , Servlet, Hibernate, Spring Boot, JSP (J2EE, STS IDE) LINUX Operating system and shell scripting. My academic journey has been marked by a thirst for knowledge and a passion for solving complex problems. ๐Ÿ“Š Current Role: Test Engineer | 13 Months and Counting ๐Ÿงช In my current role as a Test Engineer, I thrive on the challenges of ensuring software quality and reliability. Automation and Manual Testing Tools: Selenium, Jira, TestRail, Postman, JUnit, . ๐Ÿ› ๏ธ Learning the DevOps Way: Building Bridges ๐ŸŒ My journey doesn't stop here. I'm on a continuous learning path, actively acquiring knowledge and hands-on experience with DevOps tools streamline collaboration between development and operations teams, encompassing popular solutions like Jenkins for continuous integration, Docker for containerization, Kubernetes for orchestration, Terraform for infrastructure as code, and Git for version control. ๐Ÿค Let's Connect and Collaborate! ๐ŸŒ