Install the LAMP Stack on a Linux virtual machine in Windows Azure
A LAMP stack consists of the following different elements:
- Linux - Operating System
- Apache - Web Server
- MySQL - Database Server
- PHP - Programming Language
Installing on Ubuntu
You will need the following packages installed:
apache2 mysql-server php5 php5-mysql libapache2-mod-auth-mysql libapache2-mod-php5 php5-xsl php5-gd php-pear
You can run this as a single apt-get install command:
apt-get install apache2 mysql-server php5 php5-mysql libapache2-mod-auth-mysql libapache2-mod-php5 php5-xsl php5-gd php-pear
Installing On CentOS
You will need the following packages installed:
httpd mysql mysql-server php php-mysql
You can run this as a single yum install command:
yum install httpd mysql mysql-server php-php-mysql
Setting Up
-
Set up Apache.
-
You will need to restart the Apache Web Server. Run the following command:
sudo /etc/init.d/apache2 restart
- Check to see that the installation is running. Point your browser to: http://localhost. It should read "It works!".
-
Set up MySQL.
-
Set the root password for mysql by running the following command
mysqladmin -u root -p password yourpassword
-
Log into the console using the mysql or a variety of MySQL clients.
-
Set up PHP.
-
Enable the Apache PHP Module by running the following command:
sudo a2enmod php5
-
Relaunch Apache by running the following command:
sudo service apache2 restart
Further Reading
There are many resources for setting up a LAMP stack on Ubuntu.