Preparing for Drupal 6 and Installing
**Please note this is an old article**
We have to do serveral more things to prepare the server and database for Drupal. The first thing is we need to enable mod-rewrite and also make a quick change to the default apache2 configuration file for sites-available.
First, lets go ahead and enable mod-rewrite by entering the following at the command prompt:
a2enmod rewrite
Now lets go ahead and edit, with your favorite editor (I use nano), the default configuration file for sites in apache:
nano /etc/apache2/sites-available/default
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
You will need to change the first two instances of the AllowOverride function to All, rather the None
NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Note: For those of you who are familiar with the Apache2 sites configuration, you will know this is where you can set up multiple virtual hosts on a single server using Apache2 virtual hosts. The reason we are configuring /etc/apache2/sites-available/default rather then /etc/apache2/sites-enabled/default is because this is simply a sym link back to the file we are editing. If you create a new Apache site configuration file, you should place it in the sites-available folder, and then enable it with the a2ensite command. Now we need to restart the Apache2 service:
/etc/init.d/apache2 restart
Now we need to set up databases for Drupal and Moodle to use for the installation process. I like to do this manually in phpmyadmin, because I want to set up a seperate user with a seperate password for this site database. It is important not to use the same password as your root MySQL password, so that you are not comprimising all of your databases if one site gets hacked.
Log into phpmyadmin by navigating to http://yoursite/phpmyadmin and login as the MySQL root user.
There is an easy way to create a new database, and user, and give the user rights to the database all in one shot. You can do this by clicking on privileges
And then click on "Add a New User"
Now we went to set up two users, and two databases. To do this, go ahead and name the new user, on localhost, and give it a password.
Then, make sure to check "Create database with same name and grand all privileges" which will do just that. It will in my case, create a user, and a database called drupal, and give that user full rights to the database. Do not give this user global privileges. It only need privileges to the one database for security, and practicality. While you're in here, go ahead and do the same thing but this time create a user and database for Moodle.
We are almost there! Next we need to download Drupal. I'll be using the latest version at the time of this writing, 6.2. I like to create a downloads directory in my home directory.
cd
mkdir downloads
cd downloads
wget http://ftp.osuosl.org/pub/drupal/files/projects/drupal-6.2.tar.gz
tar xfvz drupal-6.2.tar.gz
ls
You should see your uncompressed drupal files in the downloads directory now. Now lets move the entire thang into the /var/www folder, which is the root of our web server. If you do not want this to be in the root of your web server, you could put it as a subdirectory, but that is beyond the scope of this document.
The easiest way to move everything is to copy everything in the drupal-6.2 folder over.
cd drupal-6.2
cp -r * .htaccess /var/www
cd /var/www
rm -r apache2-default
ls
You should now see all of your drupal installation files in your /var/www/folder. Note that durring this step I also got rid of the apache2-default folder, which is no longer needed. We are so close!
The last thing we need to do before we begin installation is create a few folders that the installation will need. If you do not do this step, installation will tell you it cannot continue. Drupal can handle multiple sites in one installation, so it keeps add-on modules, themes, and files seperate for each site. With this in mind, we need to create a folder for these three things in our /var/www/sites/default folder. If you configure additional sites, you need to create these directories accordingly (ex: /var/www/sites/newsite)
cd /var/www/sites/default
mkdir themes modules files
chmod 777 files
Now that this is done, we can install drupal. To access the drupal installer, you must navigate to http://ipaddress or hostname/install.php
I would go into how to install Drupal 6 here, but there has already been a nice screencast done on it by Lullabot here.http://drupal.org/videocasts/installing-6
