Part VIII) Install Drupal, the website Content Management System

Introduction

Drupal appears to be best open source way to create web page content. It works well with the LAMP components, is open source and has a large community. The web sites are good looking and functional.

You can add content by adding modules, and you can add multiple users/contributors with different permission levels.

Installation

With later versions of ubuntu (Feisty Fawn and later), you can completely install Drupal from the Synaptic Package Manager. This really simplifies things. Furthermore, Drupal 5.1 is installed. The versions of Drupal after 5.0 are much, much easier to use than earlier versions. Drupal uses a PHP database.

To ease the administration of PHP, you can optionally go to the Synaptic Package Manager and install phpmyadmin. (I did this but have not actually ever needed to use phpadmin. Maybe I will sometime in the future). phpmyadmin can be started anytime by:

http://localhost/phpmyadmin/

If you need to install Drupal manually:

Note: This method of installation places files in differnet locations than the automatic installer script. It is not intended for newbies. Stick with Synaptic Package Manager whenever possible.

Download the current version (from http://drupal.org) of Drupal, following the installation instructions found at http://drupal.org/node/260:

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

[Note that you do not need to be root user to install Drupal.]

Now move the extracted files to your public html folder

mv drupal-x.x/* drupal-x.x/.htaccess /var/www/html

--------------------------------------------------------------------------

Create a MySQL database for Drupal

You need to create a new MySQL database for use with Drupal.

If you have never previously set up a root superuser password for MySQL, do so now. MySQL initially installs using a superuser account named root, without a password. You now want to assign a password to that superuser (obviously you want to use your own chosen password in place of your_new_password):

mysql -u root

mysql> UPDATE mysql.user SET Password=PASSWORD('your_new_password') WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

The superuser root administers all functions of MySQL. [Later (see below) you can add additional global users of mySQL.] Note that the global MySQL users have no relationship to individual database users. They are only used to create databases and do global MySQL functions. Each database that you set up will have its own set of users specific to that database only. These database-specific users can be named the same or be named differently than the global MySQL users.

So now let's set up a database for Drupal and create users for that database. [The file INSTALL.mysql.txt (provided during Drupal installation) provides some instructions on creating the MySQL database for drupal usage.] Basically, enter:

mysqladmin -u root -p create databasename

Use anything you like for your Drupal databasename. I happened to use podrupal as my Drupal databasename (i.e. mysqladmin -u root -p create podrupal). [Note that you will be prompted for the root superuser password you set above, since this is a global MySQL command. This is not the password for the database.]

Now you have to create users for the Drupal database and assign them passwords. Here I established root as a user for the Drupal database, in addition to root being used as the global MySQL superuser. Then I also establish fido as a database user (even though there is no MySQL global user named fido). I will generally use fido to administer the Drupal database, using root only in case of emergencies. I keep the same root and fido user passwords as I use elsewhere on my system, for simplicity, but they can be unique for this database only, if you want.

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON podrupal.* TO 'fido'@'localhost' IDENTIFIED BY 'password'; (I used my usual password here, but you can use a unique Drupal database password if you choose.)

GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON podrupal.* TO 'root'@'localhost' IDENTIFIED BY 'password'; (I used my usual root password here).

If you want to check that everything is created correctly, you can use phpmyadmin (http://localhost/phpmyadmin/).

-----------------------------------------------------------------------------

As I have mentioned, I like to reserve the root account for emergencies at all times. I therefore now create a second global user for MySQL. To make it easy to remember, I have also called this newuser fido, with fido's usual password (as the newuser_passwd). The command to create additional global MySQL users (from the command line terminal, using su or sudo) is:

mysql -u root
mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'newuser_passwd';
mysql> quit
------------------------------------------------------------------------------

Start Drupal

Ok, now fire up Drupal! Start up Firefox (or other browser) and login to:

http://localhost/drupal

Visit the Drupal Cookbook at:

http://drupal.org/node/120612

for a good beginners guide.

Drupal is a very fun and rather easy system. It is much easier to learn to use by actually trying it than by reading the documentation. For some reason, people make it sound harder to use than it really is. So play around with it. I got a nice looking simple web site in only 1 day.

There are a few extra steps, though. When you first login, you will be asked to establish a superuser for Drupal with a password, i.e. the administrator user. Here I used my fido login. You will use this login very frequently amd will create your Drupal site using it. Once you set it up there are a few more tasks.

Set up Drupal Cron tasks

Then you will be asked to start the cron (automatic tasks) for Drupal.
You can start this manually by hitting the "start manually" link.

What I then did was to install the Ubuntu Linux GUI for cron tasks. (Cron tasks are computer tasks that recur on a schedule. These are often started from the command line. However, you can use a GUI interface, akin to windows XP Task Scheduler, to schedule tasks more easily. I installed Gnome Schedule from the Synaptic Package Manager for this reason.)

To use Gnome Scheduler (Applications-->System Tools-->Schedule), I created a new task which performed the Drupal maintenance daily. I created a new recurring task which I gave a description of "Drupal Cron" and entered
http://localhost/drupal/cron.php
as the command, leaving the "No output" box checked.

Now I don't have to worry about the Drupal cron tasks.

Take Drupal live

Next I wanted to make my Drupal site live.

Remember when we made multiple virtual hosts for Apache? Let's revisit those steps.

First, you need a new URL for your Drupal website. If you are using the free DynDNS service, it must conform to their format. For example, I chose fidodrupal.dydndns.org. [The dyndns.org part is one of the (67 different) suffixes available to free users of DynDNS.]

I logged on to my DynDNS account and registered my new hostname there.

Then I updated my ddclient configuration file (/etc/ddclient.conf) so that it would update the hostname regularly. You must do this as the root user, I believe. For example, while logged in as the root superuser, or while using the command line terminal (logged in using su or sudo), use a text editor to edit ddclient.conf and add the new URL to the list of URLs to be updated.

For example, if you already have foobar1.dydns.org,fooobar2.dyndsnds.org listed, then simply add fidodrupal.dyndns.org to the end: foobar1.dyndns.org,foobar2.dydns.org,fidodrupal.dyndns.org

or list each URL on its own line:

foobar1.dydns.org
foobar2.dyndns.org
fidodrupal.dydndns.org

Then save the ddclient.conf file and restart ddclient:

/etc/init.d/ddclient restart

Of course, now that you have a new URL for your Drupal website, we need to tell Apache where to look. Review how to make virtual hosts with Apache. In /etc/apache2 should be a folder called sites-available. In it there should be a series of configuration files, or at least a default one.

Copy one of the files, such as the default file, and rename it drupal.

Now let's edit that configuration file, just as we did when we intially made virtual hosts. Edit the following lines appropriately:

ServerName fidodrupal.dyndns.org (or whatever URL you registered with DynDNS).
ServerAlias fidodrupal.dyndns.org www.fidodrupal.dydndns.org

DocumentRoot /usr/share/Drupal-5.1


If there is a <Directory> section, you must change the AllowOverride line to:

AllowOverride All

Now save the file.

Make a link to the file. (From the Nautilus File Browser, right-click on the file and "Make Link.") Move the new Link to the folder:

/etc/apache2/sites-enabled

Rename the link drupal (or whatever the original config file was named) instead of "Link to drupal."

Restart Apache:

/etc/init.d/apache2 restart

Now whenever you login to http://fidodrupal.dyndns.org you will see your Drupal website. Note that to access user options, you will have to login as http://fidodrupal.dyndns.org/?q=user (which will give you a login page).

You can, of course, always access your Drupal website from your host computer by typing http://localhost/drupal (or http://localhost/drupal/?q=user), and I recommend this method for working with your Drupal website.

Now you can change your Drupal website as much as you want and the changes will be live.

(To be continued. A newer version of this page may soon be available at Perspective Office (perspectiveoffice.dyndns.org))

In the next section, we will install Vista Office EHR on your Linux box, and then learn to install the GUI (graphical user interface) CPRS on your networked Windows computers so they can access VistA.

| Home page | Introduction | Chapter I: Installing Windows on a dual-boot computer | Chapter II: Installing Ubuntu Linux Server on a dual-boot computer | Chapter III: Adding the Ubuntu Desktop on a dual-boot computer | Chapter IV: Spiffing up Ubuntu Linux | Chapter V: Ubuntu/Windows shared networks | Chapter VI: Setting up a Web Site on Ubuntu | Chapter VII: Ubuntu/Apache Virtual Hosts (Multiple web sites, single server) | Chapter VIII: Installing Drupal Content Managment System | Chapter IX: Installing Vista Office EHR | Chapter X: Installing an Office Surveillance Security System with Ubuntu | Chapter XI: Installing an open source Groupware Server | Chapter XII: Installing a non-linear video editor for presentations |


Hosted by www.Geocities.ws

1