The Drupal project has fond hopes of one day producing the most user-friendly content-management system in the world, and it's making great strides in that direction. However, it's still written by and mostly for programmers, so often the easiest way to install and upgrade it is from the UNIX command line! Many people prefer to use drush, but here's how I do it without drush. These instructions are for Drupal 7.
To install Drupal on the command line:
- in a Web browser, go to http://drupal.org/project/Drupal+project , right-click the Download link for the version you want, and copy the link location.
- In an SSH (or Telnet) session to your host account, type
to go to your document root. (Note: your document root may be called something else, like public_html.)
and paste the link location from step 1, then press Enter. The file will download to your account, for example drupal-6.9.tar.gz. "wget" means "get from the Web."
tar -xzf drupal-7.12.tar.gz
(or whatever the file name was from step 3) to expand the file into a directory, in this case drupal-7.12. Think of "-xzf" as standing for "extract zip file." Think of "tar" as what you use to stick a bunch of files together! (or, in this case, unstick them)
- At this point many people would rename the directory to something nicer, like drupal. I recommend instead making a symbolic link (shortcut) to it, like so:
ln -s drupal-7.12 drupal
so that you can keep multiple versions in your account at once without getting confused as to which is which. "ln -s" stands for "link symbolically"
- It is now safe to delete the file you downloaded, like so:
"rm" stands for "remove."
- Go to your new URL in a Web browser and follow the directions there.
To upgrade Drupal on the command line:
- Log onto your Drupal site with the admin account. You will need to be admin in order to run the update.php script below.
- Follow steps 1-4 above to get the most recent version and expand it.
- Back up your database to a file. If you are using the Backup & Migrate module, this means clicking on Configuration in your black administrative toolbar, clicking Backup & Migrate, and then Backup Now.
- Copy the .htaccess and php.ini files from your existing installation to your new one. Depending on how your site was set up, you may not have these files, but the sites I set up do have them.
cp drupal-7.9/.htaccess drupal-7.12
cp drupal-7.9/php.ini drupal-7.12
cp drupal-7.9/.gitignore drupal-7/12
"cp" means copy.
- Copy the sites directory from your existing installation into your new one:
cp -R drupal-7.9/sites drupal-7.12
assuming 6.8 is your existing installation and 6.9 is the new one. "cp -R" stands for "copy recursively," that is, including the contents of all subdirectories. If you have not put all of your site's files in the sites directory, you may have to repeat this step for files, modules, themes, etc. It is a very good practice to always put all of your site's files in the sites directory for this reason.
- Redirect the symbolic link to point to the new version, like so:
- rm drupal; ln -s drupal-7.12 drupal
assuming drupal is the symbolic link you created in step 5 above and drupal-7.12 is the new directory you want it to point to. The semicolon between the two commands prevents any delay between removing the old link and creating the new one.
- Go to the status report by clicking on Reports in the black administrative toolbar, then Status Report. Chances are this will now tell you to update the database and provide you with a handy link to do that. This is a very important step!
- Test your site to make sure it is running correctly. If you don't see any problems in a day or two, proceed.
- Delete your old installation. Because some of the files are write-protected, this takes two commands:
chmod -R u+w drupal-7.9
rm -R drupal-7.9
"chmod u+w" means "change the modifiers so that the user can write." "-R" in both case means "recursive," that is, including all subdirectories.