This LAMP install script install-amp-for-amazon-ec2.sh (Current version 0.9)
tested in Amazon EC2 - Basic 32-bit/64-bit Amazon Linux AMI,
may work in CentOS, RHEL and Fedora Linux.
Apache and PHP using source tarball installation,
MySQL using official RPM installation.
You can change the version number in script header and change configure parameter to fit your needs.
Current settings:
APACHE_VERSION=auto # auto detect latest version
APACHE_VERSION2=2.2.22 # use fix version number if auto failed
PHP_VERSION=auto # auto detect latest version
#PHP_VERSION=5.3.10 # use fix version number if auto failed
MYSQL_VERSION=auto # auto detect latest stable version
#MYSQL_VERSION=5.5.20 # use fix version number if auto failed
Install commands:
wget http://pank.org/scripts/install-amp-for-amazon-ec2.sh
chmod +x install-amp-for-amazon-ec2.sh
sudo ./install-amp-for-amazon-ec2.sh
or just one line command
curl http://pank.org/scripts/install-amp-for-amazon-ec2.sh | sudo sh
Aapache directory /usr/local/apache
Apache config /usr/local/apache/conf/httpd.conf
Apache DocumentRoot /usr/local/apache/htdocs
MySQL client /usr/bin/mysql
MySQL server /usr/sbin/mysqld
PHP config /usr/local/etc/php.ini
PHP module for Apache /usr/local/apache/modules/libphp5.so
PHP CLI /usr/local/bin/php
To check MySQL files location
rpm -ql MySQL-client
rpm -ql MySQL-server
NOTICE: Because the script using source tarball installation except MySQL,
It take time to build, the installation time may over 2 hours in t1.micro machine.
Q: Why using source tarball installation instead of yum ?
A: To use latest version of Apache+MySQL+PHP.
If you intend to use yum installation, it's easy and only one line command:
yum -y groupinstall "Web Server" "MySQL Database" "PHP Support"
2012-02-07 Update: v0.9 add installation log file install-amp-for-amazon-ec2.log for debug.
2012-03-26 Update: v1.0 Apache 2.4.x, PHP 5.4.x support
t1.micro last test time: 2012-03-26
Basic 64-bit Amazon Linux AMI 2011.09, Kernel 2.6.35.14-97.44.amzn1.x86_64
Elapsed time: 113 minutes.
m1.small last test time: 2012-04-14
Amazon Linux AMI 2012.03, Kernel 3.2.12-3.2.4.amzn1.x86_64
Elapsed time: 33 minutes.
I used curl http://pank.org/scripts/install-amp-for-amazon-ec2.sh | sudo sh