Ubuntu Intrepid - installing Apache and PHP5

Ubuntu Intrepid Ibex comes with Apache v.2.2.9 and PHP v.5.2.6 and they are easily installed via the default Ubuntu Package Manager 'aptitude'.

The advantage of using aptitude is that you will get any security updates from Ubuntu (if and when distributed) and dependencies are automatically taken care of.

Apache Install

A basic Apache install is very easy:

sudo aptitude install apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert


Towards the end of the install you will see this warning:

apache2: Could not reliably determine the server's fully qualified domain name,
using for ServerName

Although I'll be going into some detail about the options and settings available in the main apache configuration file, let's fix that warning straight away.

Open the main apache config:

sudo nano /etc/apache2/apache2.conf

At the bottom of the file add the following:

ServerName demo

Change the ServerName to your Slice hostname or a FQDN (remember this demo Slice has a hostname of 'demo').

Once done, save apache2.conf and gracefully restart Apache (this method of restarting won't kill open connections):

sudo apache2ctl graceful

Now the warning has gone. Nice.

Default Page

If you navigate to your Slice IP address:

You will see the default 'It works!' screen:

Apache Welcome Screen

Now we have the base Apache install completed, we can move onto installing PHP. If you don't require PHP then please feel free to skip the next section.

PHP5 Install

In this example, I'm not going to install all the modules available. Just some common ones.

To see what modules are available try a:

sudo aptitude search php5-

Note the '-' at the end of 'php5'. This will show any packages that start with 'php5-' and shows the available modules.

As before, due to using aptitude to install PHP5, any dependencies are taken care of:

sudo aptitude install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd \
php5-imagick php5-mcrypt php5-memcache php5-mhash php5-mysql php5-pspell php5-snmp \
php5-sqlite php5-xmlrpc php5-xsl

Once done, do a quick Apache reload:

sudo /etc/init.d/apache2 reload



Well, almost done.

We do need to configure Apache for our setup so we can host multiple sites and so on.

The next articles will go through the Ubuntu Intrepid Apache layout as it differs slightly from the 'classic' layout you might expect if you had installed from source.



Article Comments:

Eric Winther commented Mon Dec 22 12:32:32 UTC 2008:

I get this error message:

E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/p/postgresql-8.3/libpq58.3.3-0ubuntu0.8.04amd64.deb: 404 Not Found [IP: 80]

Peter Marks commented Sun Dec 28 21:35:10 UTC 2008:

@Eric, check that you've updated your ubuntu install and built your essentials: http://articles.slicehost.com/2008/11/28/ubuntu-intrepid-setup-page-2

James commented Thu Feb 12 21:17:29 UTC 2009:

I've been following the setup from the getting started tutorial through to here... only anomaly so far was this during PHP install:

E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/l/linux/linux-libc-dev2.6.27-7.15amd64.deb: 404 Not Found

Eric Conner commented Fri Jul 17 03:40:12 UTC 2009:

Hi, I can't seem to install php5-cli, getting: ... Writing extended state information... Done Err http://archive.ubuntu.com hardy-updates/main php5-cli 5.2.4-2ubuntu5.5 404 Not Found [IP: 80] Err http://security.ubuntu.com hardy-security/main php5-cli 5.2.4-2ubuntu5.5 404 Not Found E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/p/php5/php5-cli5.2.4-2ubuntu5.5amd64.deb: 404 Not Found ...

Kirk commented Sat Aug 08 03:31:19 UTC 2009:

I have to say, I absolutly love your tutorials. I come here all the time just to help with day to day setup and maintenence of my home development servers and my VPS's. Great stuff!

Thank you !

incolo real estate commented Thu Aug 13 23:28:33 UTC 2009:

if you're running wordpress (or something the like) you'll probably want a basic FTP program, ubuntu doesn't default with one so here is vsftp:


nicholas Treffiletti commented Thu Feb 18 19:46:46 UTC 2010:

anyone running into that fetch error needs to run sudo aptitude update

Want to comment?

(not made public)


(use plain text or Markdown syntax)