Install and configure a private instance of the MoinMoin wiki engine, a full-featured and extensible wiki software written in Python that can store personal notes, knowledge base, or simply share interests.


Private MoinMoin instance

MoinMoin installation

Update package index.

$ sudo apt-get update

Create a system user for the MoinMoin application.

$ sudo useradd -s /usr/sbin/nologin -r moinmoin

Install pip the Python package management system.

$ sudo apt-get install python-pip

Install virtualenv a tool to create isolated Python environments.

$ sudo pip install virtualenv

Create an application directory.

$ sudo mkdir -p /srv/moin-private

Download the MoinMoin source code to the created directory.

$ sudo wget --directory-prefix=/srv/moin-private

Extract the downloaded source code.

$ sudo tar -xvzf /srv/moin-private/moin-1.9.9.tar.gz --directory /srv/moin-private

Create a new virtual environment.

$ sudo virtualenv /srv/moin-private/python-env

Execute the installer using the created virtual environment.

$ sudo bash -c "cd /srv/moin-private/moin-1.9.9/ && /srv/moin-private/python-env/bin/python2 install"

Copy wiki directory.

$ sudo cp -r /srv/moin-private/moin-1.9.9/wiki /srv/moin-private/

Copy configuration file.

$ sudo cp /srv/moin-private/wiki/config/ /srv/moin-private/wiki/

Install uWSGI package and the Python plugin.

$ sudo apt-get install uwsgi uwsgi-plugin-python

Configure Python interpreter for the MoinMoin application using uWSGI.

$ cat <<EOF | sudo tee /etc/uwsgi/apps-available/moin-python.ini

Enable the MoinMoin application.

$ sudo ln -s /etc/uwsgi/apps-available/moin-python.ini /etc/uwsgi/apps-enabled/

Change application permissions.

$ sudo chown -R moinmoin:moinmoin /srv/moin-private

Restart uWSGI.

$ sudo systemctl restart uwsgi

Install nginx server.

$ sudo apt-get install nginx

Disable default Nginx site.

$ sudo unlink /etc/nginx/sites-enabled/default

Create a directory to store the SSL certificate.

$ sudo mkdir /etc/nginx/ssl

Generate a self-signed SSL certificate for your domain.

$ sudo openssl req -subj "/" -x509 -nodes -days 730 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt

Configure virtual host for the MoinMoin application.

$ cat <<EOF | sudo tee /etc/nginx/sites-available/moin
server {
  listen 443 ssl;
  server_name default;

  ssl_certificate_key /etc/nginx/ssl/nginx.key;
  ssl_certificate     /etc/nginx/ssl/nginx.crt;

  location / {
      include uwsgi_params;
      uwsgi_pass unix:///var/run/uwsgi/app/moin-python/socket;
      uwsgi_modifier1 30;

Enable configured site.

$ sudo ln -s /etc/nginx/sites-available/moin /etc/nginx/sites-enabled/

Reload nginx configuration.

$ sudo systemctl reload nginx

MoinMoin configuration

Log in to the application using a web browser and add a new user.

Set created user as a superuser (superuser directive).

$ sudo -u moinmoin sed  -i -e "s/#superuser = \[u\"YourName\", \]/superuser = [u\"milosz\", ]/" /srv/moin-private/wiki/

Log in to the application using a web browser and perform language setup.

Define the site name (sitename directive).

$ sudo -u moinmoin sed -i -e "/sitename = / s/Untitled Wiki/Private Wiki/" /srv/moin-private/wiki/

Uncomment default front page name (page_front_page directive).

$ sudo -u moinmoin sed -i -e "/#page_front_page = u\"FrontPage\"/ s/#//" /srv/moin-private/wiki/

Define default ACLs (acl_rights_before and acl_rights_default directives) to grant every right to the created user and
remove these from other users.

$ cat <<EOF | sudo -u moinmoin tee -a /srv/moin-private/wiki/
    # ACL/superadmin
    acl_rights_before = u"milosz:read,write,delete,revert,admin"
    # ACL/default (logged in users are *known*, everyone else is *all*)
    acl_rights_default = u'Known: All:'


Disable newaccount action (actions_excluded directive) to disable creating accounts for new users.

$ cat <<EOF | sudo -u moinmoin tee -a /srv/moin-private/wiki/
    # stop new accounts being created
    import MoinMoin.config.multiconfig # if not already included in your config file
    actions_excluded = MoinMoin.config.multiconfig.DefaultConfig.actions_excluded + ['newaccount']



Disabled newaccount action

Additional information