Saturday, October 29, 2011

Complete Installation of XAMPP in UBUNTU


xampp ubuntu start How to install xampp in ubuntu

Screenshot XAMPP for Linux 1.7.1 Mozilla Firefox Tutorial : Installing and securing XAMPP on Ubuntu 9.10


This tutorial will explain how to install XAMPP 1.7.1 in Ubuntu 9.10

Introduction

This is a step by step guide for installing and setting up a webdev server on a ubuntu machine. I will show you how to install the lampp stack using XAMPP version 1.7.1 on Ubuntu 9.10.

Part 1: Install XAMPP:

1. For starters you need to go to the official XAMPP website and download XAMPP for Linux version 1.7.4,  click here to download.


2. Place the downloaded .tar.gz archive on your desktop if it wasn’t already saved there by default.

3. Open a terminal ( Applications > Accessoires > Terminal )


4. Go to your desktop (or any other location where you placed the downloaded file)

cd Dekstop

5. Login as the super admin

sudo -s


xampp ubuntu How to install xampp in ubuntu

6. Untarball the compressed file to the /opt directory

tar xvfz xampp-linux-1.7.3a.tar.gz -C /opt

The above command installs xampp in the /opt/lampp directory

Step 2: Solve "htdocs" Permission Problem

After install xampp when you try to paste anything to htdocs you will get permission denied error. Therefore to fix this you have to run the following code in terminal after running the code you can simply put files and folder into htdocs

sudo chmod 777 -R /opt/lampp/htdocs/
 
This changes the ownership of the htdocs folder to your user, the -R option makes the command recursive so all permissions of folders and files inside htdocs are changed aswell.

Step 3: How to Start / Stop xampp


7.Start xampp by giving the command

      /opt/lampp/lampp start 
               
xampp ubuntu start How to install xampp in ubuntu
 
Note:If it sounds like, "XAMPP: Another web server daemon is already running." 
 
to solve tat use any one of following code

stopapache
or 
sudo /etc/init.d/apache2 stop
or 
sudo /usr/sbin/apache2ctl stop

Check any other installed apache server ?
 
sudo ps -u apache
or 
sudo ps -u nobody
To see a list of processes owned by the usual apache owners.
If it's the xampp apache running then it doesn't matter, leave it running.
Or stop all the servers and then try starting them agai 

8. After starting xampp open a browserwindow and go to localhost
If all went well you’ll see this page
Screenshot XAMPP Mozilla Firefox 300x180 Tutorial : Installing and securing XAMPP on Ubuntu 9.10

9. After choosing your language you’ll be forwarded to the welcome page
Screenshot XAMPP for Linux 1.7.1 Mozilla Firefox 300x180 Tutorial : Installing and securing XAMPP on Ubuntu 9.10

Step 4: Securing xampp
10. Go to the security page by clicking Security in the left menu.
You’ll see that everything is unsecured at the moment
Screenshot XAMPP for Linux 1.7.1 Mozilla Firefox 1 300x293 Tutorial : Installing and securing XAMPP on Ubuntu 9.10
When XAMPP will be used for local development these settings won’t matter much. It is good practice however to set it up securely.

Next I’ll show you how to setup security


11. Copy the code on the bottom of the security page and then paste it into a terminal
Screenshot XAMPP for Linux 1.7.1 Mozilla Firefox 3 300x293 Tutorial : Installing and securing XAMPP on Ubuntu 9.10

/opt/lampp/lampp security

This will start an interactive program to help you configure security settings
Make sure you’re logged in as super admin to start xampp or you’ll get an error message!

Screenshot tom@laptop 1 300x199 Tutorial : Installing and securing XAMPP on Ubuntu 9.10

12. Type yes when prompted to enter a password and enter a secure password twice
Screenshot root@laptop  300x199 Tutorial : Installing and securing XAMPP on Ubuntu 9.10


13. Turn off MySQL network accesibility by entering yes, MySQL will now restart so the setting can take effect
Screenshot root@laptop 1 300x199 Tutorial : Installing and securing XAMPP on Ubuntu 9.10
14. You’ll be prompted to set a password for phpMyAdmin, do so.

15. And again for setting a MySQL root password, make sure you write this one down or you’ll be in trouble later on.
Screenshot root@laptop 2 300x199 Tutorial : Installing and securing XAMPP on Ubuntu 9.10

16. Now set a password for user nobody.
This should complete the security setup procedure.
Screenshot2 299x210 Tutorial : Installing and securing XAMPP on Ubuntu 9.10
To confirm everything went ok, open a browserwindow and go to localhost

17. You’ll be prompted for a username and password.
Screenshot 1 300x230 Tutorial : Installing and securing XAMPP on Ubuntu 9.10
the username is ‘lampp’
the password is the one you entered in step 12

18. Go the the security pages
This should show all subjects are now secured..
Screenshot XAMPP for Linux 1.7.1 Mozilla Firefox 4 300x293 Tutorial : Installing and securing XAMPP on Ubuntu 9.10
Place content you want to add to the webserver in the root web directory located in

/opt/lamp/htdocs

To make things easier we’ll add a link to the htdocs folder to a folder in our home directory.
You can do this in a terminal by typing

mkdir ~/public_html

Or just right-click in your home folder and create a new folder named ‘public_html’

19. Now we’ll make a link from the new folder to /opt/lampp/htdocs , open a terminal and enter

sudo ln -s ~/public_html /opt/lampp/htdocs/
 
20. To setup permissions for the htdocs folder, go to the terminal (still logged in as super user) and type

chown  yourusername -R /opt/lampp/htdocs
 
This changes the ownership of the htdocs folder to your user, the -R option makes the command recursive so all permissions of folders and files inside htdocs are changed aswell.

Note that depending on the applications used to interact with content on your server, permissions might need to be altered to grant read/write access.

Congratulations that was it! Well sort of…


After restarting your computer you have to manually start the server by entering

/opt/lampp/lampp start

in a terminal.
EDIT: MiD-AwE pointed out he had to install the ia32 libraries when installing XAMPP on Ubuntu 9.10 64-bit. The ia32 library is needed when installing a 64-bit version on a AMD64 or ia64-system.
To do this open a terminal and type

sudo apt-get install ia32-libs

If you want xampp to automatically start at boottime, follow these steps.


EDIT : Or as MiD-AwE suggested you can go to System > Preferences and add an entry

 /opt/lampp/lampp start

to “Startup Applications”

If you want to use a GUI to start and stop xampp do the following:

1. Open a terminal and type

sudo gedit ~/.local/share/applications/xampp-control-panel.desktop

2. Paste this code in the new empty file in gedit

[Desktop Entry]
Comment=Start and Stop XAMPP
Name=XAMPP Control Panel
Exec=gksudo python /opt/lampp/share/xampp-control-panel/xampp-control-panel.py
Icon[en_CA]=/usr/share/icons/Humanity/devices/24/network-wired.svg
Encoding=UTF-8
Terminal=false
Name[en_CA]=XAMPP Control Panel
Comment[en_CA]=Start and Stop XAMPP
Type=Application
Icon=/usr/share/icons/Humanity/devices/24/network-wired.svg
 
If you want to use another icon or if you are using another theme then make sure to change the path to the icon you want to showing up for the xampp control panel.
Change this line (twice) to match the location of the icon you want to use.

Icon[en_CA]=/usr/share/icons/Humanity/devices/24/network-wired.svg
 
3. The xampp control panel should now show up in Applications > Other
You should get to see something like this :
Screenshot Tutorial : Installing and securing XAMPP on Ubuntu 9.10

That was it!

Now run along and go do something usefull





No comments:

Post a Comment