Amazon Linux AMI as LAMP setup

The following guide demonstrates how to install Apache Webserver 2.2, PHP 5.3, MySQL Server 5.1 (Community Edition) and Perl (without mod_perl).

sudo yum install -y httpd php php-pear mysql mysql-server perl php-common php-dba php-pdo php-mysql php-xml php-xmlrpc

Then start Apache HTTPD and MySQL Server:

sudo /etc/init.d/mysqld start
sudo /etc/init.d/httpd start

And make sure it`s always loaded on startup:
sudo chkconfig --level 2345 httpd on
sudo chkconfig --level 2345 mysqld on

7 thoughts on “Amazon Linux AMI as LAMP setup

  1. Out of about a dozen websites that tried to do this yours is the shortest, easiest and the only one that worked!

  2. Thanks Ramon!
    One of the fastest and easiest ways I’ve found! It worked perfectly from scratch and is working like a charm.
    Only thing that might be needed to mention:
    Since I don’t really work with CentOs I was wondered to find apache at /etc/httpd … even thou I could have guessed so from the installation command. 🙂


  3. I would add one line to this very nice (and short) tutorial:

    sudo chown ec2-user:ec2-user /var/www/html

    This change of ownership allows the default ec2-user login (via .pem keypair RSA PRIVATE KEY) to read/write to the web root in an FTP fashion with a client like Cyberduck.

    After uploading/creating file(s), index.php and others, make sure the permissions are set to minimum of 644 (on php files, folders 755) so that Apache can access them. I know this is a bit beyond the scope of the article, but this last step makes it easy to access web files with a GUI interface.

Leave a Reply

Your email address will not be published. Required fields are marked *