Installation Mediawiki

Aus Laub-Home Wiki

Folgende Pakete müssen installiert werden:

aptitude install apache2 php5 mysql-server php5-mysql php5-intl diff

Um Mediawiki zu installieren wird als erstes ein vhost Ordner angelegt und in diesen gewechselt:

mkdir -p /srv/httpd/vhosts/wiki2.laub-home.de
cd mkdir -p /srv/httpd/vhosts/wiki2.laub-home.de

dann kann das aktuelle Paket von www.mediawiki.org heruntergeladen werden:

wget http://download.wikimedia.org/mediawiki/1.17/mediawiki-1.17.0.tar.gz

nun einfach entpacken und das tar.gz löschen:

tar -xzvf mediawiki-1.17.0.tar.gz
rm mediawiki-1.17.0.tar.gz

Nun wird der Ordner mediwiki-1.xx.x in htdocs umbenannt und root die Rechte darauf gegeben:

mv mediawiki-1.17.0 htdocs
chown -R root.root htdocs

Nun legen wir in der Apache HTTPd Konfiguration einen neuen vhost an:
/etc/apache2/sites-available/wiki2.laub-home.de

<VirtualHost *:80>
        ServerAdmin webmaster@laub-home.de
        ServerName wiki2.laub-home.de
        DocumentRoot /srv/httpd/vhosts/wiki2.laub-home.de/htdocs/
        
        php_admin_value safe_mode off

        <Location />
                <LimitExcept POST GET>
                        Deny from All
                </LimitExcept>
        </Location>
        <Directory /srv/httpd/vhosts/wiki2.laub-home.de/htdocs/>
                Options -Indexes FollowSymLinks -Includes -MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        <Directory "/srv/httpd/vhosts/wiki2.laub-home.de/htdocs/images">
                # Ignore .htaccess files
                AllowOverride None

                # Serve HTML as plaintext, don't execute SHTML
                AddType text/plain .html .htm .shtml .php

                # Don't run arbitrary PHP code.
                php_admin_flag engine off

                RewriteEngine On
                RewriteCond %{QUERY_STRING} \.[^\\/:*?\x22<>|%]+(#|\?|$) [nocase]
                RewriteRule . - [forbidden]

                # If you've other scripting languages, disable them too.
        </Directory>
        <FilesMatch "(README|COPYING|CREDITS|FAQ|HISTORY|INSTALL|RELEASE-NOTES|UPGRADE|COPYING|OBSOLETE|TODO)">
                order allow,deny
                deny from all
        </FilesMatch>
        ErrorLog /var/log/apache2/wiki2.laub-home.de-error.log
        CustomLog /var/log/apache2/wiki2.laub-home.de-access.log combined

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        RewriteEngine on
        RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]

        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
        RewriteRule ^/?images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]

        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
        RewriteRule ^/?images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]
</VirtualHost>

und aktivieren diesen:

a2ensite wiki2.laub-home.de
/etc/init.d/apache2 reload

Nun kann die wiki URL aufgerufen werden und dem Install Assistent gefolgt werden. Ich habe noch folgendes nachinstalliert und aktiviert:

aptitude install php-apc php5-curl imagemagick
apache2ctl restart

Anschließend noch ein wenig aufräumen:

cd htdocs
rm README RELEASE-NOTES* CREDITS UPGRADE COPYING INSTALL FAQ HISTORY
chmod 777 images

Meine LocalSettings.php Änderungen

# Short URLs
$wgScriptPath       = "";
$wgScriptExtension  = ".php";
$wgArticlePath = "/wiki/$1";

#$wgGenerateThumbnailOnParse = false;

# End of automatically generated settings.
# Add more configuration options below.
# Aenderungen by ALA
# erlaubte Dateien
$wgFileExtensions = array('txt','gz','tar','zip','pdf','png','jpg','jpeg','ogg','doc','xls','ppt','mp3','sxc','nse','ico');
$wgStrictFileExtensions = false;
$wgVerifyMimeType = false;

# erlaubt das Bild verkleinern und veroessern
$wgUseImageResize = true;

# E-Mail Adressvalidierung
$wgEmailConfirmToEdit = true;

# Prevent new user registrations except by sysops
$wgWhitelistAccount = array ( "user" => 0, "sysop" => 1, "developer" => 1 );

# Disable anonymous talk
$wgDisableAnonTalk = true;

# Anonymous users can't create pages
$wgGroupPermissions['*']['createpage'] = false;

# Disable IP shown on header
$wgShowIPinHeader = false;

# Enable WikiEditor
require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;
$wgDefaultUserOptions['wikieditor-preview'] = 1;

# Enable FCKEditor
require_once("$IP/extensions/FCKeditor/FCKeditor.php");
$wgUseAjax = true;
$wgFCKEditorToolbarSet = "Wiki";

# Enable PdfExport
require_once("$IP/extensions/PdfExport/PdfExport.php");

# Enable SyntaxHighlight_GeSHi
require_once("$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php");

# Enable Lockdown
#require_once( "$IP/extensions/Lockdown/Lockdown.php");
#$wgSpecialPageLockdown['Version'] = array('user', 'bureaucrat', 'sysop');
#$wgSpecialPageLockdown['Export'] = array('user', 'bureaucrat', 'sysop');
#$wgSpecialPageLockdown['Listfiles'] = array('user', 'bureaucrat', 'sysop');
#$wgSpecialPageLockdown['Listusers'] = array('user', 'bureaucrat', 'sysop');
#$wgSpecialPageLockdown['Statistics'] = array('user', 'bureaucrat', 'sysop');
#$wgSpecialPageLockdown['Version'] = array('sysop');
#$wgSpecialPageLockdown['Booksources'] = array('user', 'bureaucrat', 'sysop');
#$wgSpecialPageLockdown['Protectedpages'] = array('user', 'bureaucrat', 'sysop');
#$wgActionLockdown['history'] = array('user', 'bureaucrat', 'sysop');
#$wgActionLockdown['edit'] = array('user', 'bureaucrat', 'sysop');

# Enable SimpleSecurity
#$wgSecurityUseDBHook = true;
$wgSecurityUseDBHook = false;
include_once("$IP/extensions/SimpleSecurity/SimpleSecurity.php");
$wgSecurityRenderInfo = true;
$wgSecurityAllowUnreadableLinks = false;
$wgSecurityExtraGroups = array(
        'warehouse' => 'Warehouse Security Group'
        );

# Enable Vector Extension
require_once( "$IP/extensions/Vector/Vector.php" );
$wgVectorUseSimpleSearch = true;

Quellen