Thursday, January 12, 2012

How to install Lampp/Xampp and how to secure Lampp/Xampp on Unix


1. Download the lampp installation file from

2. Take terminal and type "sudo su" and enter root password to become root user

3. Extract the file using tar command " tar xvfz {downloaded_file_name} /opt"

    Donot extract the files using any other extractors as it will extract with wrong permissions ! and may lead to not proper working of the server !!

4. After extracting you can Start your server by typing "/opt/lampp/lampp start"

5. To view the default site , fire up your browser and type in the address bar .. You should see the default xampp page here :) 


1. As a root user go to "/opt/lampp" folder using the cd command 

2. Then change the ownership of the htdocs folder by typing this command 
 "chown -R username:username htdocs"

3. Then from here move to /opt/lampp/etc folder to associate your username with the apache server .Find the file called httpd.conf and open it with nano or gedit and find the line  "User nobody" and change it to "user {username}"

4. Now restart lampp to see the effect :)  you can restart lampp by typing this in 
"/opt/lampp/lampp restart"

To view the status if the server type "/opt/lampp/lampp status"
To stop the server type "/opt/lampp/lampp stop" and "/opt/lampp/lampp start" to start the server again 

5. Also go to "/opt/lampp/phpmyadmin"   and type "chown username:username"  to change the ownership of the config files and make it readable .


1. In the terminal type "/opt/lampp/lampp security"  and give the password for everything and secure it .


1. Move to "/etc/init.d/" folder and type this commad "sudo vi lampp" and add these lines
/opt/lampp/lampp start"
save the file 

2. In the terminal type "sudo chmod +x /etc/init.d/lampp"  to give execute permission for that script .

3. Use update-rc.d to install init scripts to all runlevel by typing 
"sudo update-rc.d lampp defaults"