Introduction
If you are a Linux (or Ubuntu) web developer or even a web designer with interest in CMS systems like WordPress, Drupal, Joomla etc., you are for sure in need of a web development environment on your work computer to test websites or themes that you built for any CMS. If you have not fund a solution yet, the good news is that there is one – it is XAMPP.
What is XAMPP
XAMPP is a compilation of free software (comparable to a Linux distribution), it’s free of charge and it’s free to copy under the terms of the GNU General Public License. XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use – just download, extract and start. The XAMPP project bundles Apache, PHP4 & 5, Perl, mySQL, and a bunch of other utilities/applications – the most handy of which is phpMyAdmin – into an simple package for Linux, Mac OSX, Windows and Solaris. Obviously this HowTo only deals with the Linux version. I am sure, if you have not googled it already, you are asking where I can download it …
Getting XAMPP
To get the latest version of XAMPP you need to go to their official website. Download the Linux version, which is the one needed for Ubuntu too, and pass on the next step.
Installing XAMPP
If you have downloaded it through FireFox, most likely it has been placed in your Desktop. So, let’s begin with the step-by-step procedure:
- Too keep things simple, first you have to move your XAMPP download to your home directory, which is under Places => Home Folder menu. Why? This is because the default extract/install command will look for XAMPP there. If it does not find it there it will fail and you will get an error message that you are be in trouble. As a matter of fact, you can declare the location of XAMPP package in your extract/install command, but that does not serve our KISS (keep it simple) principle.
- Now extract the archive to /opt using sudo:
sudo tar xvfz xampp-linux-1.5.3a.tar.gz -C /opt
Starting XAMPP
To start XAMPP you need to run the following code into the terminal:
sudo /opt/lampp/lampp start
You have to do this every time you reboot your system. If you just want to shut XAMPP down while working, just replace the start with stop on the above command.
Test XAMPP
To see if XAMPP is in good health, test it by asking your browser to take you to: http://localhost/. You should see the XAMPP splash page there.
Working with XAMPP
XAMPP by default uses /opt/lampp/htdocs as the root web directory. To make things nicer and easier, you should link a folder in your home directory into this directory. My user name is banago so I have /home/banago/public_html linked to /opt/lampp/htdocs/banago. So if I navigate to http://localhost/banago/ I get a listing of all the files/folders in that directory. Not only – I also put into /home/banago/public_html all the files I work with.
My WordPress Installation in XAMPP for Theme Development
Being a WordPress Theme Developer I have uploaded WordPress in public_html folder and I edit me theme on the same place. In short, it is great! So, how can we link those two directories. Here it is:
- Create a public_html directory in home directory by mouse Right-Click => Create Folder or by typing or pasting into terminal the following code:
mkdir ~/public_html
- Than link this directory to the XAMPP’s default one by running the following code into the terminal:
sudo ln -s ~/public_html /opt/lampp/htdocs/$USER
- Now any files and folders you place in ~/public_html will be published to your personal web server. Access those files from http://localhost/username. That’s it – have fun!
Bottom Line
XAMPP is my development friend and it makes my life easier each day. I recommend to every developer, be they whatever OS user, even though this tutorial covers only Linux users (especially Ubuntu ones). I would love to know your thoughts about this article and I would be very happy to ask any help questions you will have.