How to install XAMPP on Ubuntu Linux and running as normal user
	
	
		Install XAMPP on Ubuntu Linux and running as Normal User
This is an important tutorial on how to install and completely configure XAMPP to run without problems on Ubuntu Linux.
To proceed please make sure you have the following requirements:
    * Linux Ubuntu operating system - This tutorial has been written using Ubuntu 10.04 - Lucid Lynx
    * XAMPP Linux Version installer - You can go to the XAMPP Linux Page and use the actual download link.
At the time this tutorial was written, the latest XAMPP version for Linux was 1.7.3a.
This installation using the latest release will enable you to make PHP-based websites (to be tested locally using Linux XAMPP) that have the following important features:
	Quote:
	
		
		
			    * PHP 5.3.1
    * Apache 2.2.14
    * MySQL 5.1.41
    * phpMyAdmin 3.2.4
			
		
	
 
	 
	
	
	
		Step 1: Checking the MD5 Checksum of the downloaded installer
	
	
		Step 1: Checking the MD5 Checksum of the downloaded installer
After you download the XAMPP installer for Linux, you need to check the integrity of the installer by checking the MD5 Checksum of the downloaded installer and comparing it with the correct one. If they are not the same, the installer you have downloaded may be "corrupt" or "incomplete;" hence, it will not run properly when installed.
You can get the "correct value" of the MD5 checksum on the XAMPP Linux Page:
apache friends - xampp for linux
Now, using the Linux terminal (Applications - Accessories - Terminal), go to the Ubuntu download directory
Actual command:
	Quote:
	
		
		
			melbin@fwh2:~$ cd Downloads
			
		
	
 Log in as root, type this in the terminal, and then enter your Linux password:
	Quote:
	
		
		
			melbin@fwh2:~/Downloads$ sudo -s -H
			
		
	
 Next, type in the terminal: 
	Quote:
	
		
		
			md5sum xamppinstallername.tar.gz
			
		
	
 Replace xamppinstaller.tar.gz with the actual file name of the downloaded archived installer. In this case, that would be xampp-linux-1.7.3a.tar.gz
Below is the actual terminal command and its result
	Quote:
	
		
		
			root@fwh2:/home/melbin/Downloads# md5sum xampp-linux-1.7.3a.tar.gz
			
		
	
 89c13779cf6f0925d5c1c400d31a1cc3  xampp-linux-1.7.3a.tar.gz
And here is the correct value based on the XAMPP Linux page
89c13779cf6f0925d5c1c400d31a1cc3
The Md5sum matches, and the installer is OK.
	 
	
	
	
		Step 2: Run the Installer in Ubuntu Linux
	
	
		Step 2: Run the Installer in Ubuntu Linux
The next step assumes you are still on the Ubuntu Download Directory (my path is: /home/melbin/Downloads) and still logged in as root. Into the terminal, enter the command below:
	Quote:
	
		
		
			root@fwh2:/home/melbin/Downloads# tar xvfz xampp-linux-1.7.3a.tar.gz -C /opt
			
		
	
 Double check that the syntax is correct before proceeding, and then press enter. Linux will extract the files in the archive and place them in the /opt/ path on your Linux computer.
After this is done, reboot your computer with:
	Quote:
	
		
		
			root@fwh2:/home/melbin/Downloads# sudo reboot
			
		
	
 The third step in this process is to verify your installation. Log in in as root again, and then try starting XAMPP. You should not see any errors. (Below is an example of a successful installation):
	Quote:
	
		
		
			root@fwh2:/home/melbin# /opt/lampp/lampp start
			
		
	
 
	Quote:
	
		
		
			Starting XAMPP for Linux 1.7.3a...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.
			
		
	
 
	 
	
	
	
		Step 3: Change the Owner to Your Own Linux Account
	
	
		Step 3: Change the Owner to Your Own Linux Account
By default, if you are using Linux, you are not the root unless you log in as root. This can be difficult when editing, saving and writing files to /opt/ directory (where XAMPP has been installed). This is because the owner of that is still not you; it is the root.
You need to configure a change of ownership so that you will own your files that will be saved in the HTDOCS directory (the directory where you will save your PHP files for testing in the web browser). To do this, go through the steps below in order.
1. In terminal, log in as root and then go to the /opt/lampp directory:
Actual command: 
	Quote:
	
		
		
			root@fwh2:/home/melbin# cd /opt/lampp
			
		
	
 2.) Enter ls -l
Actual command : 
	Quote:
	
		
		
			root@fwh2:/opt/lampp# ls -l
			
		
	
 Linux will list the owners of the file and directories. Note that htdocs is owned by nobody - root
3. To change the owner from nobody -- root to your own Linux Ubuntu username:
	Quote:
	
		
		
			chown -R yourlinuxusername:yourlinuxusername htdocs
			
		
	
 My Linux username is: melbin, so for me, the actual command is:
	Quote:
	
		
		
			root@fwh2:/opt/lampp# chown -R melbin:melbin htdocs
			
		
	
 4. You also need to associate ownership of your Linux username with the Apache configuration. In this case type cd etc in the terminal:
Actual command: 
	Quote:
	
		
		
			root@fwh2:/opt/lampp# cd etc
			
		
	
 5. Now you are in the etc directory. Type gedit httpd.conf. This will show the Linux text editor in the terminal:
Actual command: 
	Quote:
	
		
		
			root@fwh2:/opt/lampp/etc# gedit httpd.conf
			
		
	
 Be careful when editing; a single mistake can make the Apache web server inoperable. So find the line:
	Quote:
	
		
		
			User nobody
Group nogroup
</IfModule>
</IfModule>
			
		
	
 Change this to:
	Quote:
	
		
		
			User melbin
Group nogroup
</IfModule>
</IfModule>
			
		
	
 Of course, you need to replace my Linux username (melbin) with your own username. If you are done editing, Save the file and exit the editor.
	 
	
	
	
		Step 4: Browser Configuration in XAMPP
	
	
		Step 4: Browser Configuration in XAMPP
The next important thing after changing ownership is to confirm three things. First, that XAMPP works nicely with a web browser; second, that the proper language (yours) is selected; and third, that the MySQL  databases (phpMyAdmin) are configured. To accomplish these objectives, go through the sequence of steps below. 
First, go to the Linux root directory. Here is the actual command:
	Quote:
	
		
		
			root@fwh2:/opt/lampp/etc# cd /
			
		
	
 Second, restart XAMPP in the Linux terminal (/opt/lampp/lampp restart). Here is the actual command and result (make sure you do not see any errors):
	Quote:
	
		
		
			root@fwh2:/# /opt/lampp/lampp restart
			
		
	
 
	Quote:
	
		
		
			Stopping XAMPP for Linux 1.7.3a...
XAMPP: Stopping Apache with SSL...
XAMPP: Stopping MySQL...
XAMPP: Stopping ProFTPD...
XAMPP stopped.
Starting XAMPP for Linux 1.7.3a...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.
			
		
	
 Third, open the Firefox web browser and in the address bar enter:
http://localhost
Fourth, when the XAMPP splash page has been displayed, select your language. You should then see the following message on the system: 
You successfully installed XAMPP on this system!
Fifth, in the tools at the XAMPP navigation menu, click phpMyAdmin.
You will then see an error: Existing configuration file (./config.inc.php) is not readable.
This is because the affected file of this error config.inc.php is not set to your Linux username. To fix this, in the Linux terminal, go to /opt/lampp/phpmyadmin directory. Here is the actual command:
	Quote:
	
		
		
			root@fwh2:/# cd /opt/lampp/phpmyadmin
			
		
	
 Now that you are in the phpmyadmin directory, you need to set the ownership of the file config.inc.php to your own Linux username (replace my username with yours). Here is the actual command:
	Quote:
	
		
		
			root@fwh2:/opt/lampp/phpmyadmin# chown melbin:melbin config.inc.php
			
		
	
 
	 
	
	
	
		Step 5: Configure Linux XAMPP Security
	
	
		Step 5: Configure Linux XAMPP Security
First, log in as root. Then go to your Linux root directory (/) and type:
	Quote:
	
		
		
			/opt/lampp/lampp security
			
		
	
 Answer "YES" to all and type the password. You cannot see it while typing, but XAMPP will verify it. Here is the actual series of commands in the Linux terminal:
	Quote:
	
		
		
			root@fwh2:/opt/lampp/phpmyadmin# cd /
root@fwh2:/# /opt/lampp/lampp security
			
		
	
 
	Quote:
	
		
		
			XAMPP: Quick security check...
XAMPP: Your XAMPP pages are NOT secured by a password.
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Password protection active. Please use 'lampp' as user name!
XAMPP: The MySQL/phpMyAdmin user pma has no password set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Setting new MySQL pma password.
XAMPP: Setting phpMyAdmin's pma password to the new one.
XAMPP: MySQL has no root password set!!!
XAMPP: Do you want to set a password? [yes] yes
XAMPP: Write the password somewhere down to make sure you won't forget it!!!
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Setting new MySQL root password.
XAMPP: Change phpMyAdmin's authentication method.
XAMPP: The FTP password for user 'nobody' is still set to 'lampp'.
XAMPP: Do you want to change the password? [yes] yes
XAMPP: Password:
XAMPP: Password (again):
XAMPP: Reload ProFTPD...
XAMPP: Done.
			
		
	
 Since there is a database configuration file alteration, you need to change the ownership back to your username (it's the same process you went through in the earlier section):
In the Linux terminal:
	Quote:
	
		
		
			root@fwh2:/# cd /opt/lampp/phpmyadmin
			
		
	
 
	Quote:
	
		
		
			root@fwh2:/opt/lampp/phpmyadmin# chown melbin:melbin config.inc.php
			
		
	
 Finally restart XAMPP Again with /opt/lampp/lampp restart
 Here is the actual command:
	Quote:
	
		
		
			root@fwh2:/# /opt/lampp/lampp restart
			
		
	
 
	Quote:
	
		
		
			Stopping XAMPP for Linux 1.7.3a...
XAMPP: Stopping Apache with SSL...
XAMPP: Stopping MySQL...
XAMPP: Stopping ProFTPD...
XAMPP stopped.
Starting XAMPP for Linux 1.7.3a...
XAMPP: Starting Apache with SSL (and PHP5)...
XAMPP: Starting MySQL...
XAMPP: Starting ProFTPD...
XAMPP for Linux started.
			
		
	
 You should not see any error.
	 
	
	
	
		Step 6: Test Your Overall Installation Process
	
	
		Step 6: Test Your Overall Installation Process
You are almost finished! You need to double-check your XAMPP installation using the process below.
1. Clear your entire browsing history and cache. In Firefox: Tools - Clear Recent History - set to "Everything" and check all options available. Then click "Clear Now."
2. Visit http://localhost, and log in with your XAMPP username/password that you configured in the earlier section. If you are able to log in without error, your login configuration is correct.
3. Click the phpMyAdmin link again in the XAMPP menu. You should now be able to see the phpMyAdmin login page since you already changed the ownership of the config.inc.php file in the earlier section. Try logging in with your MySQL username and password. You should not see any errors.
Important: the MySQL database in phpMyAdmin has two accounts, one with pma as the usename, while the other uses root as the username. Both are accessible using the same passwords.
If you were successful in this step, congratulations. You have completely installed and configured XAMPP to run in Ubuntu under your own username. If your computer is configured to have a Windows XP dual boot with Ubuntu, you can create a backup of your Windows-based XAMPP htdocs files to your Linux XAMPP htdocs, with its corresponding databases.
Important: do not overwrite or delete these following important default files inside your htdocs:
    * webalizer
    * xampp
    * favicon.ico
    * index.php 
They are installed by default and needed for normal operation.
Tip: To start XAMPP automatically after any reboot or computer restart (as in Windows), follow the procedure below.
1. Launch the Linux terminal and log in in as root.
2. Enter the following commands one after another:
	Quote:
	
		
		
			sudo ln -s /opt/lampp/lampp /etc/init.d/lampp
sudo update-rc.d -f lampp defaults
			
		
	
 
	 
	
	
	
		Advanced start and stop parameters
	
	
		/opt/lampp/lampp start        Starts XAMPP.
/opt/lampp/lampp stop        Stops XAMPP.
/opt/lampp/lampp restart    Stops and starts XAMPP.
/opt/lampp/lampp startapache    Starts only the Apache.
/opt/lampp/lampp startssl    Starts the Apache SSL support.
/opt/lampp/lampp startmysql    Starts only the MySQL database.
/opt/lampp/lampp startftp    Starts the ProFTPD server.
/opt/lampp/lampp stopapache    Stops the Apache.
/opt/lampp/lampp stopssl    Stops the Apache SSL support.
/opt/lampp/lampp stopmysql    Stops the MySQL database.
/opt/lampp/lampp stopftp    Stops the ProFTPD server.
/opt/lampp/lampp security    Starts a small security check programm. 
For example: To start Apache with SSL support simply type in the  following command (as root):
	Quote:
	
		
		
			/opt/lampp/lampp startssl
			
		
	
 You can also access your Apache server via SSL under https://localhost.
Important Files and Directories
/opt/lampp/bin/            The XAMPP commands home.
/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.
Stopping XAMPP
To stop XAMPP simply call this command (as root):
	Quote:
	
		
		
			 /opt/lampp/lampp stop
			
		
	
  You should now see:
  Stopping LAMPP 1.7.3a...
LAMPP: Stopping Apache...
LAMPP: Stopping MySQL...
LAMPP stopped.
 And XAMPP for Linux is stopped. 
Uninstall
To uninstall XAMPP just type in  this command (as root) :