• Configure & Run XAMPP on Ubuntu Linux

    Posted by markzero on Monday, April 2nd, 2012

    I like to keep posts as simple as possible, so don’t mind me writing things fast — there is comments section below where you can feel free to ask anything related ;)

    You probably installed XAMPP already and then came here for help, but let’s cover that part too. Go to our beloved Google.com and search “install xampp on linux”. First result that appears, click on it and follow steps on ApacheFriends’ website. Download from first link in the table (at time of this post it was “XAMPP Linux 1.7.7”, size 77MB).

    Follow step 2.

    Now, if you get stuck at > /opt/lampp/lampp start, do this:

    sudo service apache2 stop (if you are logged as SU, omit “sudo” part)

    Also, you can stop mysql service, same as above but instead apache2, type “mysql”.

    This is because Ubuntu Linux (or any) has it’s own Mysql and Apache servers installed. Kill them to use XAMPP’s ones.

    Now type in console:

    sudo /opt/lampp/lampp start

    …and type in browser http://localhost and you’ll see XAMPP live and running. But here we have problems which you need to solve by yourselves. Go to //localhost/phpmyadmin and you will get “Existing configuration file (./config.inc.php) is not readable.”. This is because you need to set permissions for your username. Go to Phpmyadmin folder (> cd /opt/lampp/phpmyadmin).My username is markzero, and command to run was:

    sudo chown markzero:markzero config.inc.php (so obviously instead “markzero” put your username)

    Now we also need to set some ownerships, and permissions to htdocs folder inside XAMPP, otherwise we won’t be able to FTP files into it, and/or to copy. Go to /opt/lampp folder (> cd /opt/lampp). Write this piece:

    sudo chown -R your-username:your-username htdocs

    …and…chmod it to 755:

    sudo chmod -R 0755 /opt/lampp/htdocs

    And nope, it is not yet done. We need to change /opt/lampp/etc/httpd.conf file to reflect our ownership change. While in /opt/lampp folder, type:

    sudo gedit /opt/lampp/etc/httpd.conf (fixed)

    Find this:

    — User nobody

    — Group nogroup

    — </IfModule>

    — </IfModule>

    Note: it might not write “nobody” or “nogroup” but find that module, there aren’t two of them. Change “nobody” to your username, in my case it is “markzero”. Restart your mysql and apache2 services as explained above in beginning, and it should all work!

    Now create some folder inside /lampp/htdocs and copy some files through FTP to it. Success! All is working: FTP, write permissions and ownerships.

    Start (approximately) from scratch before this tutorial to be sure you followed exactly as I wrote. Let me know if you run into issues! ;)

    Posted in: Linux, MySQL, PHP, Tech.

    Share this story:

    15 responses to “Configure & Run XAMPP on Ubuntu Linux”

    1. Za'job says:

      Hey, you wrote:

      sudo gedit /etc/httpd.conf

      but I guess it should be

      sudo gedit /etc/httpd.conf

      Report this comment

    2. markzero says:

      I don’t get it Za’job, you wrote two same lines?

      Report this comment

    3. Asher says:

      Hey man! you saved me a lot, I was almost uninstalling the xampp thing and I was headed for the tedious apache/mysql/php component installation

      Report this comment

    4. Gadss says:

      thanks markzero, you saved me!…

      Report this comment

    5. Shawn says:

      Great tutorial. It fixed my not being able to edit site files in /htdocs.

      However, I followed all the steps and am still having issues creating new databases via phpMyAdmin.

      I’m only able to log into phpMyAdmin via the default ‘pma’ user (my Ubuntu user/pass doesn’t work for this). Instead of being able to select an option under the ‘Create New Database’ section, there’s the message “No Privileges”.

      I’ve tried logging in via my Ubuntu user (which I setup following all the steps in your tutorial). Everything else seems to be working, except the phpMyAdmin bits.

      Any ideas?

      One other note (though I think it’s unrelated): I followed the sudo gedit /etc/httpd.conf command, and it brought up gedit and was loading the file, but never displayed anything (as if the file was blank). I ended up just running sudo nautilus and nav’d to the file and opened it, edited it, and saved. Don’t know why the command wasn’t displaying the file contents, but the alternative seemed to work.

      Report this comment

    6. Shawn says:

      I started from scratch and followed the tut again.

      The updated gedit file command worked this time :)

      I think perhaps some of my issues with not being able to log into phpMyAdmin stemmed from having run XAMPP security before the above tutorial.

      Anyhow, I removed XAMPP and started from scratch; following your tutorial and cleared cache and cookies, and viola- working now.

      Thanks for a great tutorial and the help.

      Report this comment

    7. james says:

      when i start my services like

      /opt/lampp/lampp start

      at that time it shows that

      Starting XAMPP for Linux 1.8.0…
      XAMPP: Starting Apache with SSL (and PHP5)…
      XAMPP: Another MySQL daemon is already running.
      XAMPP: Starting ProFTPD…
      XAMPP for Linux started.

      MYSQL is not running please help me out its urgent

      Report this comment

    8. markzero says:

      You should stop already running mysql service, try stopping installed mysql on your system, probably something like:
      “> sudo service mysql stop”

      Report this comment

    9. jack says:

      I can’t creat new database in mySQL
      I just found like below
      “Create database:
      No Privileges”
      How can i do that

      Report this comment

    10. teguh says:

      thank you very much markzero!
      it works!

      Report this comment

    11. Hiago says:

      Thx man really, you are amazing

      Report this comment

    Leave a Reply