Table of Contents
Why DokuWiki?
dokuwiki is a free PHP-based wiki aimed at technical documentation (hence its employment here!). As the ReadyNAS is already running the Apache web-server its sensible to use it to serve up your DokuWiki pages too. Personally I installed DokuWiki on my nslu2 and have got used to using it, its simple, yet feature rich (there are lots of plugins).
This guide relies heavily on the official ReadyNAS Setting up a PHP CGI Environment and Create a personal webserver on the ReadyNAS HowTo's with some additional information on installing and getting dokuwiki.
Install PHP & CGI environment
This is a pre-requisite to installing DokuWiki as DokuWiki is written in PHP and requires CGI. The instructions are provided in the ReadyNAS Developers Centre, and follow naturally from having installed apt-get
, you only need to install one Apache module for php
- Ssh to your ReadyNAS and as
root
installlibapache2-mod-php5
with: <code bash> ReadyNAS:~/# apt-get install libapache2-mod-php5 </code> - Ensure that
/etc/frontview/apache/httpd.conf
Apache configuration file hasindex.php
listed underDirectoryIndex
: <code bash> ReadyNAS:~/# grep 'index.php' /etc/frontview/apache/httpd.conf DirectoryIndex redirect.html index.html index.htm index.php </code> - If this is missing (it wasn't when I did this) use
nano
to edit the file and addindex.php
to the end of the line (nano -w /etc/frontview/apache/httpd.conf
). - Restart the Apache server (I diverge from the official documentation here, instead preferring to use the system
init
script that is designed for starting/stopping/restarting services): <code bash> ReadyNAS:~/# /etc/init.d/apache2 restart </code>
Setup a Web-share
- Go to the Frontview page for your ReadyNAS and navigate to Shares → Share Listing.
- Click on the “Add Shares” tab and create a share called
dokuwiki
with the descriptionDokuwiki site
and leave the “Public Access” tick box ticked. - Click on “Apply” at the bottom of the page.
- Now go back to the “Share List” tab and on any of the icons in the
dokuwiki
row to change the permissions on this directory. - Change the Default Access for HTTP/S to 'Read only', and make sure CIFS/NFS/Rsync are all disabled.
- Now navigate to 'Services → Standard File Protocols' and under the HTTP section select “dokuwiki” from the pulldown menu to 'Redirect default web access to this share' and hit “Apply”.
Install DokuWiki
We're now ready to install DokuWiki itself. It will be installed to the 'dokuwiki' share that we just created but directly rather than through the Share interface.
- Ssh to your ReadyNAS and
su
to root. - Change directory to the Dokuwiki share (
cd /c/dokuwiki
) - Obtain the latest DokuWiki source using
wget
…:<code bash> ReadyNAS:/c/dokuwiki# wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2010-11-07.tgz </code> - Extract the files to the current directory: <code bash> ReadyNAS:/c/dokuwiki# tar xzvf dokwiki-2010-11-07.tgz -C . </code>
- Set the file and folder permissions on everything that has just been extracted to match those of the
/c/dokuwiki/
directory itself.: <code bash> ReadyNAS:~/# cd /c/ ReadyNAS:/c/# chown -R admin:admin dokuwiki </code> - Point your browser at the
install.php
file in the DokuWiki share, this will be something like http://readynas/dokuwiki/install.php or if you've not set a hostname for your ReadyNAS it will include the IP address of the device on your network such as http://192.168.1.101/dokuwiki/install.php. - Follow the instructions and you should have a working DokuWiki install.
Migrating DokuWiki
I already had a fairly well used DokuWiki installed on my NSLU2 that I wanted to migrate over to the ReadyNAS. Thankfully because DokuWiki is essentially based around simple text file pages this was fairly straight-forward. After setting the file and folder permissions above, instead of pointing your browser to install.php
…
- Go to your pre-existing DokuWiki install and compress the
data/
andlib/plugins/
sub-directories (which contains all of the pages you have written and your plugins). Something like:<code bash> host:~/# cd /opt/share/www/dokuwiki host:/opt/share/www/dokuwiki/# tar cjvf dokuwikidataplugin.tar.bz2 data/ lib/plugins/ </code> - Copy this archive over to the ReadyNAS and into
/c/dokuwiki/
directory (NB - this is done asadmin
)…: <code bash> host:/opt/share/www/dokuwiki/# scp dokuwikidataplugin.tar.bz2 admin@readynas:/c/dokuwiki/. </code> - ssh to your ReadyNAS,
cd /c/dokuwiki/
and extract the data files and set the ownership of the data directory: <code bash> ReadyNAS:~/# cd /c/dokuwiki/ ReadyNAS:/c/dokuwiki# tar xjvf dokuwikidataplugin.tar.bz2 ReadyNAS:/c/dokuwiki# cd ../ ReadyNAS:/c/dokuwiki# chown -R admin:admin dokuwiki </code> - Now point your browser at the install.php file in the DokuWiki share, this will be something like http://readynas/dokuwiki/install.php or if you've not set a hostname for your ReadyNAS it will include the IP address of the device on your network such as http://192.168.1.101/dokuwiki/install.php.
- Follow the instructions and you should have a working DokuWiki install.
You should now be able to point your browser at http://readynas/dokuwiki/
or whatever its IP address is on the local network and see your wiki hosted on your ReadyNAS. Thats great if you're only ever going to view/edit your wiki at home, but really you'd like to access it from anywhere in the world wouldn't you?
Configure your Routers Port-forwarding
If you want to be able to access your Wiki from anywhere on the internet you will have to setup your router to forward requests on port 80 (the default port on which http access is provided) to the ReadyNAS.
Background
Your ISP provides your internet connection, and every device connected to the internet has an IP address which uniquely identifies them. These are numeric id's such as 272.146.13.158
and can be a little awkward to remember.
DynamicDNS
Thankfully someone came up with the idea of Domain Name System which allows more easy-to-remember web-address' like www.google.co.uk
to be mapped to the IP address, so you don't have to worry about remembering the numeric IP address, but can instead remember the text description. To save you having to remember your IP address all the time (and it can change over time when your ISP assigns you a new one) you can use DynamicDNS from somewhere like No-IP.org to assign an web-address to your IP address (and update it if you get assigned a new IP address by your ISP). So look up your ISP assigned IP address and go and choose a domain name at No-IP.org.
Configure your Router
I couldn't possibly guess what router you have, but you will want to configure it to forward Port 80 to the IP address your NAS is assigned on your local network. The official ReadyNAS FAQ on port-forwarding points you to an article on Router Port Forwarding and I'm going to do the same.
Once you've registered a domain name and setup port-forwarding you should now be able to access your Dokuwiki hosted on your ReadyNAS by simply pointing a browser at the domain name you registered.
Upgrading
Once installed and running you will, when logged into Dokuwiki as an administrator, notice occasionally that there are notifications telling you that updates are available. Its wise to install these as they often fix bugs and security issues. Thankfully its pretty easy to do. Official instructions are here, but I've written my own walk through (heavily based on these).
- SSH to your ReadyNAS,
su
to root andcd /c/dokuwiki
. - Backup your data…
cp -a /c/dokuwiki /tmp/.
- Grab the source for the latest upgrade (modify this to reflect whatever the latest version available is)…
cd tmp wget http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-rc2011-11-10.tgz
- Extract the contents and copy them over the install…
tar xzvf dokuwiki-rc2011-11-10.tgz 'cp' dokuwiki-rc2011-11-10/{*,.??*} /c/dokuwiki/.
- Remove
install.php
and change the permissions on thedata/
directory…
cd /c/dokuwiki rm install.php cd /c/dokuwiki/data chown -R admin:admin
- Remove old files that are no longer needed (see list here)…
Thats pretty much it, there are a few additional things to check detailed in the official upgrade instructions that you should check though.
Recommendations
I'd recommend that you use namespaces from the outset on your DokuWiki as it helps keep things tidier.
Links
readynas php dokuwiki howto