How to Install VisualEditor for MediaWiki on CentOS 7

VisualEditor is a rich-text editor for MediaWiki. It’s available as an extension and relies on the Parsoid parser service to be up and running for editing MediaWiki pages.

Coming to Parsoid, it is a parser service based on Nodejs. It’s being used by many MediaWiki extensions, including VisualEditor, Flow, Content Translation, and other applications.

In this tutorial, I will show you how to step-by-step install and configure VisualEditor for latest MediaWiki version 1.30. It’s worth sharing that our MediaWiki is installed under CentOS 7 operating system, and we will add and install Nodejs, Parsoid service, and configure VisualEditor for MediaWiki Editor.


What we will do

  1. Check the MediaWiki Installation
  2. Install dependencies
  3. Install and configure Parsoid service
  4. Install and configure VisualEditor for MediaWiki
  5. Test the setup

In this step, we will check our MediaWiki installation. MediaWiki is installed under the domain name ‘’. Open the web browser and visit the following MediaWiki URL address, mine is:

You will be redirected to the HTTPS connection, following which you will get to the MediaWiki page with ‘Vector’ skin similar to the one shown below.


Next, log in as admin user and try to edit the page. Click on the ‘Edit’ tab and you will get the default MediaWiki editor as below.

Edit page in MediaWiki

The MediaWiki is up and running without any error.

Step 2 – Install dependencies

To install the Parsoid service and configure VisualEditor, we need some CentOS packages to be installed on the system. Specifically, we will install Nodejs, npm, vim, and git.

Install all packages needed using yum command below.

yum -y install nodejs npm vim-enhanced git

All packages and dependencies have been installed.

Step 3 – Install and configure Parsoid

Parsoid can be installed on a separate MediaWiki server. But for this tutorial, and we will be using only 1 CentOS 7 server for both MediaWiki and Parsoid.

Now, since we’re using the CentOS 7 server, we need to install the Parsoid service manually from source because official packages are only available for Ubuntu/Debian based operating systems.

So to start with, create a new ‘/opt/parsoid’ directory and clone the latest parsoid using the git command, as shown below.

mkdir -p /opt/parsoid
git clone /opt/parsoid

Install parsoid

Now go to the ‘/opt/parsoid’ directory and install the Parsoid service using the following npm command.

cd /opt/parsoid
npm install

After the installation is complete, you will get the result as below.

parsoid installation result

Next, configure the Parsoid service by editing the corresponding configuration files.

Copy the example configuration ‘localsettings.example.js’ to ‘localsettings.js’, and then edit the file using vim.

cp localsettings.example.js localsettings.js
vim localsettings.js

Uncomment the ‘parsoidConfig.setMwApi’ line and change the ‘uri’ value with your MediaWiki API URL as below.

exports.setup = function(parsoidConfig) 
        // Do something dynamic with `parsoidConfig` like,
                uri: '',

Uncomment the 'parsoidConfig.setMwApi' line

That’s it. Save and exit.

Now copy the ‘config.example.yaml’ configuration to ‘config.yaml’ and edit it with vim editor.

cp config.example.yaml config.yaml
vim config.yaml

On the ‘mwApis’ line (line number 34), change the ‘uri’ value with your MediaWiki API URL and the ‘domain’ value with your own domain name.

        - # This is the only required parameter,
          # the URL of you MediaWiki API endpoint.
          uri: ''
          # The "domain" is used for communication with Visual Editor
          # and RESTBase.  It defaults to the hostname portion of
          # the `uri` property above, but you can manually set it
          # to an arbitrary string. It must match the "domain" set
          # in $wgVirtualRestConfig.
          domain: ''

Save and exit.

Next, we will configure Parsoid as a service. For this, go to the ‘/etc/systemd/system’ directory and create a new service file dubbed ‘parsoid.service’.

cd /etc/systemd/system/
vim parsoid.service

Paste the Parsoid service configuration below.

Description=Mediawiki Parsoid web service on node.js


ExecStart=/usr/bin/node /opt/parsoid/bin/server.js

Save and exit. Then execute the following reload command.

systemctl daemon-reload

Now, start the Parsoid service, and enable it to execute everytime at system boot.

systemctl start parsoid
systemctl enable parsoid

Parsoid should now be running as a service on CentOS 7, using port 8000. You can check it with the netstat command in the following way.

netstat -plntu

And you should get a result similar to the following:

Result of netstat -plntu command

The parsoid installation and configuration has been completed.


If you have Firewalld running on your server, add the parsoid port 8000 to the firewalld configuration using the following commands.

firewall-cmd –add-port=8000/tcp –permanent
firewall-cmd –reload

Configure the firewall

Step 4 – Install and configure VisualEditor

In this step, we will install and configure VisualEditor extensions for MediaWiki.

Go to the MediaWiki installation directory ‘/var/www/mediawiki/extensions’ and download the latest VisualEditor version using git.

cd /var/www/mediawiki/extensions
git clone

Now go to the VisualEditor directory, and initialize and update all submodules inside it.

cd VisualEditor/
git submodule update –init

Install VisualEditor

Next, we need to edit the Mediawiki configuration file ‘LocalSettings.php’ to enable VisualEditor. For this, head to the mediawiki directory and edit the ‘LocalSettings.php’ file using vim.

cd /var/www/mediawiki
vim LocalSettings.php

Paste configuration below towards the end of the file.

wfLoadExtension( 'VisualEditor' );

// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;

// Optional: Set VisualEditor as the default for anonymous users
// otherwise they will have to switch to VE
// $wgDefaultUserOptions['visualeditor-editor'] = "visualeditor";

// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';

// OPTIONAL: Enable VisualEditor's experimental code features
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

$wgVirtualRestConfig['modules']['parsoid'] = array(
    // URL to the Parsoid instance
    // Use port 8142 if you use the Debian package
    'url' => '',
    // Parsoid "domain", see below (optional)
    'domain' => '',
    // Parsoid "prefix", see below (optional)
    'prefix' => ''

That’s it. Save and exit.


Please change the URL with your own domain name.

Next, change the ownership permissions for the mediawiki directory to the ‘nginx’ user and group.

chown -R nginx:nginx /var/www/mediawiki

VisualEditor extensions installation has been completed.

Step 5 – Testing

Open your web browser and visit the following MediaWiki URL, mine is:

Now, login as admin.

Open MediaWiki

Once logged in, click the ‘Edit’ tab to edit the home page. You should get VisualEditor as shown below.

Open the VisualEditor in MediaWiki

The VisualEditor installation and configuration of MediaWiki on CentOS 7 has been completed successfully.


Pin It

Leave a Reply

Your email address will not be published. Required fields are marked *