- Create an EC2 Instance:
- Go to the AWS Management Console (https://aws.amazon.com/).
- Navigate to the EC2 dashboard.
- Click on "Launch Instance."
- Choose an Amazon Machine Image (AMI) that fits your requirements. For example, select "Amazon Linux 2 AMI."
- Choose an instance type (preferably a Free Tier eligible instance).
- Configure the instance details as required (subnet, security group, etc.).
- Review and launch the instance, creating or selecting an existing key pair for SSH access.
- Configure Apache Web Server:
- Connect to your EC2 instance via SSH using the private key for the selected key pair.
- Update the system packages:
sudo yum update -y
- Install Apache:
sudo yum install httpd -y
- Start the Apache service:
sudo service httpd start
- Enable Apache to start on boot:
csharp sudo chkconfig httpd on
- Download WordPress:
- Navigate to the /var/www/html directory:
cd /var/www/html
- Download the WordPress application:
sudo wget https://wordpress.org/latest.tar.gz
- Extract the downloaded archive:
sudo tar -xzf latest.tar.gz
- Rename the WordPress directory for convenience:
sudo mv wordpress your-preferred-directory-name
- Update the ownership and permissions:
sudo chown -R apache:apache your-preferred-directory-name
- Setup MySQL Server using AWS RDS:
- Go to the AWS Management Console.
- Navigate to the RDS dashboard.
- Click on "Create database."
- Choose "MySQL" as the engine and select the version.
- Specify the database details, such as DB instance identifier, username, and password.
- Configure the connectivity and security settings (choose a security group that allows access from your EC2 instance).
- Set up the database instance size and storage options (Free Tier eligible settings if available).
- Review the settings and create the RDS instance.
- Provide the Endpoint/Connection String to WordPress:
- After the RDS instance is created, navigate to the RDS dashboard and select your newly created database instance.
- Under the "Connectivity & security" tab, find the endpoint. It will look something like your-rds-endpoint.your-region.rds.amazonaws.com.
- Go back to your EC2 instance and edit the wp-config.php file for WordPress:
cd /var/www/html/your-preferred-directory-name sudo cp wp-config-sample.php wp-
config.php sudo vi wp-config.php
- Update the following database configuration settings with the RDS endpoint, database name, username, and password:
define('DB_NAME', 'your_database_name'); define('DB_USER', 'your_database_username'); define('DB_PASSWORD', 'your_database_password'); define('DB_HOST', 'your-rds-endpoint.your-region.rds.amazonaws.com');
- Finalize WordPress Configuration:
- Restart Apache to apply the changes
sudo service httpd restart
- Access WordPress:
- Open a web browser and enter your EC2 instance's public IP address in the address bar.
- Follow the WordPress installation wizard and provide the necessary information (e.g., site title, admin username, password, etc.).
- Once the installation is complete, you can start using WordPress with the backend data stored in the MySQL database on your AWS RDS instance.
Comments
Post a Comment