DEV Community

Cover image for How to create a LAMP Server on AWS
Mihir
Mihir

Posted on

How to create a LAMP Server on AWS

Hello Amazing people 👋 Here's a beginner friendly project to get-started with public cloud services

Some prerequisities: Basic Understanding of linux commands, networking and cloud

Let's get started

Phase1: Linux Server setup on AWS

  • Login AWS portal -> Go to EC2 services -> Launch an instance
  • Select instance AMI Red Hat Linux 8 or Rocky Linux 8
  • Create a new security group to allow HTTP, HTTPS & SSH
  • Create a key-pair -> Launch the instance
  • Connect instance with ssh using local terminal
  ssh -i <key-pair.pem file> ec2-user@<instance public ipv4 address>
Enter fullscreen mode Exit fullscreen mode

Image description

Phase2: Apache Server setup

  • Connect instance with ssh
  • Install the apache server with dnf package manager command
  sudo dnf install httpd -y && sudo systemctl start httpd
Enter fullscreen mode Exit fullscreen mode

Image description

  • Go to the public IPv4 address to view the apache server Image description

Phase3: Database Server setup

  • Install the latest mariadb database server setup with dnf package manager command
  sudo dnf install mariadb-server -y
Enter fullscreen mode Exit fullscreen mode
  • Start the server
  sudo systemctl start mariadb && mysql_secure_installation
Enter fullscreen mode Exit fullscreen mode

Image description

  • Log in mysql database and check the databases to ensure database setup

Image description

Phase 4: PHP Server Module

  • Enable the php module and install with dnf package manager command
  sudo dnf module enable php:7.4 && sudo dnf install php
Enter fullscreen mode Exit fullscreen mode

Image description

  • Start php-fpm module to optimize and restart to apply changes
  sudo systemctl start php-fpm && sudo systemctl restart httpd php-fpm
Enter fullscreen mode Exit fullscreen mode
  • Go to /phpinfo.php to ensure php module installation. If you are not able to view phpinfo webpage, ensure the file is in the correct directory, or create one with terminal Image description

Completion

That's it, the LAMP Server is up and running!🥳

If you want to have a more detailed step-by-step procedure, please checkout my Github page or feel free to to reach out on Twitter.

Top comments (0)