Installing a LAMP Stack on Linux using XAMPP For Linux
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. XAMPP is good if you’re new to a LAMP Stack from scratch or if you don’t want get involved in all the hassles with building it from scratch. It contains: Apache, MySQL, PHP & PEAR, Perl, ProFTPD, phpMyAdmin, OpenSSL, GD, Freetype2, libjpeg, libpng, gdbm, zlib, expat, Sablotron, libxml, Ming, Webalizer, pdf class, ncurses, mod_perl, FreeTDS, gettext, mcrypt, mhash, eAccelerator, SQLite and IMAP C-Client.
I’ll be using Ubuntu Hardy as my OS but basically the process would be the same for the other distros.
To build and deploy xdebug or memcached extensions, you will need the XAMPP distribution, including the XAMPP development files. You can download the XAMPP binaries and the XAMPP development files (required for building additional components) from XAMPP. You can also use wget to grab the software quickly:
$ wget ‘http://nchc.dl.sourceforge.net/sourceforge/xampp/xampp-linux-1.6.6.tar.gz’
$ wget ‘http://nchc.dl.sourceforge.net/sourceforge/xampp/xampp-linux-devel-1.6.6.tar.gz’
I will be installing the package into /opt. The same would go for the development files. Using /opt makes the rest of the build process much easier. I will be using the -C option to tar to extract the files directly into /opt, as follows:
You might create /opt folder if it doesn’t exist
$ sudo mkdir /opt
$ sudo tar xzf xampp-linux-1.6.6.tar.gz -C /opt
$ sudo tar xzf xampp-linux-devel-1.6.6.tar.gz -C /opt
$ ls -CF /opt/lampp
backup/ build/ error/ htdocs/ include/ lampp* libexec/ logs/ manual/ phpmyadmin/ RELEASENOTES share/ var/
bin/ cgi-bin/ etc/ icons/ info/ lib/ licenses/ man/ modules/ phpsqliteadmin/ sbin/ tmp/
The default document root is “/opt/lampp/htdocs/”. if you would like to change your document root folder to any other folder like in my case my home folder “/home/salimane/htdocs”, do the following :
$ mkdir /home/salimane/htdocs
Open your httpd.conf and change all occurences of “/opt/lampp/htdocs” to “/home/salimane/htdocs”
$ sudo gedit /opt/lampp/etc/httpd.conf
Copy all the folders and files in /opt/lamp/htdocs to /home/salimane/htdocs
$ sudo cp -R /opt/lampp/htdocs/* /home/salimane/htdocs/
That’s all. XAMPP is now installed below the /opt/lampp directory. To start XAMPP simply call this command:
$ sudo /opt/lampp/lampp start
You should now see something like this on your screen:
Starting XAMPP for Linux 1.6.6…
XAMPP: Starting Apache with SSL (and PHP5)…
XAMPP: Starting MySQL…
XAMPP: Starting ProFTPD…
XAMPP for Linux started.
OK, that was easy but how can you check that everything really works? Just type in the following URL at your favourite web browser:
http://localhost or http://127.0.0.1
Now you should see the start page of XAMPP containing some links to check the status of the installed software and some small programming examples.
File/Directory Purpose:
/opt/lampp/bin/ The XAMPP commands home. /opt/lampp/bin/mysql calls for example the MySQL monitor.
/opt/lampp/htdocs/ The Apache DocumentRoot directory.
/opt/lampp/etc/httpd.conf The Apache configuration file.
/opt/lampp/etc/my.cnf The MySQL configuration file.
/opt/lampp/etc/php.ini The PHP configuration file.
/opt/lampp/etc/proftpd.conf The ProFTPD configuration file. (since 0.9.5)
/opt/lampp/phpmyadmin/config.inc.php The phpMyAdmin configuration file.XAMPP Autostart at login
To make xampp automatically start when we boot up the computer, you can add a script to make it auto-start and shutdown. With your prefered editor, gedit in my case :
$ sudo gedit /etc/init.d/lampp
Now paste in the following:
# Lampp auto-start
# author : Salimane Adjao Moustapha
# description: Auto-starts lampp
# processname: lampp
# pidfile: /var/run/lampp.pidcase $1 in
start)
/opt/lampp/lampp start
;;
stop)
/opt/lampp/lampp stop
;;
restart)
/opt/lampp/lampp stop
/opt/lampp/lampp start
;;
esac
exit 0
You’ll need to make the script executable by running the chmod command:
$ sudo chmod 755 /etc/init.d/lampp
The last step is actually linking this script to the startup folders with a symbolic link. Execute these two commands and we should be on our way.
$sudo ln -s /etc/init.d/lampp /etc/rc1.d/K99lampp
$ sudo ln -s /etc/init.d/lampp /etc/rc2.d/S99lampp
Uninstall
To uninstall XAMPP just type in this command:
$ sudo rm -rf /opt/lampp


