Installing XAMPP on Ubuntu 11.10 and 12.04

Category

This tutorial has been written to help you install XAMPP on 32bit Ubuntu 11.10 or 12.04 Linux. First let me answer the question why install XAMPP rather than installing Apache, MYSQL and PHP from the Ubuntu repository. XAMPP gives you everything to run a test web server in a single portable package theoretically making it easy to copy the configuration between machines. XAMPP also gives you an easy way to only start the web server when required.

For production web servers and full time development machines it is better to use the Apache server from the Ubuntu repository. For a tutorial on setting up a full time web development machine please see my settting up Apache 2 server on Ubuntu tutorial.
These instructions are a combination and addition to those found on the Apache Friends (XAMPP) website and Upubuntu websites.

Steps

Get XAMPP

Download XAMPP for Linux from Apache Friends. The next few steps 2 – 4 are the same as on the Apache friends website.

Installing XAMPP

Go to a Linux shell (Ctrl-Alt_T), Change directory to the folder that XAMP was downloaded to.

cd ..\Downloads

Extract the downloaded archive file to /opt with root access:

sudo tar xvfz xampp-linux-1.7.7.tar.gz -C /opt

Any versions of XAMPP already installed in the opt folder will get overwritten by this command. Now XAMPP is now installed in the /opt/lampp directory.

Start Apache

To start XAMPP simply call this command:

sudo /opt/lampp/lampp start

You should now see something like this on your screen:


Starting XAMPP 1.7.7...
LAMPP: Starting Apache...
LAMPP: Starting MySQL...
LAMPP started.
Ready. Apache and MySQL are running.

Testing the installation

 

OK, now to check that everything really works? Just type in the following URL in web browser:

http://localhost

You will now see a screen like this asking you select your language.

XAMPP Language selection page

Click the language you want and you should now see the start page of XAMPP containing some links to check the status of the installed software and some small programming examples.

Main XAMMP Intstall hoome page

 

Fix Security (optional)

To make the lampp installation more secure run the lampp security wizard to set passwords and follow the on screen prompts. In the terminal window type.

sudo /opt/lampp/lampp security

Stop Lampp

To stop XAMPP type.

sudo /opt/lampp/lampp stop

Add XAMPP to the Unity Dash

 

To make XAMPP more convenient to use you might want to add it the Ubuntu Dash. For this step you will need to have the Main Menu application installed which can be done using the Ubuntu Software Centre. First open the Ubuntu 12.04 Unity Dash and start the Main Menu application.

Loading Main Menu

You should get the main menu application loaded which will look something like this.

Main menu editor

Select the category that you want XAMPP put in (Internet) and click the New Item button. This will display the “Launcher Properties” dialog as shown below.

Launcher editor

For the type make sure that Application is selected. The Command should be:

gksudo /opt/lampp/share/xampp-control-panel/xampp-control-panel

If you want to add an icon click on the icon in the top left corner. An XAMPP icon can be found at /opt/lampp/htdocs/xampp/img/logo-big.gif

You will now need to run Lampp from the Dash to add it to the Launcher.

Set-up a folder in user account (Optional)

If you want you can add a folder to your home directory to contain websites you want to work with.

In the terminal make sure that you are in your home folder an then create a public_html folder with.

mkdir public_html

You now need to change the permissions on the new folder to allow websites to load correctly.

sudo chmod 777 -R public_html

The next step is to create a link to new public_html in your Home folder

cd /opt/lampp/htdocs sudo ln -s /home/[username]/public_html ./[username]

Where [username] is you current user name.

Now to check that the new folder works. Place a test web page in the public_html folder in your Home directory then start XAMPP. Now just type in the following URL in web browser:

http://localhost/[username]

Where [username] is you current user name.

You should now see your test web page in the browser.

Well done you now have a working installation of XAMPP.

Level