How to set up Magento on a Amazon Web Service Hosting with CentOS?

How to set up Magento on a Amazon Web Service Hosting with CentOS?

July 26, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to set up Magento on a Amazon Web Service Hosting with CentOS?

Setting up Magento on Amazon Web Services (AWS) involves several key steps that can be daunting for those accustomed to traditional web hosting providers like 1&1 or OVH. Let’s break down the process into manageable components.

Understanding AWS and CentOS

AWS is a cloud computing platform offered by Amazon, providing infrastructure as a service (IaaS). It allows you to rent virtual machines, called instances, that run on top of physical hardware owned and operated by Amazon. These instances can be launched from templates, or machine images, which are pre-configured with an operating system.

CentOS is one such operating system image available on AWS. It’s a popular Linux distribution known for its stability and compatibility with Red Hat Enterprise Linux (RHEL). When you launch a CentOS instance, you’re essentially renting a virtual computer running this operating system.

Unlike traditional hosts where you upload files via FTP or SFTP through tools like FileZilla, on AWS, you interact directly with the underlying operating system. This provides greater control but adds a layer of complexity for those unfamiliar with server administration.

Launching Your First CentOS Instance

To begin, navigate to the Amazon EC2 dashboard in your AWS Management Console. Click ‘Launch Instances’ and select the CentOS AMI (Amazon Machine Image) that fits your needs. For development purposes, the free tier instance types like t2.micro are sufficient.

After launching the instance, you’ll need to connect to it using SSH (Secure Shell). If you’re on a Mac or Linux machine, open Terminal and use the ssh command followed by your instance’s public DNS name:

ssh ec2-user@your-instance-public-dns-name

If you’re on Windows, download PuTTY, an SSH client for Windows, and connect using the hostname.

Installing Apache, PHP, and MySQL

Once connected via SSH, you’ll be inside your virtual machine. To install Magento, we need to set up a LAMP (Linux, Apache, MySQL, PHP) stack first. These are the core technologies required by Magento.

To install these components:

sudo yum update -y  # Update the package index and upgrade all packages
sudo yum install httpd -y     # Install Apache web server
sudo yum install php php-mysqlnd php-fpm php-gd php-mbstring php-xml php-intl php-zip -y   # Install PHP and required extensions
sudo yum install mysql-server -y  # Install MySQL database server

After the installation, start the services:

sudo systemctl start httpd    # Start Apache
sudo systemctl enable httpd   # Enable Apache to auto-start on boot

sudo systemctl start mysqld  # Start MySQL
sudo systemctl enable mysqld # Enable MySQL to auto-start on boot

Configuring Magento

Now that you have the LAMP stack installed, we can proceed with the Magento installation. Download the latest stable version of Magento from their official download page and transfer it to your instance using scp or rsync.

Once transferred:

  1. Extract the downloaded file in the /var/www/html directory.
  2. Create a database for Magento using MySQL.
  3. Configure the environment variables by editing the .htaccess and index.php files in the Magento root folder.
  4. Run the web-based installer at http://your-instance-public-dns-name/index.php.

For more detailed guides, refer to the official Magento Installation Guide.

Conclusion

Setting up a development or testing environment for Magento on AWS requires a basic understanding of server administration and cloud computing concepts. By following these steps, you can have your Magento instance running on AWS without having to worry about the underlying infrastructure.

Remember that security is paramount when working with public-facing servers like those provided by AWS. Always ensure your database credentials are secure, and keep your software stack up-to-date.

For more advanced topics in Magento development, consider exploring our blog at Laravel Company where we cover best practices and tips for working with this powerful e-commerce platform.

Themes Admin Configuration CLI

Our network