Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Running multiple sites from one Drupal installation

From: Drupal 7 Advanced Training

Video: Running multiple sites from one Drupal installation

Now we come to a subject that's long intimidated me personally, running multiple web sites from one Drupal installation. But I have to tell you, once I started doing it; I found that it wasn't really all that hard. But the devil really is in the details, and unfortunately those details vary from web host to web host. What I'll show you here though gives you the ammunition you need to do the Drupal part of it, both on local and remote computers. Let's start with the local version. We're using Acquia Dev Desktop available at http://www.aquia.com/downloads.

Running multiple sites from one Drupal installation

Now we come to a subject that's long intimidated me personally, running multiple web sites from one Drupal installation. But I have to tell you, once I started doing it; I found that it wasn't really all that hard. But the devil really is in the details, and unfortunately those details vary from web host to web host. What I'll show you here though gives you the ammunition you need to do the Drupal part of it, both on local and remote computers. Let's start with the local version. We're using Acquia Dev Desktop available at http://www.aquia.com/downloads.

It has multisite capabilities built in. So what I'm going to do now is I'm going to download a copy of Drupal and show you how that works in Acquia Dev Desktop. To do so, I first go to http://drupal. org/project/drupal and then download it. Close out the window and expand that file. And I'm going to rename this multisite. Now inside this folder I'll go into our sites folder and then duplicate this default folder and rename that site1.

That will become one Drupal site, although you could repeat this process over and over again with site2, site3, and so forth. The next step is to import it. Go down here and to More and then click Import. I'll choose the site path, which in this case is that multisite folder that I just named. Now here's where things were a little different from what you're used to. Under Subsite, it'll look inside that folder and see what's there, and it sees that there is in fact a site1 folder, so we select that. Then we create a new database and do everything else the way we usually do, site1 and site1 and Import.

It'll ask you if you want to overwrite what's already there and we say Yes, and there we are, and then we'd just continue the installation as normal. Again, you could do this site2, site3, and so forth, and it will all be working off of the same code base of Drupal. The advantage to that is you only have to update Drupal once. Now I'll show you how it works on a web host. The tricky part and one that I won't be to show you is that you have to arrange to have your domain setup for both sites to point at the same web root, that is, your Drupal folder.

You can do that using whatever system your web host has for Domain Name Services, or sometimes it's called DNS. And what you should do is contact your Helpdesk at that web host if you have any problems. But I have already taken care of that. I have a blank folder right now at lynda3 .tomgeller.com, and also one at lynda4. I've also created two separate empty databases, one of them is tgellar_lynda3 and the other is tgellar_lynda4.

This is the key, although you're only using one set of files you have to have separate databases for each site that you set up. And that makes perfect sense because you'll remember the database is what stores the content and the content will be different between the two sites. Once again, I'm going to go in an install Drupal into both of those folders. Go to drupal.org/project/druple, Copy Link Location, and then go to my Terminal program. I am already in the folder lynda3 and if we list what's there, it's already empty.

Go through my usual procedure to get the file. I just say wget and paste, and extract it, and so on. You'll see in more detail how to do this in the videos about using the command line. And there is our installation. Once again, we go into the sites folder. As you saw a minute ago, we have an all and the default folder. I am going to copy that default folder twice; once to be lynda3 and once to be lynda4.

You'll notice I gave them the names lynda3.tomgeller.coml and, of course, the other one, I'll name lynda4.tomgeller.com. This is very important, because it tells Drupal exactly which folder goes with which domain; you have to give the name, so that it matches the domain that you're going to use. I'll then go into each of those and rename the settings.php file correctly. Move default, so its simply settings. php, and do the same for lynda4. If we go up one level, we now see that we have all, default, and then the two folders we just created, which are actually copies of default.

One important thing that you should be very careful of is not to remove the default folder. Even though you're not going to use it directly, that is, no site is going to live in it; Drupal expects to see it there, so simply leave it as it is. So now we have two databases and two separate folders inside that site's folder, one for lynda3 and one for lynda4. Let's go to lynda3, and complete the installation. This happens in the way that you're used to. Now that we have lynda3 setup, I'll do the same thing for lynda4.

Go To lynda4.tomgeller.com and go through the installation process. Remember, we're using a different database; in this case its tgellar_lynda4, and we hve success. lynda4.geller.com is running this site, and, of course, lynda3 is running the different site. There is one thing that I want to warn you about though. It's when you install modules using that system that's built into Drupal. If we click and go up to Modules and use Install new module, I am just going to grab the Token module, which is a common one from drupal.org, the drupal.org/project/token. Install new module and Install.

So the question is where exactly was that module installed? I am going to go back to my Terminal screen, clear the window, see where we are. Now I did that while looking at the lynda3 site. But it didn't actually go into the lynda3 folder; instead it went into the all folder. You can see that by going to cd all/ and modules, and there it is. That means that it's available to both lynda3 and lynda4. That's very important because if you want to make a module only available to one of the sites, what you would do is instead manually install it in that site itself.

So I'd go in to lynda3 and create a folder here called modules. You might have to go up one level in order to give yourself permission to create that folder called modules. I won't go into that right here; instead I'll talk about it in the video about UNIX permissions. The last thing that I want to mention is that you might have had to change some permissiosn along the way. So once you're done making all of these installations, go back and make sure that they are secure. The enclosing folders; that is, sites and defaults, and lynda3 and so on, should be 755; that is, only the owner can write, but everyone can read and execute.

The settings.php file, however, should have 644 or less. I am covering the very top of this, but you can learn more about multisite installations on the drupal.org site. To go to it, it's http://drupal.org /documentation/install/multi-site. I know that was a lot to learn, especially if you're not used to the UNIX command line. The basic things remember are that each site gets its own database and folder inside the sites directory. That the folders have to have the same name as the site's domain, and that the site's all folder is shared among all of them.

Show transcript

This video is part of

Image for Drupal 7 Advanced Training
Drupal 7 Advanced Training

72 video lessons · 10909 viewers

Tom Geller
Author

 
Expand all | Collapse all
  1. 4m 51s
    1. Welcome
      1m 7s
    2. Planning your Drupal career
      3m 44s
  2. 25m 46s
    1. Comparing development and production environments
      6m 22s
    2. Configuring your settings.php file
      7m 10s
    3. Running multiple sites from one Drupal installation
      7m 32s
    4. Troubleshooting common issues
      4m 42s
  3. 51m 20s
    1. Understanding your Drupal site's place on the web
      2m 44s
    2. Selecting a web host
      7m 20s
    3. Using Unix's command-line interface
      8m 23s
    4. Working with your web host's access restrictions
      4m 51s
    5. Using cPanel and other graphical web host interfaces
      3m 40s
    6. Transferring files to and from your web host
      5m 49s
    7. Moving databases using phpMyAdmin
      6m 34s
    8. Moving databases using Unix commands
      6m 8s
    9. Modifying server configuration files
      5m 51s
  4. 27m 10s
    1. Learning from case studies
      3m 13s
    2. Planning your site
      4m 18s
    3. Populating your site with Devel Generate
      3m 42s
    4. Managing URL paths
      3m 20s
    5. Restricting access to downloadable files
      5m 55s
    6. Reusing site components with the Features module
      6m 42s
  5. 21m 53s
    1. Understanding and installing Drush
      5m 23s
    2. Installing Drupal using Drush
      7m 24s
    3. Building a site using Drush
      9m 6s
  6. 31m 59s
    1. Backing up with the Backup and Migrate module
      8m 17s
    2. Moderating comment spam
      6m 47s
    3. Migrating from Drupal 6
      4m 28s
    4. Migrating to Drupal 7
      12m 27s
  7. 22m 24s
    1. Letting users log in through OpenID
      5m 10s
    2. Letting users log in through Facebook, Twitter, and other services
      9m 43s
    3. Republishing posts on Facebook and Twitter
      7m 31s
  8. 1h 5m
    1. Understanding Drupal's base themes
      5m 55s
    2. Introducing base themes: Zen and subtheming
      11m 35s
    3. Introducing base themes: Fusion and extensibility
      10m 44s
    4. Introducing base themes: AdaptiveTheme and responsive design
      7m 25s
    5. Introducing base themes: Omega and mobile devices
      7m 9s
    6. Using Firebug and other theming tools
      7m 20s
    7. Modifying themes with Sweaver
      6m 59s
    8. Modifying themes with Livethemer
      8m 45s
  9. 49m 35s
    1. Understanding the Rules module
      6m 48s
    2. Demonstrating how Rules works in Drupal Commerce
      3m 53s
    3. Creating practical rules
      6m 37s
    4. Improving rules
      9m 10s
    5. Defining conditions with the Context module
      7m 51s
    6. Varying layout with the Context and Delta modules
      5m 0s
    7. Varying layout with the Panels module
      10m 16s
  10. 52m 46s
    1. Enabling social features
      9m 46s
    2. Implementing a voting system
      9m 15s
    3. Rewarding good behavior with the Userpoints module
      5m 57s
    4. Setting up Organic Groups
      6m 28s
    5. Adding content to groups
      2m 21s
    6. Seeing group activity better with views and panels
      10m 13s
    7. Making groups private
      4m 54s
    8. Letting each group have its own permissions
      3m 52s
  11. 25m 32s
    1. Understanding packaged Drupal distributions
      2m 8s
    2. Getting a head start with Acquia Drupal
      7m 28s
    3. Creating online storefronts with Drupal Commerce
      6m 53s
    4. Creating government web sites with OpenPublic
      9m 3s
  12. 1h 30m
    1. Taking the assignment
      3m 26s
    2. Planning the project
      3m 43s
    3. Preparing the infrastructure
      8m 42s
    4. Starting the design
      7m 35s
    5. Filling in the content
      7m 29s
    6. Developing the layout
      10m 27s
    7. Finishing the layout
      7m 8s
    8. Refining the CSS
      6m 32s
    9. Setting up sections for regional offices
      4m 53s
    10. Configuring regional offices
      7m 18s
    11. Connecting to social media
      5m 9s
    12. Cleaning up
      12m 32s
    13. Securing the site
      5m 56s
  13. 37s
    1. Next steps
      37s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Drupal 7 Advanced Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.