Table of Contents
DokuWiki on openSUSE
First, it is quite simple to install DokuWiki on openSUSE (or SLES/SLED). Download the tarball from http://download.dokuwiki.org and unpack it into /srv/www/htdocs
. Then rename the folder you created by unpacking to dokuwiki
and that's nearly all. When you do it on your own PC, you can invoke DokuWiki by entering http://localhost/dokuwiki/install.php
(or replace localhost
by the name of the host you installed it on) as URL in your browser. The invoked install.php
will tell you what is wrong, for example the data dir is not writeable by the web server and so on.
Second, to do all this manually is annoying. So I decided to use openSUSE's build service (see http://en.opensuse.org/Build_Service for details) and put DokuWiki into an rpm package that can be installed on all available openSUSE and SLE versions. When you want to install it from there, you may add http://download.opensuse.org/repositories/home:/werfl/<your openSUSE version>
as installation repository. Unfortunately, it needs apache to run, since this is the only httpd I use myself and where I know how to write the needed config file…
What did I do to create this rpm package?
First, I had to put the DokuWiki files where they belong according to openSUSE's policy (/srv/www/dokuwiki
). Then, I had to add an apache configuration file that defines an alias /dokuwiki
for this place and contains all the lines from the .htaccess
files in the tarball. Downloading, creating the config, and repacking for creation of the rpm is all done by a shell script.
On 2012-11-16 I edited the script so that the config files are now in /etc/DokuWiki
, and the conf
directory inside the DokuWiki source tree is a symbolic link to the new location.
On 2015-07-02 I edited the script again so that the scripts now stay with “/usr/bin/php” instead of my modification “/usr/bin/php5”. Plus the generated Apache config file contains code for Apache 2.2 and 2.4 now.
- prepdw.sh
#!/bin/bash # an attempt to automatize packaging DokuWiki for openSUSE set -x RELEASE='2015-08-10' # hey, that's my birthday :) NO_OF_COMP=5 NEWNAME=$(echo "$RELEASE" | tr '-' '.') WORKDIR="$HOME/openSUSE/home:werfl/dw-temp" WWWDIR="$WORKDIR/DokuWiki/srv/www" NEWCONFDIR='/etc/DokuWiki' OLDCONFDIR="$WWWDIR/DokuWiki/conf" mkdir -p "$WORKDIR/DokuWiki/etc/apache2/conf.d" mkdir -p "$WWWDIR" # assume the standard download location DLFROM='http://download.dokuwiki.org/src/dokuwiki' DLFILE="dokuwiki-stable.tgz" # and get the file wget -O "${WWWDIR}/DokuWiki.tgz" "${DLFROM}/${DLFILE}" # unpack it cd "$WWWDIR" || exit 17 tar -xzf "DokuWiki.tgz" rm "DokuWiki.tgz" # move it into the right place, create config dirs mv "dokuwiki-${RELEASE}" DokuWiki HTACCESSLIST=$(find "${WWWDIR}/DokuWiki" -name '\.htacc*') cd "$WORKDIR/DokuWiki/etc" || exit 18 mv "$OLDCONFDIR" "$WORKDIR/DokuWiki${NEWCONFDIR}" cd "$WWWDIR/DokuWiki" ln -s "../../..${NEWCONFDIR}" "conf" # remove executable flags find "$WWWDIR/DokuWiki" -type f -executable | xargs chmod -x chmod +x $WWWDIR/DokuWiki/bin/*php # write config for Apache 2.2 and 2.4 # delete .htaccess, move it into Apache's conf cd "$WORKDIR/DokuWiki/etc" || exit 15 cat > 'apache2/conf.d/DokuWiki.conf' <<EOT Alias /dokuwiki "/srv/www/DokuWiki" <Directory "/srv/www/DokuWiki/"> Options None AllowOverride All <IfModule mod_dir.c> DirectoryIndex doku.php index.html index.htm </IfModule> <IfModule mod_authz_core.c> # Apache 2.4 Require all granted </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order allow,deny Allow from all </IfModule> </Directory> EOT for SUBDIR in $HTACCESSLIST; do RELDIR=${SUBDIR#${WORKDIR}/DokuWiki} RELDIR=${RELDIR%/.htacc*} echo "<Directory \"$RELDIR\">" >> "apache2/conf.d/DokuWiki.conf" cat "$SUBDIR" >> "apache2/conf.d/DokuWiki.conf" echo "</Directory>" >> "apache2/conf.d/DokuWiki.conf" echo " " >> "apache2/conf.d/DokuWiki.conf" rm "$SUBDIR" done dos2unix -o 'apache2/conf.d/DokuWiki.conf.*' cd "$WORKDIR" || exit 19 tar --strip-components=$NO_OF_COMP -cf "DokuWiki-${NEWNAME}.tar" DokuWiki bzip2 "DokuWiki-${NEWNAME}.tar"
Well, that's about all. With a fast internet connection, the script runs in less that a minute for me . The resulting file is used by the build process as well as the following spec
file:
The 'spec' file
- dokuwiki.spec
# # Spec File for Package DokuWiki # Summary: A Wiki written in PHP to work without a database Summary(de): Ein in PHP geschriebenes Wiki, das keine Datenbank benutzt Name: DokuWiki Version: 2015.08.10 Release: 1%{?dist} License: GPL-2.0 Group: Productivity/Publishing/Other Distribution: openSUSE Linux Vendor: Andreas Gohr <andi@splitbrain.org> URL: http://www.dokuwiki.org/ Requires: apache2-mod_php5 Requires: php5 >= 5.3 PreReq: coreutils PreReq: apache2 BuildArch: noarch Prefix: /srv/www Prefix: /etc Source: %{name}-%{version}.tar.bz2 Buildroot: %{_tmppath}/%{name}-buildroot %description DokuWiki is a standards compliant, simple to use Wiki, mainly aimed at creating documentation of any kind. It is targeted at developer teams, workgroups and small companies. It has a simple but powerful syntax which makes sure the datafiles remain readable outside the Wiki and eases the creation of structured texts. All data is stored in plain text files - no database is required. Read the DokuWiki Manual to unleash the full power of DokuWiki. Author: ------- Andreas Gohr %description -l de DokuWiki ist ein einfach zu benutzendes Wiki, mit dem vor allem Dokumentation jeder Art erstellt werden soll, und dessen Ausgabeformat den Standards entspricht. Zielguppe sind Entwicklerteams, Arbeitsgruppen und kleine Firmen aller Art. DokuWiki hat eine einfache, aber mächtige Syntax und erleichtert das Erstellen strukturierter Texte. Alle Daten werden in reinen Textdateien abgelegt - eine Datenbank ist nicht erforderlich. Lies das Handbuch von DokuWiki, um seine geballte Kraft freizusetzen. Autor: -------- Andreas Gohr %prep %setup -n %{name} %build %install install -d $RPM_BUILD_ROOT/etc/apache2/conf.d/ install -d $RPM_BUILD_ROOT/etc/DokuWiki/ install -d $RPM_BUILD_ROOT/srv/www/DokuWiki/ cp -a etc/* $RPM_BUILD_ROOT/etc/ cp -a srv/www/* $RPM_BUILD_ROOT/srv/www/ %clean [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT %files %defattr(-, wwwrun, www) /srv/www/DokuWiki %config /etc/apache2/conf.d/DokuWiki.conf %config /etc/DokuWiki %attr (644, root, root) /etc/apache2/conf.d/DokuWiki.conf %attr (644, wwwrun, www) /etc/DokuWiki/* %attr (754, wwwrun, www) /srv/www/DokuWiki/bin/dwpage.php %attr (754, wwwrun, www) /srv/www/DokuWiki/bin/indexer.php %attr (754, wwwrun, www) /srv/www/DokuWiki/bin/wantedpages.php %attr (754, wwwrun, www) /srv/www/DokuWiki/inc/phpseclib/update.sh %attr (754, wwwrun, www) /srv/www/DokuWiki/lib/scripts/jquery/update.sh %post
You can use the spec
file and the tarball that is produced by the shell script to build DokuWiki locally. Just save the spec
file as /usr/src/packages/SPECS/DokuWiki.spec
, put the tarball into /usr/src/packages/SOURCES/
and start rpmbuild -ba /usr/src/packages/SPECS/DokuWiki.spec
. The resulting rpm will appear in /usr/src/packages/RPMS/noarch/
(plus a source rpm in /usr/src/packages/SRPMS/
).