First Steps In Drupal

This is the first in a series of occasional tutorials about Drupal. I know from past experience that there isn’t a fantastic amount of material out there on the web for Drupal newbies and when I started doing Drupal I had to resort to buying the book ‘Pro Drupal Development’ by John K. VanDyk. I have to say that this is an excellent book for beginners and I highly recommend it to you. I do realise however that its not everyone that wants to pay out their hard earned cash so I thought I’d put this tutorial and others that will follow on my blog.

This tutorial assumes that the reader already has some knowledge of HTML and a little knowledge of PHP/MySQL

The first thing you need to do is download the source code. At the time of writing, Drupal 7 is available but is still in alpha so this tutorial will deal with Drupal 6. You can do this from the command line using the command

wget http://drupal.org/files/projects/drupal-x.x.tar.gz

If you’ are not comfortable using the command line you can download the source code here:

http://drupal.org/project/drupal

You should unpack the the source code into the directory that acts as your webserver root using the tar command. If your version of Drupal was 6.19 you would use the command

tar -zxvf drupal-6.19.tar.gz

Obviously if you use a different version you would substitute your version number for the one I have used.

Drupal needs a database to be able to function. First you will need to create an empty database and then an account that will run your Drupal installation. If you use phpMyAdmin this is fairly easy to do. Personally I prefer to do it via the mysql command line client. The commands will vary according to which version of mysql you are using but will look something like this

INSERT INTO `user` VALUES(‘127.0.0.1′,’drupal_user’,password(‘mypassword’),’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,’N’,”,”,”,”,0,0,0,0);

INSERT INTO `db` VALUES (‘%’,’drupal’,’drupal_userr’,’Y’,’Y’,’Y’,’Y’,’Y’,’Y’,’N’,’N’,’Y’,’Y’,’Y’,’Y’,’N’,’N’,’N’,’N’,’N’,’N’,’N’);

You will also need to run the ‘flush privileges’ command for the 2 lines above to work.

After you have created the database and account you should return to your unpacked Drupal installation and navigate to the directory drupal-6.19/sites/default. In this directory you will find the file default_settings.php. You should copy this file and call it settings.php. Once this is done you will need to open this file in your favourite editor and find the line that defines the variable $db_url and then change it so that it reflects the new database and account that you created earlier. In my example this would look like this:

$db_url = ‘mysql://drupal_user:my_password@localhost/drupal’;

Once this is done you can get down to business by running the install script. All you need to do here is point your web browser at your newly created site. Following this you will be guided through several screens to set up the database, create tables, add the first user account and create a name for your site.

The most common cause of problems in this process is if the permissions you created when setting up the database are incorrect. I always give the drupal user the following permissions in mysql:

Select_priv

Insert_priv

Update_priv

Delete_priv

Create_priv

Drop_priv

During the install process Drupal will also attempt to create a directory at sites/default/files to store any files you upload for content in. You must ensure that your web server has writer permissions in the sites/default directory for this to happen.

If the install script succeeds, you will be directed to the “Welcome” page, and you will be logged in as the administrator already. You should see something like the screenshot below.

Proceed with the initial configuration steps suggested on the “Welcome” page.

I hope this tutorial was useful. Feel free to post questions and any constructive comments you have about ways in which this tutorial could be improved. I welcome your comments.

My next tutorial will deal with how to get your initial content into the Drupal content management system and to customise the way your content looks.
upal
Here is the shameful plug. Should anybody out there need any Drupal development doing or any other PHP development for that matter, I’m available for work. You can contact me via my website at

http://www.systemick-drupal-development.co.uk/contact

The Drupal page on this website can be viewed here:

http://www.systemick-dr-development.co.uk/drupal

This entry was posted in Drupal Development and tagged , , , , , . Bookmark the permalink.

4 Responses to First Steps In Drupal

  1. Good post on helping someone get started with a clean installation of Drupal!

    It would be quite rare for a user to have to interact with MySQL via the command line with how common CPanel and other GUI controls are with hosting packages any more, but it’s still good information to know just in case.

  2. Pingback: HELP needed!!! —— Moodle + Drupal + Drush … in Progress (2) « joysjsj

  3. Pingback: Creating Drupal Content | Systemick Web Development

  4. Ayesha says:

    Was looking out for a pretty basic tutorial for one of my customer, who wishes to learn Drupal. I shared your link along with Drupal.org with him and I hope you dont have any issues with this.

Leave a comment