Community Documentation

Drupal Multisite Installation on Ubuntu 10

Last updated August 5, 2011. Created by danielhonrade on May 29, 2010.
Edited by enpjp, eli-f. Log in to edit this page.

Preliminaries

This tutorial assumes that you have already installed Ubuntu 10 or 11 and LAMP on a server or desktop

Install the LAMP packages by typing the following command in a terminal window:

sudo tasksel

A dialog window will open. Select the LAMP option by scrolling with the up/down arrow keys and click spacebar. If the result is a "command not found" then tasksel is not yet installed. Install it by typing:

sudo apt-get install tasksel

You should now be able to install the LAMP packages

Be aware of reported problems when using tasksel to install a LAMP stack in the Ubuntu desktop environment. Note: An easy option is to install Drupal6 from the Ubuntu software repository using:

sudo apt-get install drupal6

However, the software repositories are not necessarily up to date, so you should not use this method if you intend on migrating to a live installation

Install PHPMyAdmin for wysiwyg management of the mySQL database using:

sudo apt-get install phpmyadmin.

Check your installation by pointing your browser to:
localhost

you should see the default Apache web server page:

It works!

Now point your browser to:

localhost/phpmyadmin

You should see the login page of phpmyadmin. Using root password, which was set during installation, you can create and modify users and databases to work with your Drupal installation.

Step 1

  • Create a folder called 'drupal' -> /home/<your ubuntu login name>/, you can navigate to your home folder and create this folder
  • the result should be -> /home/daniel/drupal/ , I am using 'daniel' as my ubuntu login name

Step 2

  • You can now happily extract your drupal 6 to /home/daniel/drupal/ , by having this folder you can also add your 'drupal7' for drupal 7 version
  • the result should be -> /home/daniel/drupal/drupal6/, /home/daniel/drupal/drupal6/sites/ , note: usually, you get a folder like 'drupal-6.16' after extraction, but I just made 'drupal6'

Step 3

  • Edit 'host' by bringing on the terminal window, use this command 'sudo gedit /etc/hosts'
  • You can add any site name, ex. 127.0.0.1 mysite.com, then save

Step 4

  • Go to this sites-available folder, use this command 'cd /etc/apache2/sites-available'
  • Create a file called 'mysite.com', use this command 'sudo gedit mysite.com'
  • Write the following:
    <VirtualHost *:80>
      ServerAdmin webmaster@localhost
      ServerName mysite.com

      DocumentRoot /home/daniel/drupal/drupal6

      <Directory />
        Options FollowSymLinks
        AllowOverride All
    </Directory>
    </VirtualHost>
  • Save it, then enable it, use this command sudo a2ensite mysite.com
  • Reload apache, use this command sudo /etc/init.d/apache2 reload

Step 5

  • Create your site in sites folder, /home/daniel/drupal/drupal6/sites/mysite.com
  • Add settings.php to this folder, /home/daniel/drupal/drupal6/sites/mysite.com/settings.php
  • Make sure that settings.php is writeable by others.

Step 6

  • Open your browser, then type 'http://mysite.com'
  • You should see the installation setup of Drupal 6

Step 7

  • Make your settings.php read only again to avoid security messages.

Repeat Steps 3-7 to add another site, ex. mysite2.com

Note: I might have missed something, please put your comments, thanks

Comments

How to do for another site in a subdir?

It works for me but only for two different domines like: site_1.com and site_2.com
But I have some problem with this guide and with all the other that I followed for a site and another in a subdir like: site_1.com and site_1.com/site_2.
Can You help me?

try this

Daniel Honrade, Jr.

Kick-Ass Lead Themer
Promet Solutions Inc.
1802 W. Berteau Ave., Unit 209
Chicago, IL 60613
url: http://www.prometsource.com
An Acquia Partner - http://acquia.com/partners/showcase/promet-source
email: mail@danielhonrade.com

Rename index.html

Hello,

it is just a detail, but once you verified that you LAMP installation works fine ("It works!"), you should disable the index.html file in /var/www/ if in order to see, later, the installation setup of Drupal 6.

cd /var/www/
sudo mv index.html index.html.disabled

Thank you for this how-to!
Best regards,

Gonzalo Bulnes

Everything works fine on my

Everything works fine on my local webserver, so thanks a lot! But, how do I set up Ubuntu 10.04/apache2/drupal to make access from the internet possible when using multisite?

Hi Sippe, 1) If it is the

Hi Sippe,

1) If it is the naming problem, see my samples below:

My site with the same url:

local: http://webtheming.com

live: http://www.webtheming.com

My project site as subdomains:

local: http://prometsource.webtheming.com

live: http://prometsource.com or http://www.prometsource.com

2) If it's the connection then you have to check when or what part of the installation when your connection doesn't work anymore
like before or after LAMP installation, before or afer Drupal installation, before or after your configuration of the sites, that way
you can narrow down where the problem is. Hope this helps. :D

Daniel Honrade, Jr.

Kick-Ass Lead Themer
Promet Solutions Inc.
1802 W. Berteau Ave., Unit 209
Chicago, IL 60613
url: http://www.prometsource.com
An Acquia Partner - http://acquia.com/partners/showcase/promet-source
email: mail@danielhonrade.com

I wonder if I'm not missing

I wonder if I'm not missing something. I've followed your steps closely, but the site fails to load when I point my browser to it. Are there some additional features that are assumed in this process with regard to my local LAMP server set-up? I've have always served sites from the default /var/www directory - should I now make an adjustment to serve the test site from ~/drupal/drupal6?

*edit* I've just figured-out the issue, I needed to associate my test site with 127.0.0.1. Great!

Remote Access

After following the steps above, I have been able to successfully set up two sites using the same code base. I can access the site from localhost, but not from remote IPs.

Apparently, I still needed to change my DocumentRoot. Now, however, I am getting led to a new install, instead of one of the two sites I have already set up. My knowledge of Apache and servers in general is fairly limited, so please go easy on me. Thanks, Jon

Edit: Nevermind. It was a an issue with my domain provider. I had it set to forwarding, changed the A record and all was well.

Drupal Multisite AutoInstallation on Ubuntu 10/11

Hi all,
I'm writing a bash script to automate this process.
If you are interested, contact me.
Marco

how can i get it...?

the script

thx

not working

UPDATE: Never mind. I figured it out.

I tried all that for setting up multiple sites using the same codebase. Here's what I have:

/var/www/drupal is the default and it works great for http://drupal-dev.mydomain.com

I want to add: person1.mydomain.com for a second drupal site using the same codebase. So I created a virtual domain with apache2 using the exact instructions above and added /var/www/drupal/sites/person1.mydomain.com folder and copied over default.settings.php to /var/www/drupal/sites/person1.mydomain.com/settings.php

but when I point my web browser to http://person1.mydomain.com/, I see only settings.php and when I click on that, it just gives me a blank page. It doesn't seem to know that it needs to use the codebase in /var/www/drupal? What am I doing wrong?

http://drupal-dev.mydomain.com is working just fine. How do I get http://person1.mydomain.com to work with its own database and such?

Please advise. Thanks!

Page status

Needs updating

Log in to edit this page

About this page

Drupal version
Drupal 6.x, Drupal 7.x
Audience
Developers and coders, Documentation contributors, Site administrators, Site users, Themers

Installation guide

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License.