Quantcast
Channel: sleeplessbeastie's notes
Viewing all articles
Browse latest Browse all 770

How to install and configure private MoinMoin wiki

$
0
0

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

MoinMoin
Private MoinMoin instance

MoinMoin installation

Update package index.

$ sudo apt-get update

Create 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 application directory.

$ sudo mkdir -p /srv/moin-private

Download the MoinMoin source code to the created directory.

$ sudo wget --directory-prefix=/srv/moin-private http://static.moinmo.in/files/moin-1.9.9.tar.gz

Extract downloaded source code.

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

Create 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 setup.py install"

Copy wiki directory.

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

Copy wikiconfig.py configuration file.

$ sudo cp /srv/moin-private/wiki/config/wikiconfig.py /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
[uwsgi]
plugins=python
uid=moinmoin
gid=moinmoin
#socket=/var/run/uwsgi/app/moin-python/socket
chown-socket=www-data
wsgi-file=/srv/moin-private/wiki/server/moin.wsgi
processes=4
vacuum=true
memory-report
virtualenv=/srv/moin-private/python-env/
python-path=/srv/moin-private/wiki
EOF

Enable 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 directory to store ssl certificate.

$ sudo mkdir /etc/nginx/ssl

Generate self-signed SSL certificate for you domain.

$ sudo openssl req -subj "/commonName=private-moinmoin.example.org/" -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;
  }
}
EOF

Enable configured site.

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

Reload nginx configuration.

$ sudo systemctl reload nginx

MoinMoin configuration

Login to the application using web-browser and add 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/wikiconfig.py

Login to the application using web-browser and perform language setup.

Define site name (sitename directive).

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

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/wikiconfig.py

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/wikiconfig.py
    # 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:'

EOF

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

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

EOF
MoinMoin
Disabled newaccount action

Additional information


Viewing all articles
Browse latest Browse all 770

Trending Articles