This site is now 100% read-only, and retired.

Installing and optimising the Drupal CMS on Debian Etch

Posted by dhj on Wed 15 Aug 2007 at 10:08

Drupal is an excellent free software content management system, written in PHP. It's a good choice if you have to build a new site for non-technical users or customers, as both content editing and site administration can be done directly in the main site by authenticated users, and there's very little markup for those users to learn.

I'd investigated and deployed several different content management systems before discovering Drupal. For me, the best thing about switching to this particular CMS was that you can create templates that use only CSS for layout, rather than tables, and the application itself doesn't fill your CSS layouts with tables either. Drupal has a very active community too.

Packages

Drupal runs well on Etch, and pretty much everything you need is already packaged in the Etch repositories. There's a Drupal 4.7 package in Etch, but to get the latest 5.2 release you'll need the version from Debian testing. Alternatively, you can wget the latest tarball from the Drupal.org site, and unpack it as the web root directory you have set up in your Apache 2 configuration. For example, unpack the tarball in /var/www/ and point Apache's virtual host directive at a DocumentRoot of /var/www/drupal-5.2

You should make sure PHP5 is installed and working at this point. You'll also need a database server. MySQL 5 is the most common choice, and so that's what I'll be describing the use of in this article. PostgreSQL 7.3 or later is supported by the Drupal core modules, but not by all of the Drupal community's contributed modules (which can be very useful for extending your site).

Changing MySQL defaults

Some of the packages in Etch don't have appropriate defaults for a Drupal site, particularly if you are running your website on a virtual server, where memory resources are shared with other people's sites.

Firstly, set a root password for MySQL if you haven't done so already:
# mysql -u root
mysql> SET PASSWORD FOR root@localhost=PASSWORD('new_password');
mysql> quit;
Replace new_password in the above with something long and complicated; lots of random letters and numbers. This is not the root password for your system, it's for the primary database administrator, so it should be a different password (even if one person has both these roles).

Now you've set a root password, from now on you'll need to connect to MySQL with:
# mysql -u root -p
and you'll then get a password prompt. There are many more tips for hardening MySQL in this Security Focus article: www.securityfocus.com/infocus/1726

Then, edit /etc/mysql/my.cnf and remove the comment in front of the line:
skip-innodb
By default, the MySQL configuration in Etch will start two database engines, both MyISAM and InnoDB. You only need one engine running for a Drupal site, and making this small tweak can halve MySQL's memory usage as soon as you restart it with:
# /etc/init.d/mysql restart

Installing Drupal

After this, you can create a MySQL database for Drupal to use, following the install instructions on the Drupal site, or the install documents in the Drupal download tarball. Once that's done, open your web browser and enter the URL of the site you've set up in your Apache 2 configuration.

If everything has been configured correctly, you should see a Drupal page which asks you to enter the details of the MySQL database you've just set up. If that database works, you should next see a default Drupal page. You should now create the first user account straight away, with a good strong password, as this first user is the administrator of your new Drupal site.

Drupal performance tweaks

Once you've chosen a theme, set your site information (such as site name, slogan and logo) and posted some initial content, there's a further tweak you should make as soon as possible.

On the Drupal navigation menu, by default in the left sidebar, go to Administer >> Site configuration >> Performance. Caching mode will be set to Disabled by default. You need to set this to Normal, otherwise your server could take a severe performance nosedive as soon as your new site starts getting a decent number of hits. This is because with caching disabled, Drupal will serve a fresh, dynamically generated page to every single anonymous viewer that drops by.

You can also set a minimum cache lifetime and enable CSS aggregation on this page, which should also help if site load increases. If you've made all these tweaks and your site still runs into memory exhaustion problems, particularly if it's running on a virtual server with shared hardware, you can lower Apache's MaxClients setting and MySQL's max_connections setting.

 

 


Re: Installing and optimising the Drupal CMS on Debian Etch
Posted by kaerast (82.47.xx.xx) on Wed 15 Aug 2007 at 11:07
[ View Weblogs ]

After it's been running for a couple of days, you'd then be wise to run MySQL Performance Tuning Primer Script which is a great tool to help you optimise your MySQL server further. Note it needs the bc package to run, which can be installed using "aptitude install bc".

Also, whilst Drupal is designed to only run on Apache it also runs very well on Lighttpd which uses a fraction of the memory of Apache. It takes a little tweaking of config files to get smart urls running because Lighttpd doesn't use .htaccess files, but it's well worth it in the long run.

Drupal 6 is due to reach beta very soon, and whilst it'll take many months for the contrib packages to become compatable with D6 the performance benefits will be worth it. Drupal 6 runs 19.5% faster than Drupal 5.2.

Finally, if your box is just a webserver and doesn't actually need to do fancy stuff with mail then you may want to install nullmailer rather than a big mta such as Postfix, Exim or Sendmail.

[ Parent ]

Drupal packages in Debian
Posted by Anonymous (85.118.xx.xx) on Wed 15 Aug 2007 at 11:56
There doesn't seem to be a Drupal package in Etch. Or have I missed something?

There is a 5.x version in Testing and Unstable and a 4.5 in Old Stable. But I think it missed the mark for Stable.

Annoying as I would prefer to know that apt updates were handling any patching issues.

[ Parent ]

You're right, it didn't make Etch
Posted by dhj (82.71.xx.xx) on Wed 15 Aug 2007 at 12:31
My mistake, the Debian package of Drupal was removed from Etch before the freeze:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=390463

It's no big deal to unpack a fresh tarball and run Drupal's own upgrade script though.

[ Parent ]

Re: You're right, it didn't make Etch
Posted by Anonymous (206.248.xx.xx) on Sun 19 Aug 2007 at 22:22
It is *really* unfortunate that drupal did not make it into the current Debian Stable release :-(

Does anyone know if there is any possibility of a backport appearing? I have searched around and cannot find anything except for moving to Debian Testing. It seems surprising to me that drupal has not yet been backported to Stable...

[ Parent ]

Re: You're right, it didn't make Etch
Posted by Anonymous (83.166.xx.xx) on Mon 20 Aug 2007 at 10:17
I think if there was to be a backported package, it would need to be co-ordinated with the Debian Security Team. There seem to be plenty of actively exploited security problems with PHP, as I can see from my server logs that bots are trawling for non-existent PHP URLs.

[ Parent ]

Re: You're right, it didn't make Etch
Posted by peterhoeg (193.163.xx.xx) on Fri 24 Aug 2007 at 11:41

Details from http://pkg-drupal.alioth.debian.org/drupal-on-etch.html :

Drupal 4.7 and 5 on Etch

The debian drupal management team made available an unofficial stable release of drupal packages vesions 4.7 and 5 for etch. The package is not present in the etch release but we`ve uploaded the packages to backports.org to make your life easier.

Installing drupal 4.7 or 5 on Etch

First you need to change you /etc/apt/sources.list adding the following line:

deb http://www.backports.org/debian/ etch-backports main contrib non-free

Change your /etc/apt/preferences file to deactivate all the other packages from backports.org

Package: *
Pin: release a=etch-backports
Pin-Priority: 200

Now you can activate the drupal package adding the following lines to you /etc/apt/preferences file:

Package: drupal-4.7 # or drupal5 for drupal 5
Pin: release a=etch-backports
Pin-Priority: 999

Then you need to update the source list with apt-get as follow:

#apt-get update

And finally you can install the package with the following command:

#apt-get install drupal-4.7 # or drupal5 for drupal 5

[ Parent ]

Re: You're right, it didn't make Etch
Posted by Anonymous (72.130.xx.xx) on Thu 30 Aug 2007 at 04:18
I found this page too, but what am I missing here:

bilbo:/etc/apt# grep backport sources.list
deb http://www.backports.org/debian/ etch-backports main contrib non-free
bilbo:/etc/apt# cat preferences

Package: *
Pin: release a=etch-backports
Pin-Priority: 200

Package: drupal5
Pin: release a=etch-backports
Pin-Priority: 999

bilbo:/etc/apt# apt-get update

[...no errors...]

bilbo:/etc/apt# apt-cache search drupal
drivel - Blogging client for the GNOME desktop
khmerconverter - converts between legacy Khmer encodings and Unicode
bilbo:/etc/apt# apt-get install drupal
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package drupal
bilbo:/etc/apt# apt-get install drupal5
Reading package lists... Done
Building dependency tree... Done
E: Couldn't find package drupal5
bilbo:/etc/apt#


[ Parent ]

Re: You're right, it didn't make Etch
Posted by Anonymous (193.163.xx.xx) on Thu 30 Aug 2007 at 10:00

You're right. For some reason the drupal packages are not found in the repository. I suggest you check with the mailing list.

[ Parent ]

Re: You're right, it didn't make Etch
Posted by Anonymous (72.130.xx.xx) on Sun 2 Sep 2007 at 03:23
ok, thanks for confirming. I changed the underpinnings to testig and got it from the testing repos instead. Running well enough thus far. :-)

[ Parent ]

Drupal Module Location in Debian
Posted by Anonymous (78.32.xx.xx) on Thu 10 Jun 2010 at 10:56
To help searchers: drupal6 on debian sid, lenny, and squeeze stores drupal modules in /usr/share/drupal6/sites which is /etc/drupal/6/sites.
You need to manually create an /etc/drupal/6/sites/all/modules directory.

[ Parent ]