This is an old revision of the document!
DokuWiki on openSUSE
First, it is quite simple to install DokuWiki on openSUSE (or SLES/SLED). Download the tarball from http://www.splitbrain.org/go/dokuwiki 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 it 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:
- prepdw.sh
#!/bin/bash # an attempt to automatize packaging DokuWiki for openSUSE RELEASE='2010-11-07' NEWNAME=$(echo "$RELEASE" | tr '-' '.') WORKDIR='/home/werner/openSUSE/home:werfl/dw-stable' NO_OF_COMP=5 WWWDIR="$WORKDIR/dokuwiki/srv/www" mkdir -p "$WORKDIR/dokuwiki/etc/apache2/conf.d" mkdir -p "$WWWDIR" # assume the standard download location DLFROM='http://www.splitbrain.org/_media/projects/dokuwiki' DLFILE="dokuwiki-${RELEASE}.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 ln -s ../srv/www/dokuwiki/conf DokuWiki # write config for Apache # delete .htaccess, move it into Apache's conf cat > 'apache2/conf.d/DokuWiki.conf' <<EOT Alias /dokuwiki "/srv/www/dokuwiki" <Directory "/srv/www/dokuwiki/"> Options None <IfModule mod_dir.c> DirectoryIndex doku.php index.html index.htm </IfModule> AllowOverride All Order allow,deny Allow from all </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' # to have it without an unfulfilled dependency, replace php with php5 #+ in the cli scripts for DAT in $WWWDIR/dokuwiki/bin/*.php; do sed -i 's|/usr/bin/php|/usr/bin/php5|' $DAT done cd "$WORKDIR" || exit 19 tar --strip-components=$NO_OF_COMP -cf "dokuwiki-${NEWNAME}.tar" dokuwiki bzip2 "dokuwiki-${NEWNAME}.tar"
Well, that's about all. The resulting file is used by the build process as well as the following spec
file:
- dokuwiki.spec
# # Spec File for Package DokuWiki # Summary: DokuWiki, a Wiki written in PHP to work without a database Summary(de): DokuWiki, ein in PHP geschriebenes Wiki, das keine Datenbank benutzt Name: dokuwiki Version: 2010.11.07 Release: 1%{?dist} License: GPL v2 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.1.2 PreReq: coreutils PreReq: apache2 BuildArch: noarch Prefix: /srv/www Prefix: /etc Source: %{name}-%{version}.tar.bz2 Buildroot: %{_tmppath}/%{name}-buildroot # %packager %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/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 (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 %post [ -L /etc/DokuWiki ] && rm -rf /etc/DokuWiki [ -L /etc/DokuWiki ] || ln -s /srv/www/dokuwiki/conf /etc/DokuWiki %changelog * Thu Nov 11 2010 Werner Flamme <w.flamme@web.de> 2010.11.07 - new upstream version, see http://www.dokuwiki.org/changes * Mon Dec 28 2009 Werner Flamme <w.flamme@web.de> 2009.12.25 - new upstream version, see http://www.dokuwiki.org/changes * Sat May 2 2009 Werner Flamme <w.flamme@web.de> 2009.02.14 - for details, look at http://www.dokuwiki.org/changes * Mon Dec 15 2008 Werner Flamme <w.flamme@web.de> 2008.05.05 - look at http://www.dokuwiki.org/changes
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/
).