Open Source

SolutionBase: Build a community Web space with Drupal

Drupal extends itself beyond the standard needs of a community site; it's a typical open source tool in that development is outstanding and seems to go on at an exceptionally fast rate. Jack Wallen gives the details on how to build your own community Web space with Drupal.

Recently, I had to migrate a community Web site from phpWebSite to another tool. Although I had used phpWebSite for years, it had become obvious that the tool had become outdated, insecure, and cumbersome for some users. I looked at XOOPS and Joomla; but, even though I really like using both tools, found they lacked in certain areas.

Finally, I came across Drupal. On its site, Drupal is listed as an open source content management system. However, I would say that Drupal is more of a community tool that extends itself beyond the standard needs of a community site. It's a typical open source tool in that development is outstanding and seems to go on at an exceptionally fast rate.

What does Drupal do?

Drupal offers the following:

  • Collaborative book: This is one of the more unique features of Drupal. You can set up your site to include "open source" authoring of a book.
  • User-friendly URLs: With the help of Apache's mod_rewrite, Drupal allows the admin to customize URLs on the site, making them easier for both users and search engines.
  • Polls: Both admins and users can create polls.
  • Threaded comments: This refers to the commenting engine within published content (not Forums).
  • Version control: Drupal contains a versioning system that keeps track of updates and edits of content.
  • Modules: The Drupal community has put together a large amount of modules (as of this writing, 2,022).
  • Administration: Drupal has one of the most well thought-out administration tools I've seen in this type of system.
  • Online help: Drupal has a great community-driven help forum. Naturally, it's open source.
  • Cross Platform: Drupal will work under both Apache and IIS environments.
  • Themes: Hundreds of themes currently exist.

The above list just skims the surface of what Drupal offers. With that in mind, let's get to the installation and configuration of your first Drupal site.

Installation

The first thing you will need to do is to get the latest release of Drupal. As of this writing, the latest release is 5.2 and can be downloaded from the Drupal download section. Make sure you download the stable release, not the development release.

Once you have the file on your server, you'll need to create the database the site will use. I use phpMyAdmin to create all databases (it makes MySQL so much easier.) I named my database, simply enough, drupal. You will need to know the following for your database:

  • host (if Drupal is being installed on the same server as the MySQL database -- as it should be -- localhost will suffice).
  • Database username
  • Database password

The next step will be to unpack the Drupal file. I will be installing Drupal on Fedora 7 so I will be unpacking the tar.gz file (inside of the document root /var/www/html/) with the command tar xvzf drupal-5.2.tar.gz. Once the file is unpacked, I changed the name of the resulting directory from drupal-5.2 to drupal with the command mv drupal-5.2 drupal. The final step (before we take over with the browser-based install) will be to modify the permissions of one file within the drupal directory. Issue the command (from within the drupal directory) chmod 777 sites/default/settings.php. This change only needs to occur during the installation of the system.

Once you have the permission set on the file, point your browser to http://address_of_server/drupal/install.php and enter the database information into the first window, as shown in Figure A.

Figure A

Under the advanced options, you can enter a table prefix in case you intend on having more than one Drupal installation using the same database.

Once you have that information, press Save Configuration and you will see the final configuration screen, as shown in Figure B.

Figure B

Take heed of the warning in pink.

Now, as the warning says, you will want to remove write permissions to the ./sites/default/settings.php. Do this with the command chmod 555 sites/default/settings.php (from within the drupal installation directory.) Select the link to continue on to your new site.

You are now ready to start configuring your new Drupal site.

Initial configurations

When you first go to your new Drupal site, you'll notice that the first steps are all laid out for you, as shown in Figure C. The first step is to set up an administrator account.

Figure C

Before you do any other configuration, you must create the administrator account.

It's relatively simple. Select the Create The First Account link. Here you will be asked for a username and e-mail address. Once you enter those two bits of information, you'll be asked to add a password, signature, select the proper time zone, and press Submit. The account is created. Once this account has been created, you will see a new menu entry on the left hand navigation: Administer. Select this link to bring up the administration window, as shown in Figure D.

Figure D

The first thing you should take note of is the pink box.

The pink box will display any installation errors. If there are any (there likely will be), select the status report link within the box. This new window will give you all of the necessary information you need to solve any remaining installation woes. As you can see in Figure E, my installation needs to have a directory created and cron jobs started.

Figure E

Fortunately, the system tells you exactly what you need to do to finish the installation.

The first thing to do is to create the files directory within the drupal installation directory. To do this, issue the command mkdir files from within the drupal directory. Next, issue the command chmod -R 777 files (again, from within the drupal directory). Once you have done that, refresh the status report page to see only one issue (cron jobs) remaining.

To take care of the cron job issue, you can simply select the Run Manually link for a quick fix. Now all errors are taken care of and the site is ready to be finished.

Obviously, your demands will dictate how you configure your site. So I will walk you through enabling modules, configuring blocks, and configuring menus.

Enabling modules

There are a number of modules pre-installed on your system. Not all of these modules are enabled, however. To enable the modules, you will need to select the Administer link from the left navigation and then select on the Modules link under Site Building. Once there -- see Figure F -- you simply have to scroll down the list of modules, check the enable box associated with the desired module, and (when you have checked all the modules you wish to enable) press the Save Configuration button.

Figure F

After base installation, only the bare minimum of modules is enabled.

If you have found modules that are not included with the base installation and you want to include them, you simply have to upload the file to the server in the drupal/modules directory, unpack the module file (either in tar.gz or .zip format), point your browser to the Modules page (the same page you see in Figure F) and check the Enable box for the newly added module.

Make sure the module you want to add is compatible with the Drupal version installed.

Once you have enabled the modules, you will have to add them to a block for them to appear.

Dealing with blocks

A block is simply a module placed within a block on the Drupal page. There are five locations for blocks: Header, Left Sidebar, Right Sidebar, Content, and Footer. Select the Administer link and, under Site Building, select the Blocks link. The new page will list the various modules along with a drop down list of the locations to place their block as seen in Figure G.

Figure G

Select the drop-down list to select where the module will live.

Once you have decided where the module block will go, assign the block weight. Weight gives the block a position ranking within its location. You can choose a weight ranging from -10 to 10. The lower the number, the higher up on the page the block will appear. If you want a particular block on top of the section, simply assign that block the lowest possible number.

Once you have assigned all the necessary blocks, press the Save Configuration button. When the page refreshes, the new modules appear in their blocks. If a module has no content, the block will not appear.

Configuring menus

Go back to the Administer link and select the Menu link under Site Building. The menu items you should be most concerned with are the Navigation items. This is where you can add links to various modules and features to your site. There are two ways to add links under the Navigation menu shown in Figure H. The easiest method is to scroll through the listed items and select either Enable (to add the item) or Disable (to remove the item).

Figure H

Once you enable an item, the Edit link will appear, allowing you to further configure the entry.

You can also manually add various links to the menus. By selecting the Add Item link, you can add a link to either an external site or a page within your site. To add such links, you will be required to enter the full URL to the site or page.

You can also add new menus by selecting the Add Menu link near the top of the Menus configuration. This will only require you create a name for the new menu. Once the menu is created, you can add items as you did with the navigation menu.

Final thoughts

As you can see, Drupal is a very simple system to install. Don't let the installation fool you, however; Drupal is very powerful. You can flex a lot of muscle with this system, but only as much muscle as you want to flex. Now that you have your Drupal site up and running, you can explore just how to make it fit your exact needs.

About

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website getjackd.net.

7 comments
SteveCarvel
SteveCarvel

Thanks for the article. This will help me a bunch in the coming months while I'm building a community for some of the non-profits I work with. I just ordered this book on building Drupal communities as well http://www.duoconsulting.com/capturing-community. Let's hope I can pull this off.

Jaqui
Jaqui

they claim to meet W3C standards, yet the pages generated by their demo will not validate with the W3C validator. [ tested by url using the W3C validator]

Drupal Ace
Drupal Ace

"On its site, Drupal is listed as an open source content management system. However, I would say that Drupal is more of a community tool..." Drupal is so flexible, it can be hard to pin down. One of the more interesting descriptions I've seen called it not a content management system, but a content management _framework_, used to build your own custom content management system. Mmm, deep. : ) Whatever it is, it works well and does a lot. Thanks for the succinct first-steps overview; Drupal has more documentation than many open-source projects, but it can be hard to find quick introductions within the copious docs. I would add, though, that some details of your overview may vary with users' setups. As one example, the locations you mention for block placement will be true for the default Garland graphic theme, but may differ for other themes. Still, that particular info is correct for anyone working through your steps from the beginning. I run a site primarily aimed at Drupal beginners, and have added this article to my resources page at http://www.drupalace.com/page_resources . Please post more Drupal articles in the future!

hammc
hammc

I liked Drupal but Joomla has much more support their community of supporters. www.joomla.org

Drupal Ace
Drupal Ace

I started out trying Mambo (predecessor of Joomla), but left for Drupal primarily for the latter's taxonomy system. (Details in this article: http://www.drupalace.com/about ) That was a year and a half ago. I don't know whether Joomla now has a taxonomy or tagging system that would work where Mambo didn't at the time. I'll have to dive into Joomla some time soon and see what's new.

Editor's Picks