Multisite CVS Drupal Installation on Ubuntu
Multisite CVS Drupal Installation on UbuntuIntroductionThis howto shows you how to do a multi-site Drupal install on Ubuntu. It also covers how to layout your directories for ease of maintenance, and how to ensure that you can update Drupal easily from CVS. Why go to all this bother? Why not just install Drupal using sudo aptitude install drupal? The answer is that as your website gets more popular, you're going to need to keep up to date with security patches, as well as manage all the custom modules you've installed. Also, it's nice to have one website as your main site, and a second one where you can test new Drupal features, modules or ideas. And who knows, after your first successful website, you'll probably want a second and third one (I know I did), so let's make it easy from day one. I developed and tested this howto on an Ubuntu Edgy Desktop VMWare image downloaded from the VMWare Appliances Directory - it should also work (with minor changes) on other versions of Ubuntu and Debian.
Configure DNSWe're going to create websites for www.example.com and www2.example.com (change these domain names to suit your requirements). Let's configure DNS so that you can start developing immediately - you can setup Bind and register your site later. Enter these commands: sudo bash Check this has worked by using the ping command - you should get a reply back from localhost (127.0.0.1): $ ping -c 2 www.example.com PING www.example.com (127.0.0.1) 56(84) bytes of data.
Install Packagessudo aptitude install apache2-mpm-prefork mysql-server php5-mysql cvs This command may seem quite small, but it will install quite a few other packages - this is normal.The command may have caused the postfix mailserver to be installed - if so, choose "No Configuration" in the menu (unless you want to setup a mailserver too).
Test Apache2/PHP InstallationTest Apache2 has installed OK by opening your favourite web browser and navigating to http://localhost. You should see a page that says "Index of /" , together with a link to apache2-default. Clicking on this link will take you to a webpage that says "If you can see this, it means that the installation...". To test that php has installed OK, create a new web page: sudo vi /var/www/apache2-default/index.php Put the following content in the page, save and exit: hello php world <?php phpinfo(); ?> Browse to http://localhost/apache2-default/index.php.
You should see a webpage that says "hello php world" on the first line, then
pages of php5 debugging information. If Firefox prompts you to download the php file instead of displaying it, restart Apache to force php to run - sudo /etc/init.d/apache restart. We don't need the default site anymore, so let's move it to our home directory rather than deleting it (in case we need it in the future):
cd
Test MySQL InstallationTest MySQL has installed OK by opening a command prompt and typing: $ mysql If this fails, ensure that mysql is running: $ sudo /etc/init.d/mysql restart We should also secure MySQL by setting a password for root: $ mysql Check your new password: $ mysql -u root -p
Install Drupal Using CVSAs I said in the introduction, we're going to be installing Drupal using cvs, rather than downloading a package or .tgz file. There are several advantages to doing this:
Let's do the install:
cd /var/www The key option here is -d drupal. This specifies the target installation directory - change it to install to a different directory. Also, be aware that you can have multiple websites running from one drupal install - there's usually no need to install drupal multiple times on the same server.
CVS UpdatesThe next step is to test viewing and getting the latest CVS updates. To make it easier for you to get updates in the future, we'll create some batch files:
cd See Using CVS to maintain a Drupal Website and Ximbiot CVS Documentation for more information on using CVS with Drupal.
Create Additional DirectoriesLet's create some directories to store our work in:
sudo bash Let's also customize the default site directory, as we'll be using this as a template for new sites:
sudo bash Now, if you run the cvs update scripts we created previously, you'll see that nothing in these directories is overwritten, but any changes will be downloaded.
Create the Drupal SitesCreate the web directories for the two sites:
sudo bash The next step is to create the mysql databases. In these steps, wwwdb and www2db are the databases for the website, wwwuser and www2user are the accounts used by Drupal when accessing MySQL, and password is the password for each user:
mysqladmin -u root -p create wwwdb We now need to configure Apache to serve up the two websites. The first step is to allow multiple websites on the same server (virtual websites):
sudo bash Then, edit the "default" configuration file, so it can be used as a template on a multi-site server: vi sites-available/default Remove the command "NameVirtualHost *" from line 1 of the file sites-available/default; to tighten security, remove the cgi-bin and doc ScriptAlias and Directory, change "ServerSignature" to "Off"; also change the email address of ServerAdmin, and optionally remove any comments; change any references from /var/www to /var/www/drupal. When completed, the sites-available/default file should look like this:
Using the default file as a template, copy it and set up the required links:
sudo bash
Configure DrupalThe last step is to run Drupal for the first time and configure it. You'll need to temporarily relax the permissions on the file settings.php (don't leave it like this too long):
sudo bash Open your web browser, and browse to http://www.example.com. You should get the Drupal configuration page - a web page with a large drupal icon top left, and the heading "Database Configuration". Fill out these settings and submit them:
A web page should now come up saying 'Drupal Installation Complete'; as the web page says, we need to tighten up permission on settings.php:
sudo bash Follow the link to your new site, and then follow the instructions for setting up your new Drupal site. Repeat all the instructions in 'Configure Drupal' on www2 to setup the second web site. Congratulations, you're now finished!
|



Recent comments
19 hours 7 min ago
20 hours 16 min ago
22 hours 9 min ago
23 hours 9 min ago
23 hours 23 min ago
1 day 2 hours ago
1 day 4 hours ago
1 day 5 hours ago
1 day 20 hours ago
2 days 12 hours ago