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.

Go to the Mediawiki homepage and download the stable package. You can do this by eather download the tar.gz to your PC and then upload it to you server (ftp, winscp, scp, rsync) or copy the link address of the file (right mouse click and copy the link).

If you copied to file the clipboard, you than can change to the installation directory into the root of your vhost directory (in vhost/domainX/., not vhost/domainX/mediawikiXXX/.) and download the file:

cd /var/lib/netzserver/vhost/domainX
wget -c

Then do:

tar xzvf mediawiki-VERSION.tar.gz
mv mediawiki-VERSION mediawi

Do yourself a favor because of future updates and do not use “mediawiki-VERSION” as folder name - versions change. If you know how, you can use symlinks (but this will require a configuration vhosts change).

Create a database, dbuser as usual. You’ll need the mysql root password which you will find per default in /root/.my.cnf. Please don’t use “password” in the next section, but change it to a real one :wink:

mysql -u root -p
# you will be prompted silently !!! for the root pass of mysql server
CREATE DATABASE mediawikidb;
CREATE USER 'mediawikidbuser'@'localhost' IDENTIFIED BY 'myFancyMediawikidbuserPassword';
GRANT ALL PRIVILEGES ON mediawikidb.* TO 'mediawikidbuser'@'localhost' WITH GRANT OPTION;

Configure your LocalSettings.php of MediaWiki.
There are many HowTo’s out there and on the main page of Mediawiki how to install it manually. This is not and cannot be part of this HowTo.

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,


Done :wink: - Sorry for the late reply, I had been very busy.

Cheers, Axel

Hi Michel-André,

that should do it. The warnings you should be able to eliminate with installing the necessary packages.

Concerning the www/non-www domain: I just saw, that I do not have the www-Alias in my virtualhost.conf. I have to dig into this later, because I am very busy in the moment.

Cheers, Axel