Installing Media-Wiki on Nethserver

Hi there,

I just like to give my two cents because I am creating a new nethserver install (NS 7.6). I moved my old mediawiki software from Zentyal (Ubuntu) to nethserver. I am using the standard vhosts directory. What I did and worked:

yum install php-xml php-intl php-gd ImageMagick

ImageMagick is necessary if you like to use thumbnail creation.

Download and untar the Mediawiki installationdirectly into the root of your vhost directory (in vhost/domainX/., not vhost/domainX/mediawikiXXX/.). Create a database, dbuser and configure your LocalSettings.php as usual. There are many HowTo’s out there how to install Mediawiki manually.

I am not using FTP. But you could use it. Because of that we change the user of the directory form ftp:apache to apache:apache. The sticky bit gives a little bit more security (we could only set it for directories, but it does not harm to set it globally).

cd /var/lib/nethserver/vhost
chown -R apache:apache domainX 
chmod -R +s domainX
cd domainX

Harden the directory access by removing rights to others (might break the usage of ftp?!):

find . -type f -exec chmod 2640 {} \;  
find . -type d -exec chmod 2750 {} \; 

For the virtualhost.conf I created a new key for vhosts called DirectoryMediawiki which creates the necessary entries.

vim /etc/e-smith/templates-custom/httpd/vhost-extra/55DirectoryMediawiki

    use esmith::ConfigDB;
    my $vdb = esmith::ConfigDB->open_ro('vhosts') || die("Can't open vhosts db");
    my $DirectoryMediawiki = $vdb->get_prop("$VhostName",'DirectoryMediawiki') || 'disabled';

    $OUT = '';
    $DOCROOT = "{{$DocumentRoot}}";
    $DOCROOT =~ tr/\{//d;
    $DOCROOT =~ tr/\}//d;
    $MYHOST = "{{$ServerName}}";
    $MYHOST =~ tr/\{//d;
    $MYHOST =~ tr/\}//d;

    if ($DirectoryMediawiki eq 'enabled') {
        $OUT .= <<MWINSTALL;
# 55DirectoryMediawiki
<Directory $DOCROOT>
    Options ExecCGI FollowSymLinks
    DirectoryIndex index.php
    AllowOverride All
    Require all granted
    DefaultType application/x-httpd-php
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)\$ /index.php?title=\$1 [L,QSA]
    RewriteCond %{HTTP_HOST} ^www.${MYHOST}\$ [NC]
    RewriteRule ^(.*) http://${MYHOST}\$1 [L,R\=301]
    } else {
         $OUT = '';

Activate it with

 db vhosts setprop domainX DirectoryMediawiki enabled

Check with db vhosts show `domainX. Then reconfigure the files for testing:

 expand-template /etc/httpd/conf.d/virtualhosts.conf
 service httpd restart

For normal activation use:

 signal-event nethserver-httpd-update

My wiki is here:

Cheers Axel


Thanks for your howto. It looks very useful

Thanks :slight_smile:

please could explain better this, I am sure that a lot of people needs it …hourra for this tutorial and thank a lot

Hi Axel,

Very nice how-to.
I appreciate greatly.

- I did a vhhost: mediawiki with virtual host names: mediawiki.FQDN,www.mediawiki.FQDN without links to alias.
- I created a DNS entry with wildcard dns record: mediawiki.FQDN
- I didn’t use 55DirectoryMediawiki.

- I installed MediaWiki-1.31 LTS.

The only warning is:

Warning: The intl PECL extension is not available to handle Unicode normalization, falling back to slow pure-PHP implementation.
If you run a high-traffic site, you should read a little on Unicode normalization.
The environment has been checked. You can install MediaWiki.


Creating oathauth_users table ...done.
...oathauth_users table does not contain secret_reset field.

- After installation I did:

So far, all is working correctly.

Hoping that it is as secure as your.

Please tell me if I did something wrong.
- I am not sure about adding the vhost name: www.mediawiki.FQDN since the DNS wildcard should take care of it ???

Thank you so much for your great works,