Setting up WordPress Multisite on Debian 5.0 (lenny)

This post explains how to install WordPress 3.x on a Debian lenny and to set up a multisite installation on your Debian server.

All the blogs will log into the same file /var/log/apache2/access.log; the first column will be the blog host and port (see the LogFormat configured below).

This chapter is based on information collected at and in /usr/share/doc/wordpress/README.Debian.

All WordPress blogs will use the same shared PHP code in /usr/share/wordpress.


  • Main website will be
  • Blogs will be under http://${blogname}

File uploaded into the main blog ( will be stored in /srv/www/wp-uploads/

Files uploaded into the * blogs will be stored in /usr/share/wordpress/wp-content/blogs.dir/${blog_id}/files/%year/%month/, where ${blog_id} is the numeric id of the blog, as managed by the Multisite feature.

Configuration of Debian lenny-backports repository and installation

WordPress 3.x is not in lenny so we have to use the backport repository.
Excute this as root:

echo "deb lenny-backports main" >> /etc/apt/sources.list

cat < /etc/apt/preferences
Package: *
Pin: release a=lenny-backports
Pin-Priority: 200

apt-get update
apt-get -t lenny-backports install wordpress

Installation of non free swf plugin

As stated in /usr/share/doc/wordpress/README.Debian WordPress originally comes with a Flash-based tool that allows to upload files. However, that tool violates the Debian Policy, as stated in the
bug #591195. That is why this tool is not shipped with the Debian package anymore. If you want to enable this feature, you need to install the Flash file yourself with the following command:

wget -O /usr/share/wordpress/wp-includes/js/swfupload/swfupload.swf

Configure your DNS server

Add the following records in your zone (I suppose you know how to deal with your DNS zone):

; wp multisite
$ORIGIN        IN A       ${IP}
www            IN A       ${IP}
*  IN CNAME   www

Apache configuration

Configure the vhost_combined log format in /etc/apache2/apache2.conf modifying the default one:

LogFormat "%{Host}i:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

Configure apache in /etc/apache2/sites-available/wordpress-multisite :

UseCanonicalName    Off

ServerAlias *
DocumentRoot /srv/www/

Options All

# Store uploads of in /srv/www/wp-uploads/$0
RewriteEngine On
RewriteRule ^/wp-uploads/(.*)$ /srv/www/wp-uploads/%{HTTP_HOST}/$1

        Options FollowSymLinks
        AllowOverride All

CustomLog /var/log/apache2/access.log vhost_combined

# this is needed when activating multisite, WP needs to to a 
# fopen("") to verify
# that apache is correctly configured
php_admin_flag allow_url_fopen on

Configure /etc/wordpress/htaccess:

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
## uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
## real files dealt directly
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
## other go through index.php
RewriteRule . index.php [L]

Enable the config executing this as root:

a2ensite wordpress-multisite
a2enmod rewrite && a2enmod vhost_alias
/etc/init.d/apache2 restart

Setting some permissions

# required to allow the main site to upload content
chown www-data /srv/
chown www-data /srv/www/

# required to allow subdomains site to upload content
chgrp www-data /usr/share/wordpress/wp-content/blogs.dir/
chmod g+w /usr/share/wordpress/wp-content/blogs.dir/

# required in order to be able to install/update themes/plugins 
# from the webgui (only on the main site)
chown -R www-data:www-data /usr/share/wordpress/wp-content/
chown -R www-data:www-data /usr/share/wordpress/wp-admin/ 

Creating main site

At this stage we can create the main site using this bash script:

bash /usr/share/doc/wordpress/examples/setup-mysql -n main

This script creates the DB & tables and it also creates a file called /etc/wordpress/

You should end up with the following files:

  • /etc/wordpress/
  • /srv/www/ symlink to -> /usr/share/wordpress
  • /srv/www/wp-uploads/

Activating Network (aka multisite)

At this stage you should log into and follow the on screen instructions.
Once you are in the backend you can than click into the “Tools -> Network” link and enable the mulsite, this will create some tables in your db and it will ask you to copy&paste some lines into /etc/wordpress/

define( 'SUBDOMAIN_INSTALL', true );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', '' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

define( 'AUTH_KEY', 'blabla' );
define( 'SECURE_AUTH_KEY', 'blabla' );
define( 'LOGGED_IN_KEY', 'blabla' );
define( 'NONCE_KEY', 'blabla' );
define( 'AUTH_SALT', 'blabla' );
define( 'SECURE_AUTH_SALT', 'blabla' );
define( 'LOGGED_IN_SALT', 'blabla' );
define( 'NONCE_SALT', 'blabla' );

define( 'MULTISITE', true );

# for debugging purposes only
# define('WP_DEBUG', true);

After that you’re ready to go 😀

Logging as super admin and going into the SuperAdmin webgui area you can create new subdomains (blogs), and users, when you can create blogs an email is sent to the owner, you can personalize templates, decide how much storage space you want to assign to every single blog, etc, etc.

At this point you should be able to also install/upgrade plugins and themes straight from the web gui.
Note that define('WP_CORE_UPDATE', false); in your config file will disable the auto update, your wordpress update cycle will be managed using Debian apt tool.

That’s it folks, any question please comment 🙂

12 thoughts on “Setting up WordPress Multisite on Debian 5.0 (lenny)”

  1. These are truly great ideas in oon the topic of blogging.
    You hafe touched some fastidious things here. Any way keep up wrinting.

  2. Hi there very nice site!! Man .. Beautiful .. Wonderful ..
    I’ll bookmark your site and take the feeds also? I am satisfied to find a lot of helpful
    information here within the put up, we’d like develop extra strategies on this regard, thanks for sharing.
    . . . . .

  3. Using the proper toothbrush is critical to good brushing.
    – Beware of the words caution, warning, and danger.
    This will help give the area a good soak for easier cleanup and also sop up any water that pools there as you clean.

  4. I must express some thanks to this writer just for bailing me out of such
    a issue. Right after browsing throughout the search
    engines and obtaining ideas which are not helpful,
    I figured my life was over. Living minus the strategies to the problems you’ve fixed through your site
    is a critical case, as well as the kind that
    might have adversely affected my entire career if I hadn’t discovered your blog.

    Your own personal know-how and kindness in controlling a lot of
    stuff was very useful. I’m not sure what I would have done if I had not discovered
    such a stuff like this. I can also at this time look
    forward to my future. Thanks so much for the professional and sensible guide.
    I won’t think twice to suggest your web site to anybody
    who wants and needs care about this topic.

    My webpage: bruce lee workouts (

  5. Hi Pallotron,

    EXCELLENT walk-through!!! I managed to set up and my multisite WordPress installation in 10 minutes. One small comment: the setup-mysql script must be run BEFORE the permission are gonna be set, because the script will write the /srv/www directory.

    Anyway, very good job and thanks a lot again!


  6. @pallotron
    No, I’m not a perfectionist at all, it was just a noob curiosity. 😀
    As usual I’m just a little bit off topic (just a little…:P) and reading about this tutorial I well out to ask you about this.
    Googling I read about apt-get vs aptitude but having a sys admin that said “any question pleas comment” I profited to ask.

    The matter it is more clear now, thank you for your explanation.

  7. How perfectionist are you 😛
    No i do prefer aptitude, in fact most of the time I use aptitude in place of apt-get.
    They say it deals better with dependencies, and, in fact, it does.
    But for this instruction there should be no difference between apt-get install wordpress and aptitude install wordpress.
    apt-get just installed all the dependencies I needed.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.