HowTo Install and Setting Up LAMPP/XAMPP

In this tutorial I will introduce you about XAMPP, a bundle of apache http server, mysql database, php and perl script language from apachefriends.org.

XAMPP also include some usefull packages, such:

  • ProFTPD 1.3.1

  • PhpMyAdmin 2.11.3

  • OpenSSL 0.9.8e

  • Webalizer 2.01

  • IMAP C-Client 2004e

  • OpenLDAP (client) 2.3.11

  • SQLite 2.8.17 (for PHP4 + PHP5)

  • SQLite 3.3.17 (for PHP5 PDO SQLite)

  • phpSQLiteAdmin 0.2

  • FPDF 1.53


Usually we need XAMPP to running our website in our home pc, not in paid server outside. So, we able to developing our website in our home offline before we upload it to online web server.

XAMPP available for many platforms, it available for Windows, MacOS and offcourse, Linux - no matter what distro you use. But in this tutorial, I will limit the tutorial in LAMPP (L stand for Linux!) only.

How To Install XAMPP/LAMPP


Download the latest LAMPP packages from http://apachefriends.org. Extract it to /opt directory as root or if you want easy to configure it, just uncompress it in your home directory.

sudo tar xvzf lampp-xxx.tar.gz /opt

NOTE:
Here I use sudo to doing something with root privilege. If your distro not support sudo by default like Ubuntu, issue su command before then enter your root password.

I myself, extract the lampp packages in my home directory on special website folder. If you take this way, follow me:

mkdir website

tar xvzf lampp-xxx.tar.gz /home/amrinz/website

and as root, we make a symbolic link (symlink/shorcut) and put it in /opt.

ln -s /home/amrinz/website/lampp /opt/lampp

Now we have finished installing XAMPP/LAMPP. Next we will learn how to use XAMPP/LAMPP.

XAMPP/LAMPP Commands


To access your web server, you must start it first. The XAMPP command formated like this:

/opt/lampp/lampp <action>

For example, use this command to start XAMPP, as root.

sudo /opt/lampp/lampp start

and to stop it, use this command

sudo /opt/lampp/lampp stop

and also some sets of actions you can use:

  • start
    Start XAMPP (Apache, MySQL and eventually others)

  • startapache
    Start only Apache

  • startssl
    Start only SSL support

  • startmysql
    Start only MySQL

  • startftp
    Start only ProFTPD

  • stopapache
    Stop only Apache

  • stopssl
    Stop only SSL support

  • stopmysql
    Stop only MySQL

  • stopftp
    Stop only ProFTPD

  • reload
    Reload XAMPP (Apache, MySQL and eventually others)

  • reloadapache
    Reload only Apache

  • reloadmysql
    Reload only MySQL

  • reloadftp
    Reload only ProFTPD

  • restart
    Stop and start XAMPP

  • security
    Check XAMPP's security

  • php5
    Activate PHP5

  • php4
    Activate PHP4

  • phpstatus
    Which version of PHP is active?

  • backup
    Make backup file of your XAMPP config, log and data files

  • panel
    Starts graphical XAMPP control panel


To test if your installation succesfull, after start the XAMPP, acces http://localhost through your web browser. You will see the XAMPP greet!

To acces another feature of XAMPP, such phpmyadmin, call it from your web browser in this url, http://localhost/phpmyadmin

To change the http://localhost content, go to /opt/lampp/htdocs, delete all files and directories there and change it with yours.


How To Create XAMPP Virtual Host


In this part, I will explain how to create apache virtual host.
Virtual host is apache feature which allow us to make our website with it own domain. So we can access our website through "real" url.

For example, we will make a virtual host for www.berugak.com domain.

If you installing lampp in /opt you need, again, root privilege to edit /opt/lampp/etc/httpd.conf file.

Just add this line in the last file:

include /home/username/website/extra-httpd.conf

and now, as regular user, open your editor, add these lines:

<VirtualHost 127.0.1.2>
ServerName www.berugak.com
DocumentRoot /home/amrinz/website/www.berugak.com


<Directory /home/amrinz/website/www.berugak.com>
AllowOverride All
Options All
</Directory>
</VirtualHost>


Save this file as extra-httpd.conf in /home/username/website, as we define in httpd.conf file.

Then, we must add the IP address we use above to /etc/hosts file. Just add:

127.0.1.2    www.berugak.com

In Ubuntu, you can use the Network menu. Go to System >> Administration >> Network.
Change the tab to Hosts, click Add, enter the IP address and the server name.

The last step is to create the berugak.com folder, in /home/username/website and put it with files.

You can access the new virtual host in http://www.berugak.com url, as the real online website!

If you want add more virtual host, just repeat the last three steps above by changing the IP address, the server name and the directory location/name.

Mmmm, I think that enough for now. Happy dance!
:-)

Post a Comment

16 Comments

  1. Тема ну просто пиздец.
    Неужели ничего поактуальней не нашлось?

    ReplyDelete
  2. @Typok

    In plain English please, I dont understand rusian :-)

    ReplyDelete
  3. @admin

    How to do this but with the real website, I mean as a server and lot localhost only ?

    ReplyDelete
  4. Thanks man, you saved me time. I was just missing to include the extra-httpd.conf which in XAMPP is apart from the main httpd.conf

    ReplyDelete
  5. thankyou for the list of individual start/stop commands, i have been looking everywhere so i could run xampp but use my own ftp server. all done and working now.

    ReplyDelete
  6. Very informative article, which I found quite useful. Cheers ,Jay

    ReplyDelete
  7. i have installed xampp on mandriva, then i have tried starting lampp with command /opt/lampp/lampp start.I have tried open my browser and typing localhost on address.but address bar direct go to localhost/xampp and i want not this action.i want make if i type localhost just show me localhost. please help me to this problem

    ReplyDelete
  8. If you don't need xampp folder and its files, you can delete it.

    If you want to see it, delete file index.php inside htdocs. Because this file redirect you to xampp folder.

    ReplyDelete
  9. i am using linux rdhat and am very new to it. I am not getting how to install lampp. i ahave downlaoded and extrated files. What to do now? does anyone know this?

    ReplyDelete
  10. @nik
    As I write, there are several command you can try. but the first is :

    su
    /opt/lampp/lampp start (you must move the lampp folder to /opt)

    You can put your website in /opt/lampp/htdocs.

    ReplyDelete
  11. How to configure MRTG & rrd on xammp for display the graphs of MRTG?
    Thanks in advance

    ReplyDelete
  12. Good points raised here, (well, what I could read of it). I am color blind (protanopia to be precise). I mainly use Safari browser (not sure if that makes a difference), and a great deal of this site is a bit of a strain on my eyes. I don't wish to whinge, and I know it is my problem really, but it would be cool if you would bear in mind color blind surfers when undertaking your next site re-working.

    ReplyDelete
  13. Fantastic site, where did you come up with the info in this blog? Im pleased I found it though, ill be checking back soon to see what other articles you have.

    ReplyDelete
  14. I'm typically to blogging and i actually admire your content. The article has really peaks my interest. I'm going to bookmark your web site and keep checking for new information.

    ReplyDelete