Ubuntu LTS (Dapper) comes with Apache v.2.0.55 and PHP v.5.1.2. and is easily installed via the 'apt-get' command.
The advantage of using packages is that you will get any security updates from Ubuntu (if and when distributed) and dependencies are automatically taken care of.
A basic Apache install is very easy:
sudo apt-get install apache2 apache2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert
At the end of the install you will see this warning:
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
Please see this Apache Configuration Article for details of configuring the ServerName setting.
If you navigate to your Slice IP address:
You will not see a welcome screen as you might expect but rather this:
If you click into the 'apache2-default' directory the welcome screen will be displayed:
If this concerns you and you would rather see the default welcome screen instead of the directory listing, then open up the default vhost file:
sudo nano /etc/apache2/sites-available/default
and uncomment the following line (remove the #):
RedirectMatch ^/$ /apache2-default/
sudo /etc/init.d/apache2 reload
Now when you visit your IP address you are automatically redirected to the Apache welcome screen rather than seeing the directory listing.
Let's move on to the PHP5 install. I'm not going to install all the modules available. Just some common ones.
As before, due to using apt-get to install PHP5, any dependencies are taken care of:
sudo apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-mhash php5-mysql php5-snmp php5-sqlite php5-xmlrpc php5-xsl
You may have notice that Apache was restarted during the install, so everything is now ready to use with PHP v.5.1.2.
Well, almost ready to use.
We do need to configure Apache for our setup so we can host multiple sites and so on.
The next article will go through the Ubuntu LTS (Dapper) Apache layout and configuration as it differs slightly from the 'classic' layout you might expect if you had installed from source.