Installing Drupal on nearlyfreespeech.net

Before I get too deep into it and start taking it for granted, perhaps it's worth trying to document the steps. Not that that's an original idea, I found quite a lot of help out on the web and within nearlyfreespeech's forums. Maybe it's just me, but I find a lot of howto type material doesn't quite tell me what I need to know.

"Create user@localhost using...", is that what I need to type, literally? Or should I substitute 'john' for 'user'? And are those quotes really in what I type? And is 'localhost' always the right thing, or only when you're installing everything on one machine, so use your common sense when you aren't?

Well, if there's one thing that isn't commonly available, especially when it comes to computer recipe books, it's "common sense"! :)

So here's what I did when installing Drupal 5.7, though there'll probably be mistakes in it and there's lots of plagiarism in it -- thanks to everyone who helped. Maybe I'll get some feedback in the comments, which I'll then try to fold into the text to improve it.

The bits in italics you'll have to substitute the values relevant to your own installation. Here they are, they'll be explained in more detail as we go along:

membername the name you use to log in to NFS
shortname the first part of the name of your site (e.g. shortname.nfshost.com
dbservername.db
dbadminusername, usually the same as membername
mydrupaldb
drupaldbuser
drupaldbpassword

If you haven't already done so, create your site using the NFS Member's panel. If you're setting up custom DNS, you might do that now too, but I have no advice on that because my domain was already registered elsewhere and pointed at other hosting. I left it that way until several weeks later.

SSH into your NFS account. You should be in your /home/htdocs directory by default. If SSH is new to you, you'll need a tutorial elsewhere and it will depend on what operating system you're using.

Download the Drupal tarball from http:/drupal.org's "Download" link. I used version 5.7. You can find the link for the latest version by right-clicking on the download URL at Drupal's site. At this time 6.2 was also available, but my impression was that many contributed modules weren't yet converted for 6.2, so I wanted to keep my options open. You can download it onto your own PC and then transfer it to your site, but I think it's easier to use a single step.


cd /home/private
wget http://drupal.org/files/projects/drupal-5.7.tar.gz

I could have downloaded it to any directory, I may put it somewhere else eventually, I may even delete it eventually, but right now I don't have much in that place. Unpack it and move it to your web site:


tar -xvzf drupal-5.7.tar.gz
mv drupal-5.7/* drupal-5.7/.htaccess /home/htdocs/

Create the database. You can get the db server name and Admin Username from the email which was sent to you by NFSN when you first set up your MySQL database. Mine never arrived, but it didn't matter, because you can go to your member page, select the mysql tab and the db server name (DSN) (which I'll refer to as dbservername.db) is in the leftmost column. Click on it and the next screen repeats that and shows 'Default Admin Username' on the next line. Let's refer to that as dbadminusername. In my case it's the same as my membername.


mysqladmin -u dbadminusername -h dbservername.db -p create mydrupaldb

Type in your member password at the prompt.

Connect to your mysql database:


mysql -u dbadminusername -h dbservername.db -p

Type in your member password at the prompt. You should be logged into your mysql client, indicated by the "mysql>" prompt. Now
create a user for Drupal,
and give it sufficient privileges:


GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE
TEMPORARY TABLES, LOCK TABLES
ON mydrupaldb.*
TO 'drupaldbuser'@'%' IDENTIFIED BY 'drupaldbpassword';
flush privileges;
quit

Create a new database user drupaldbuser (maximum 16 characters), and a new, strong password drupaldbpassword. It can be a totally crazy random-letters-and-numbers password; you'll never have to remember it because you'll be typing it a few steps later, after which Drupal will store it in a config file.

During installation you need to let Drupal write to the settings.php file:


cd /home/publicsites/default
chmod 666 settings.php

Point your browser at http://shortname.nfshost.com/

Because you've not yet completed Drupal installation, the install script displays a special page and asks for some of the details that you set up earlier:

dbase name: mydrupaldb
dbase username: drupaldbuser
dbase password: drupaldbpassword
click on advanced
dbase host: dbservername.db
leave the 2 further ones blank
press save config

That's it. Now stop the file from being altered:


chmod 644 settings.php
cd ../..

Then create a drupal admin a/c

This should get you going.

Log in using the drupal admin a/c you've just set up.
Go to configuration.

I did this the next day and was warned about two problems. I hadn't run cron, but this can be done manually be clicking on the link given. The second problem was that it wanted a files directory.


cd /home/public
mkdir files
chmod 777 files

I then enabled clean urls (not essential, but nice)

I also created another user, with fewer permissions, for authoring pages.

There's lots of good information on www.drupal.org, in particular http://drupal.org/files/getting-started_2.pdf