Drupal allows you to run multiple sites from a single Drupal code installation -- each with its own modules, content, theme, etc. For instance, you can run:
- Multiple sites on your local computer
- Multiple domains in a single hosting account
- Multiple sub-domains
- Multiple sub-directory sites
For a live multi-site installation, see Multisites Using Drupal 7.
These pages describe one way to run multiple test sites on your local computer with Drupal 7 on Mageia 3 or 4 or Ubuntu 11.04. But the method probably works with little modifications for other distributions. Purposely, we only present one way to do that, in details, and we try to explain a bit what we're doing. We think this procedure probably contains useless things.
Note: if you are creating multiple sites, it is desirable to make a list of the desired sites before reading through these instructions completely. Some steps can be done in bulk to save time.
Why create extra sites? In addition to having several sites running already, you may have some ideas in the back of your head for other sites that you might put up in the future. So before you totally pooh-pooh the idea, give it a few minutes' thought. And you can always change your mind later; it just might be a bit messier then.
The main idea in this multi-site installation is that you need a MariaDB (or MySQL) database and a subdirectory of /var/www/drupal7/sites for each web site. It will be easier for you if their names are identical or similar (except for the default site, whose directory is /var/www/drupal7/sites/default and database is "drupal7"). In the instructions below, the site short name is "example", the database name is "company_example", and the site future URL: "example.com". The database will contain your web site text, while the subdirectory /var/www/drupal7/sites/example.com/ (Remember that example.com stands for your website future URL.) will usually contain your web site pictures, specific modules and themes, in subdirectories called "files", "modules" and "themes" respectively. The modules and themes common to multiple web sites are in /var/www/drupal7/sites/all/. The Drupal package installation creates automatically a subdirectory /var/www/drupal7/sites/default/.
To install the packages, you can use your distribution's package manager: "Ubuntu software center", "Mandriva control center" or "Mageia control center" (then → "Software management" → "Install & remove software", choosing "All" and "All" in the top left corner except if you want to restrain your search.) etc..
- If your distribution includes Drupal 7, install this package; if prompted to choose between MySQL and MySQLi, choose the latter, and go directly to the paragraph "Mono-site installation of Drupal 7".
- If your distribution doesn't include Drupal 7
- Install Apache, MySQL and PHP: if your distribution includes a meta-package called "LAMP" (Linux, Apache, MySQL, PHP), or "LAMP PHP", use it (In Mageia 3 or 4: Mageia control center → Software management, you can restrain your search to "Meta packages" and "All" in the top left corner. The same for Mageia 3, where the package is called "task-lamp-php".). If your distribution doesn't include such a meta package, install the three packages one by one.
- Install also PhpMyAdmin.
- (Step normally not needed in Ubuntu 11 and Mageia 3 or 4, but might still be needed in other distributions, or may have disappeared for some reason.) Install the PHP-PDO MySQL package: in Mageia 3 and 4, it's called php-pdo_mysql. And enable it: in Mageia 3 and 4, add the line
to the file /etc/php.d/70_php.ini .
Responsibility and acknowledgements
This page, redacted by Fiable.biz, includes partial copy and update of the author's contribution to How to documentation for creating Drupal 7 multisite configuration from Drupal's multisite group and Local multi-site installation of Drupal from Mandriva wiki. NancyDru and jcl_vanier are also to thank for the latter.