Inhaltsverzeichnis
DokuWiki on openSUSE
Erstens, ist es sehr einfach das DokuWiki unter openSUSE (or SLES/SLED) zu installieren. Download den https://de.wikipedia.org/wiki/Tar:Tarball von http://download.dokuwiki.org und entpacke dies nach /srv/www/htdocs
. Dann kann der entpackte Ordner umbannant dokuwiki
werden das war schon alle. Wolltest dies auf deinem eigenen PC-System erfolgen, ist das DokuWiki bereits erreichbar unter http://localhost/dokuwiki/install.php
(das localhost
kann auch durch den Namen des Host auf dem die Installation vorgenommen wurde) als URL in den Browser. Mit dem Aufruf der install.php
werden etwaige Fehler angezeigt , zum Beispiel wenn der Ordner data
nicht die erforderlichen Schreib-Rechte auf dem Web-Server haben sollte.
Zweitens, das alles zu Fuß machen zu müssen wäre sehr lästig. Daher beschloss „ich“ den openSUSE's build service zu nutzen (s.a http://de.opensuse.org/Build_Service für mehr Details) und übergab dort hin das DokuWiki als RPM Package, welches Installierbar auf allen verfügbaren openSUSE and SLE Versionen sein sollte. Sollte es von dort installiert werden, muss zuvor das Repository http://download.opensuse.org/repositories/home:/werfl/<your openSUSE version>
hinzugefügt werden. Leider, ist es notwendig,dass das Apache läuft, da dies der einzige httpd ist, den „ich“ selbst nutze und bei dem „Ich“ weiß wie und was an der Konfigurationsdateien bearbeitet wird …
Was hab "ich" getan um das RPM-Package zu erstellen?
Zu erst, mussten sondiert werden wo die DokuWiki Dateien sie laut openSUSE's policy hingehören (/srv/www/dokuwiki
). Dazu musste eine Config-Datei für den Apache entsprechend erstellt werden die ein Alias
definiert für den Ort /dokuwiki
und eine .htaccess
Datei in den 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/
).