Install Drupal with XAMPP in Ubuntu

Overview

Are you ready to build your very own website? It’s not as hard as you may think! A computer with an internet connection is all that’s required. Oh, and not to mention a healthy dose of patience!

This is a straightforward tutorial/guide which walks you through the entire process: installation and set-up, content management and basic configurations. Okay, enough chit-chat, let’s begin!

Obtaining the Tools

The softwares you’re going to be using are all free, open source and available online:

  • Drupal is a web content management system (WCMS). Basically, it’s an application which facilitates the creation of web contents (blogs, forums, polls, etc.), manages/controls the contents, usually by a point-and-click work-flow. Best of all, Drupal requires little or no programming skills.

Drupal 6.12 Downloadhttp://drupal.org/project/drupal

  • XAMPP (cross-platform, Apache, MySQL, PHP, Perl) is a web server application packaged with Apache HTML web server, MySQL (database management), PHP (a scripting language) and Perl (a programming language.)

XAMPP for Linux Downloadhttp://www.apachefriends.org/en/xampp-linux.html

Pre-Installation

By now, you should have already downloaded the following files:

  1. xampp-linux-1.7.1.tar.gz
  2. drupal-6.12.tar.gz

Note: Unless you know what you’re doing, it’s recommended that you’re using the same files to avoid any confusion. If, for example, when newer versions are released, simply type in the correct file name when installing in the “Install XAMPP” and “Install Drupal” sections.

Now, this tutorial is done on a Linux system (Ubuntu), not Windows. Remember earlier when I told you the tools I’d use are all free? Well, Ubuntu is an excellent alternative operating system to Windows! Give it a try, you may like it!

Install XAMPP

We install XAMPP by extracting its content to a folder named “opt”:

  1. Locate the file xampp-linux-1.7.1.tar.gz you’ve just downloaded.
  2. If it’s not on your Desktop, move the file there.
  3. Open the Terminal, enter the following command:

sudo tar xvfz Desktop/xampp-linux-1.7.1.tar.gz -C /opt

Start XAMPP

You installed XAMPP in the previous section, now it’s time to start it:

  1. Open the Terminal, enter the following command:

sudo /opt/lampp/lampp start

You should see the following lines in the terminal if everything is done correctly:

XAMPP: Starting Apache with SSL (and PHP5)…
XAMPP: Starting MySQL…
XAMPP: Starting ProFTPD…
XAMPP for Linux started.

Test XAMPP

Okay, so how do you know if XAMPP is currently active?

  1. Open your favourite web broswer.
  2. Enter the following address:

http://localhost

This page should pop up:

XAMPP

Click the Status link to see what’s running:

XAMPP - Status

Install Drupal

Let’s install Drupal by extracting its content to “opt/lampp/htdocs”:

  1. Locate the file drupal-6.12.tar.gz.
  2. If it’s not on your Desktop, move the file there.
  3. Open the Terminal, enter the following command:

sudo tar xvfz Desktop/drupal-6.12.tar.gz -C /opt/lampp/htdocs

  1. Let’s rename “drupal-6.12″ folder to a cleaner name, “drupal”.
  2. Enter the following command:

sudo mv /opt/lampp/htdocs/drupal-6.12 /opt/lampp/htdocs/drupal

Test Drupal

Okay, we can now verify whether Drupal has installed correctly:

  1. Open your web broswer.
  2. Enter the following address:

http://localhost/drupal

You should see this page:

Drupal Setup

Create a Database

In this section, we create a new database for Drupal to store data:

  1. Open your web browser.
  2. Enter the following address:

http://localhost/phpmyadmin/

  1. In the Create new database text box, type in a name for your database (I named mine “creativebushido”.)
  2. Click the Create button.

Configure Drupal

Having completed the installation of XAMPP, Drupal, and a brand spanking new database, we can finally go ahead and configure Drupal:

  1. Open your web browser.
  2. Enter the following address:

http://localhost/drupal

  1. Click the Install Drupal in English link.
  2. You will be likely to ecounter the following page:

Drupal - Requirement problems

Don’t fret! First, we make a copy of default.settings.php and rename it to settings.php.

  1. Open the Terminal, enter the following command:

sudo cp /opt/lampp/htdocs/drupal/sites/default/default.settings.php /opt/lampp/htdocs/drupal/sites/default/settings.php

Next, we need to grant permissions to the settings.php file so that it’s writeable:

  1. Enter the following command (press Enter after each line):

cd /opt/lampp/htdocs/drupal/sites

sudo chmod a+w default

sudo chmod a+w default/settings.php

Finally, we need to increase our PHP memory limit from 8M to 16M.

  1. Open the Terminal and type:

sudo nano /opt/lampp/etc/php.ini

Look for the memory_limit parameter and change the number 8 to 16.
Once you’ve changed it, exit the text editor by holding down Ctrl and press x. Type y to save the file.

Because you’ve just made changes to the PHP file, you need to restart XAMPP to update it:

  1. Open the Terminal, enter the following command:

sudo /opt/lampp/lampp stop

  1. To start XAMPP again, enter the following command:

sudo /opt/lampp/lampp start

That should have solved all the problems! Okay, now you should be able to see the Database configuration page in your browser:

Drupal - Database configuration

Notice that I have entered a name for my database, the same name I’d used earlier. Make sure you do the same.

Once you clicked the Save and continue button on the Set up database page, you will be directed to the Configure site page, like the picture below:

Drupal - Configure site

For security purposes, it tells you to remove write permissions to the settings.php file. Let’s do that:

  1. Open the Terminal, enter the following command:

sudo chmod a-w /opt/lampp/htdocs/drupal/sites/default/settings.php

Finally! You are now ready to enter some important informations for your new web site.

Fill out the the required information for the Site information and Administration account sections. Make sure you remember the username and password you’ve entered!

Drupal - Configure site

Once all the informations are filled out, click the Save and continue button.

Voila! Give yourself a pat on the back! You have just completed installing Drupal on your computer!

Drupal - Drupal installation complete

For now, you can begin building your site. Everything you’re doing right now is offline. Once you have everything to your liking, you can deploy the final product live online.

I hope this has been useful. If you have any technical issues, I strongly recommend that you make use of Drupal’s excellent Community web site!

59 Responses to “Install Drupal with XAMPP in Ubuntu”


  1. 1 Liam June 24, 2009 at 7:46 am

    Thanks, I am new to Linux and Drupal but don’t want to fall back on Windows as the default database server. Your instructions were quite complete to get started.

  2. 3 rebelvarun July 4, 2009 at 2:41 am

    simply awesome … a step by step procedure to install Drupal.I got the entire thing up and running under 45mins :D .Thanks creative bushido

  3. 6 saad July 5, 2009 at 5:52 pm

    hey man thanks for ur post….

    i m having one prob, when i install drupal and enter the address “http://localhost/drupal” it say “not found”…can u plz tell what can be the reason?

    and also when i install XAMPP, the page u showed is not displayed but only “it works” is shown on the page?

    waiting….thanx :)

  4. 7 Vili July 8, 2009 at 2:40 pm

    Hi!

    I was following the instructions very carefully, but when I had to test XAMPP there was all the time page load error saying that connection was refused.
    I don’t know what’s the problem!
    Can someone help me, please?

  5. 8 CreativeBushido July 8, 2009 at 8:06 pm

    Can you take a snap shot of the screen?

  6. 9 Vili July 9, 2009 at 8:25 am

    Hi!
    This is the text from the Page Load Error:
    Failed to Connect
    The connection was refused when attempting to contact localhost.
    Though the site seems valid, the browser was unable to establish a connection.
    * Could the site be temporarily unavailable? Try again later.
    * Are you unable to browse other sites? Check the computer’s network connection.
    * Is your computer or network protected by a firewall or proxy? Incorrect settings can interfere with Web browsing.

    I

  7. 10 Yonitg July 23, 2009 at 12:20 am

    Hey,
    thanks fir the very detailed explanation about drupal on xampp
    got it all running in 10 minutes.
    im testing open atrium on drupal, i heared good things about it.
    thanks – Yonit

  8. 11 satish kumar singh August 4, 2009 at 3:28 am

    hi
    thanks for your step by step procedure for drupal

  9. 12 Murali August 16, 2009 at 6:18 am

    Hi,
    I xampp-linux-1.7.2.tar.gz and installed successfully.
    Then downloaded drupal 6.6

    while installing drupal by running the install.php
    I am getting error like

    Deprecated:Function ereg() …

    can you please advise how to resolve it ….

    thanks
    Murali.

    • 13 CreativeBushido August 16, 2009 at 8:17 am

      Murali,

      You’re supposed to run the command in the terminal, not by clicking the install.php file.

      • 14 Jeff August 16, 2009 at 8:27 am

        I am getting the same error as well. when I go to http://localhost/drupal I get

        Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal-6.13/includes/file.inc on line 895

        Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal-6.13/includes/file.inc on line 895

        Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal-6.13/includes/file.inc on line 895

        Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal-6.13/includes/file.inc on line 895

        Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal-6.13/includes/file.inc on line 895

        Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal-6.13/includes/file.inc on line 895

        Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal-6.13/includes/file.inc on line 895

        Warning: Cannot modify header information – headers already sent by (output started at /opt/lampp/htdocs/drupal-6.13/includes/file.inc:895) in /opt/lampp/htdocs/drupal-6.13/includes/install.inc on line 618

        Warning: Cannot modify header information – headers already sent by (output started at /opt/lampp/htdocs/drupal-6.13/includes/file.inc:895) in /opt/lampp/htdocs/drupal-6.13/includes/install.inc on line 619

  10. 15 Dan August 16, 2009 at 1:48 pm

    I have the same error: Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal-6.13/includes/file.inc on line 895

    when loading http://localhost/drupal

    XAMPP is ok. Any ideas?

  11. 18 Dan August 16, 2009 at 11:21 pm

    Seems there is an issue with drupal 6.13 and xampp 1.7.2. If you use drupal 6.12 and xampp 1.7.1 everything works perfect. More specifically, it appears to be an issue with php5 and drupal involving .htaccess and php.ini. Beyond the scope of this forum. Thanks Bushido for the excellent how to.

  12. 19 Justina September 19, 2009 at 1:48 pm

    Yes… Drupal does not support PHP 5.3 … here more info http://drupal.org/node/527548

  13. 20 Justina September 19, 2009 at 2:07 pm

    Do you know how can I change the version of my PHP from 5.3 to 5.2 ? I am using Ubuntu 9.04 and installing drupal-6.14
    Help would be much aprecciated…

    • 21 Erik September 19, 2009 at 6:38 pm

      I had the same problem. I did a quick tweak to the line of code that was deprecated. I replace the ereg function call with…

      preg_match(‘/’.$mask.’/', $file)

      which seems to have worked as a quick fix. It isn’t the best solution but works for a home development environment.

  14. 22 Colin September 19, 2009 at 9:13 pm

    Thanks a lot Vincent, it works perfectly!!!

  15. 23 kamal October 13, 2009 at 4:12 am

    Owsome man…….. after having a solid search of 2 days i am now able to install xampp on my ubuntu. i am having one q can anybody tell me that at where i have to put my php site to run them at local host plzzzzzzzz.

  16. 24 Justina October 13, 2009 at 5:53 am

    If you put it in /opt/lampp/htdocs/yoursite you will then be able to see it from your browser as localhost/yoursite

    is that what you where asking?

  17. 25 мышкин October 18, 2009 at 8:05 pm

    Только вот вчера на эту тему думал, так что пост как нельзя в тему!

  18. 26 edi December 4, 2009 at 11:19 am

    thanks everyone, this worked for me preg_match(“/$mask/”, $file) not single quotes

  19. 27 edi December 4, 2009 at 12:17 pm

    How do i run it as a service?, for now i just sudo start everytime i boot.

  20. 28 Mark December 16, 2009 at 5:16 pm

    You have totally saved my life with this.
    A heap of thanks to you kind sir!!

    Regards,

    Mark

  21. 29 Shobana T December 16, 2009 at 11:34 pm

    very nice….i did all the configuration as you mentioned above..now i am creating my own website.

  22. 30 бaкинeц December 25, 2009 at 3:51 pm

    А вот интересно, сам автор читает комментарии к этой статье. Или мы тут сами для себя пишем? :)

  23. 31 Рубен Павленко December 27, 2009 at 7:22 pm

    На самом деле, как говорится – Без пользы жить – безвременная смерть.

  24. 32 vinz January 26, 2010 at 4:33 pm

    by me this was very good:

    preg_match(“/$mask/”, $file)

    on drupal 6.15 with ubuntu karmic

    cheers

    vinz

  25. 33 vinz January 26, 2010 at 4:35 pm

    …but not by copying this above… i needed to write it myself
    cheers

  26. 34 amit January 31, 2010 at 11:30 am

    simply awesome !!!!!!!!!!!!!!!!!!!!!

  27. 35 K February 8, 2010 at 4:50 pm

    I tried editing the /opt/lampp/htdocs/… file according to the helpful hint in the attached thread, and now I get:
    Notice: Use of undefined constant ” – assumed ‘”’ in /opt/lampp/htdocs/drupal/includes/file.inc on line 902

    Warning: Division by zero in /opt/lampp/htdocs/drupal/includes/file.inc on line 902

    Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal/includes/file.inc on line 902

    Warning: ereg() [function.ereg]: REG_EMPTY in /opt/lampp/htdocs/drupal/includes/file.inc on line 902

    What am I doing wrong?

  28. 36 sachi February 15, 2010 at 10:23 pm

    hi there,

    i’m installing xamp, after entering http://localhost/ it showing the test page but not the xamp page.

    any idea about this ?

    plz help

  29. 37 sachi February 15, 2010 at 10:28 pm

    after this command
    /opt/lampp/lampp start

    the result is like this

    /opt/lampp/lampp start
    XAMPP: SELinux is activated. Making XAMPP fit SELinux…
    Starting XAMPP for Linux 1.7.3a…
    XAMPP: Another web server daemon is already running.
    XAMPP: Another MySQL daemon is already running.
    XAMPP: Starting ProFTPD…
    XAMPP for Linux started.

    • 38 Kelvin March 13, 2010 at 1:50 am

      I think you have installed XAMPP from Ubuntu’s repository before. You will have to remove all three installtions of Mysql, Apache and PHP 5.1 with the commandline below:

      sudo apt-get install apache2 phpmyadmin mysql-server

      After that, follow this guide and reinstall XAMPP 1.7.1 will be just fine.

      Hope this helps :)

  30. 39 Kelvin March 13, 2010 at 1:46 am

    Was gonna made the move from WordPress to Drupal, hoping to test on it’s basic and as well SEO features. Thanks a lot for this well planned step by step guide, saved me hours crawling through the net :)

  31. 40 Adam March 13, 2010 at 9:06 am

    Thanks so much for this quick and easy tutorial.
    I’ve been trying for days to get Drupal installed on my localhost Linux.

    On the XAMPP side of things -there is some kind of bug (it’s in the Xampp bugbase just this month) regarding setting the security features. I usually harden the security of my XAMPP installs. But (as per the bug) once the MySQL root user gets a unique password, it tends to “DEACTIVATE” the MySQL server. This could be why most (if not all) of my previous attempts to install Drupal failed miserably.

    Your tutorial skips over the process of securing XAMPP. I’d like to (ideally) have a more secure setup and not leave my Web/MySQL server “wide open” so-to-speak.

    Is there any reason why securing XAMPP causes the MySQL database (when viewing the “Status” page) to Deactivate. I think when it is deactivated it prevents Drupal from installing.

    Thanks anyway, because now (from using your tutorial) I can use drupal offline and hopefully learn about its features and development capabilities.

    Adam

  32. 41 nagachandrika April 5, 2010 at 10:09 pm

    hey an amazing post! it is our saviour.. hey do u know how to integrate two cms tools? as in moodle and drupal for exmaple? moodle is a course managemnt tool..

  33. 42 Roberto April 23, 2010 at 2:04 pm

    Thanks for the instructions. It works perfectly.
    Could you post the same for Vista?

    Cheers,

    Roberto

  34. 43 Савва April 24, 2010 at 9:24 am

    Любопытная статья, кстати автору хочу предложить установить от яндекс.денег фишку на сайт “Дай рубль”. Я бы дал, так сказать на поддержание. ;)

  35. 44 Wendell Grohoske May 8, 2010 at 10:19 am

    hi!… useful post…. I publish at this place because you perhaps be able to help me. I know, it’s not the exactly exactly place to post but ……. I try to find a completely free hosting company that is ok to accept CGI. Do you know a reputable link or better a first-class free hosters database or something like that… etc. for what I search ?? ps:: Do you know free without ads hosting ?? With wich tool have you built your website ? Bye

  36. 45 Devin May 21, 2010 at 1:40 am

    Fantastic, I’ve read about 20 guides tonight, but this was by far the best. Nice and simple, thanks alot!

  37. 46 Peter Thomson June 19, 2010 at 3:28 am

    I keep getting this error message when I start http://localhost/drupal, could you please tell me what I should do to resolve this issue
    Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal/includes/file.inc on line 926

    • 47 Stan July 1, 2010 at 1:17 am

      “I keep getting this error message when I start http://localhost/drupal, could you please tell me what I should do to resolve this issue
      Deprecated: Function ereg() is deprecated in /opt/lampp/htdocs/drupal/includes/file.inc on line 926″

      Yeah me too!

  38. 48 extrarumeno July 8, 2010 at 8:15 am

    Solution :

    replaced in drupal/includes/file.inc on line 926

    “elseif ($depth >= $min_depth && ereg($mask, $file))” with “elseif ($depth >= $min_depth && @ereg($mask, $file))”

  39. 49 Chamitha de Alwis July 23, 2010 at 8:56 am

    Thanks. This helped a lot.

  40. 50 daninhu September 22, 2010 at 9:32 pm

    Hi
    I have done the installation XAMPP by typing sudo tar xvfz Desktop/xampp-linux-1.7.1.tar.gz -C /opt

    and start XAMPP use command sudo /opt/lampp start, it show me e few line look like this
    XAMPP: Starting Apache with SSL (and PHP5)…
    XAMPP: Starting MySQL…
    XAMPP: Starting ProFTPD…
    XAMPP for Linux started.

    but when I want to browse in the web it says IT WORKS! the web server software is running bt no content has been added, yet.
    could some one help me on this issue?
    thank’s

  41. 51 Elentir February 23, 2011 at 11:59 am

    Works, excellent guide. Many thanks.

  42. 52 vsint shendy May 28, 2011 at 8:56 pm

    Looks like this application better than others

  43. 53 rasta May 30, 2011 at 4:58 pm

    Hi, to the point I have install drupal drupal-7.2 and xampp-linux-1.7.4 on ubuntu 10.10, everything I have done but stuck in some step, I have copy the site use this command : sudo cp /opt/lampp/htdocs/drupal/sites/default/default.settings.php /opt/lampp/htdocs/drupal/sites/default/settings.php

    and PHP memory limit 128M, after restart XAMPP and browse to the http://localhost/drupal/install.php?profile=standard&locale=en
    I got error, this is the message :Error
    Settings file The settings file does not exist.
    The Drupal installer requires that you create a settings file as part of the installation process. Copy the ./sites/default/default.settings.php file to ./sites/default/settings.php. More details about installing Drupal are available in INSTALL.txt.
    could anyone help me?
    thanks

  44. 54 mabenten July 6, 2011 at 8:42 am

    wow.. that’s good, i like this articel

  45. 55 mow July 15, 2011 at 3:03 am

    thanks. great work.ı m purchade for this

  46. 56 Ravi January 10, 2012 at 9:08 pm

    Hi,
    This is nice tutorial. according to this I have installed drupal + xampp on Redhat linux 6. now I can acces http://localhost/drupal successfully.

    But i want to access drupal via the secure connection (https).
    Any idea ?

  47. 57 Cassiano February 12, 2012 at 8:16 am

    Great man. I’m a newbie in drupal, but user of ubuntu and xampp. This article is great. Simple and easy.

    Thanks!

  48. 58 santy February 29, 2012 at 12:10 pm

    Thanks a TON and this worked for me…


  1. 1 Installing Drupal 7 in Ubuntu 11.04 | Captured by Penguins Trackback on August 18, 2011 at 2:35 pm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.