Installing Dokuwiki the Debian way – by hand
What? You’re joking, right? Well, no actually. Although I love the Debian way, man you just do:
aptitude install dokuwiki
Then you copy a chunk of Apache conf into your site’s configuration and that’s it. The various directories are placed the right place and everything’s pink.
Yes, but, one day you realize that
doesn’t give you any of the latest upgrades to dokuwiki and when you log-in as an admin you see:
New release available: 2008-05-05. upgrade now! 
New release candidate available: 2008-04-11. upgrade now! 
New release candidate available: 2008-03-31. upgrade now! 
An XSS vulnerability was discovered, read the bug report for manual fixing or upgrading 
New release available: 2007-06-26. upgrade now! 
New release candidate available: 2007-05-24. upgrade now! 
This is too much even for a lazy dog like me, so I had to do something, and that something was to install the latest dokuwiki release by hand, as if it was Aptitude (or apt-get) to do it. You can do it too, follow me step by step.
The advantage of following the Debian way by hand is that if the mantainer will feel like upgrading the package and you’ll feel like upgrading again via Debian/Aptitude, nothing will get broken (and though, read the fine print: no warranties given here, I don’t know what the mantainer will do next time. However, that this method is safe is only a tiny bit less sure then taxes and death, read ahead for the why).
Furthermore, you stick to the same file structure/logic that all other packages have in your Debian system.
How is that structure for the Debian Dokuwiki installation?
Debian will give you:
/usr/share/dokuwiki/bin -''- /conf -> /etc/dokuwiki -''- /data -> /var/lib/dokuwiki/data -''- /doku.php -''- /feed.php -''- /.htaccess -''- /inc -''- /index.php -''- /install.php -''- /lib -''- /prepend.php
For this to work of course your Apache configuration will have something like the chunck below for the pages to be served from /usr/share/dokuwiki
Alias /dokuwiki /usr/share/dokuwiki <Directory /usr/share/dokuwiki/> Options +FollowSymLinks AllowOverride All order allow,deny allow from all </Directory>
Note that the above is different from the default Dokuwiki installation (non Debian): a normal dokuwiki foresees dropping all the files in one folder inside your server tree.
Now, we will do the same as Debian/Aptitude but with some extra symlinking to be able to upgrade dokuwiki easily when the new release is available. And besides, the extra step we introduce will secure our installation against dokuwiki being retrograded by an accidental upgrade done via Aptitude.
How do we do it?
We will save the new release inside /usr/local/mypackages (mypackages being your name of choice for your “hand-made” installations) for instance you’ll have all the files inside:
(Aptitude won’t never touch it there, as by the Debian guidelines)
Then we will move the Dokuwiki’s /data directory out of this directory because we want to be able to manage that separately from later upgrades, it is the directory that keeps all our current and future dokuwiki pages – it must grow with you, indipendently from the dokuwiki version.
So we want something like, say,
and instead of having it inside the package dir, we will link to this directory, and in this way we are ready to upgrade without needing to be afraid of overwriting the data directory: in case of an upgrade the link is wiped out and you can just relink the new release files and the original data directory is intact, no need to move, or save files prior the upgrade, the dir stays there out of the way.
The final complete setup of our dokuwiki package is therefore like shown below:
Apache finds dokuwiki inside:
This is a:
/usr/share/dokuwiki -> /usr/local/mypackages/dokuwiki-2008-05-05
That in turn is made up of the directories and symlinks as shown below:
/usr/local/mypackages/dokuwiki-2008-05-05/bin -''- /conf -> /etc/dokuwiki -''- /data -> /var/lib/dokuwiki/data -''- /doku.php -''- /feed.php -''- /.htaccess -''- /inc -''- /index.php -''- /install.php -''- /lib -''- /prepend.php /var/lib/dokuwiki/data is also a simlink: /var/lib/dokuwiki/data -> /usr/local/mypackages/dokuwiki-data
How do we reach this point? Step by step it is like so:
1. Download and save the whole package into your private installations directory:
(do this as you wish)
2. copy the data directory as a separate directory inside your personal installations directory
cp /usr/local/mypackages/dokuwiki-2008-05-05/data /usr/local/mypackages/dokuwiki-data
2.1 If this is an upgrade and not a first installation you have a previous Aptitude Dokuwiki installation, so save your existing data dir (Debian places it inside /var/lib/ and calls it “dokuwiki”
rsync -av /var/lib/dokuwiki/data/ /usr/local/mypackages/dokuwiki-data/
3. [SKIP THIS if upgrading from previous Aptitude Dokuwiki] Create a dokuwiki dir in /var/lib/ . As root do:
3.1 [FOR UPGRADING from previous Debian Dokuwiki installation]
Remove the Debian-made data dir:
rm -rf /var/lib/dokuwiki/data
4. Link your private data dir into the usual location for an Aptitude dokuwiki installation
ln -sT /usr/local/mypackages/dokuwiki-data /var/lib/dokuwiki/data
5. [SKIP THIS if upgrading from previous Aptitude Dokuwiki] Copy the original conf dir where possible future Aptitude installations will find it. As root:
cp /usr/local/mypackages/dokuwiki-2008-05-05/conf /etc/dokuwiki
6. [SKIP THIS if upgrading from previous Aptitude Dokuwiki] Remove the original conf dir
rm -rf /usr/local/mypackages/dokuwiki-2008-05-05/conf
7. Link to the conf dir in the new location
ln -sT /etc/dokuwiki /usr/local/mypackages/dokuwiki-2008-05-05/conf
8. Link to the whole dokuwiki package into where a normal Aptitude intallation would do
ln -sT /usr/local/mypackages/dokuwiki-2008-05-05 /usr/share/dokuwiki
9. [SKIP THIS if upgrading from previous Aptitude Dokuwiki] Then remember to configure apache to serve dokuwiki from the
directory and you’re done.
And click here for a quick step by step tutorial for when the time has come to upgrade your WordPress to the next release.