Installing Drupal

Date: Wed Mar 25 2015 Drupal
Before you can install Drupal you must have a capable web hosting service. The minimum requirements are MySQL 5.x and PHP 5.x support, and there are somewhere around a zillion web hosting providers who offer this level of service. It's best if the host runs on Linux (or another Unix-like OS) but it is possible to use (gag) Windows.

The official installation instructions are on the Drupal site.

You can download the Drupal source from drupal.org, simply look for the box on the upper-right of the front page. It is best to download the tarball directly to your web hosting service rather than first downloading it to your computer. The way I do this is to log into the web hosting account and use these commands:-


% cd public_html
% wget http://drupal.org/files/projects/drupal-x.x.tar.gz
% tar -zxvf drupal-x.x.tar.gz
% mv drupal-x.x/* drupal-x.x/.htaccess .

The URL for drupal-x.x.tar.gz is linked from the drupal.org front page. As of this writing it is best to use Drupal 6.x.

By "public_html" I mean to change directory (cd) into the directory your web hosting provider created to house your domain. It may be named public_html but modern web hosting providers use a more appropriate name. On Dreamhost they place a directory in your home directory named after the domain name.

When you unpack the tarball it goes into a directory named drupal-x.x, depending on the current Drupal version you downloaded. The last command moves the files from drupal-x.x into the directory set up to hold the domain.

Grant write permissions to the settings file, so that the installer can do its work


% chmod a+w sites/default/settings.php

Create a MySQL database to store the site data. Drupal stores all its data in a database, and MySQL is preferred. Your web hosting provider probably has a "control panel" that lets you do web site maintenance, and it is here you will create the database. The database name can be anything, and what you will need for Drupal installation is the host name for the MySQL server, the user name and password for your database as well as the database name. All this will be set up via this control panel.

Once the database is set up use your web browser to visit the URL: http://example.com/install.php

There are a few simple questions to answered as detailed in the drupal.org install instructions.

Once you're finished with the install.php turn off write permissions to the settings file


% chmod 555 sites/default/settings.php

Also create a directory for storing uploaded files


% mkdir sites/default/files
% chmod o+w sites/default/files

Drupal has background tasks which are to be executed regularly throughout the day. These "cron" tasks do necessary bookeeping things. If you are on a Unix-like web hosting system (e.g. Linux) you can type crontab -e to edit your cron configuration. Then enter this following line:-


0 * * * * wget -O - -q -t 1 http://www.example.com/cron.php

You now have an initial user account set up, and are in an empty Drupal web site.