Drupal on Debian
From Smop.co.uk
If you do things in the right order then it will be easier. I didn't, partly since I wanted to understand stuff a bit more.
packages to install:
- apache2
- postgresql
- php4-pgsql
- drupal
now let's setup these in turn. Fortunately drupal sets up apache2 for you by creating /etc/apache2/conf.d/drupal.conf as a website hosted at "/drupal/". If you want to run drupal as your main site you might want to change this. I havn't reached this stage (yet).
postgresql was a fairly new experience to me, mainly due to the fact that pgsql usernames and permissions are not related to the OS users (at least not directly) and I had to learn how to set this up. The Debian package does send an email out with short instructions.
First of all, "su" to the postgres user, type "psql template1" and at the prompttype "create user drupal;" then "alter user drupal with encrypted password ...;". We have now set a password for the drupal user.
Now "createdb -O drupal drupal".
However the default postgres authentication is "ident" which means that the user you are trying to log into the DB as must match your OS username. Since the websserver runs as www-data and we want it to login as "drupal" then we need to edit /etc/postgres/pg_hba.conf - add these lines near the top:
# for Drupal host drupal drupal 0.0.0.0 0.0.0.0 md5 local drupal drupal md5
Now restart postgres: /etc/init.d/postgres restart. Try logging in as drupal: "psql -U drupal -W drupal" (-W prompts for a password). If this fails, check the postgres logs.
Now we need to prepare the drupal DB for drupal:
psql -U drupal -W drupal < /usr/share/drupal/database/database.pgsql
This started producing errors near the end (where the functions are defined). My understanding is that postgresql needed to know about the plpgsql language. The Debian package has these added on the end, but I think that they need adding before the function definitions. Furthermore, I think I saw a message saying that you needed to be an admin before you could use the "CREATE LANGUAGE" function, so I actually ran those final two statements as "postgres". I then ran the function definition statements as drupal (which did work).
Trying to browse http://hostname/drupal/ failed - no configuration defined. So I copied /usr/share/doc/drupal/examples/conf.php to /etc/drupal and edited it - setting $db_url and $ba
se_url appropriately (dont forget the "/drupal" on $base_url).
Now I got a complaint that pg_connect<c/ode> was not defined, so I installed php4-pgsql and restarted Apache.
Hey presto - one Drupal install!
