Simple MoinMoin on FreeBSD 10.2
A guide to set up a simple MoinMoin Wiki on FreeBSD 10.2 using Apache and the mod_wsgi module.
About this HowTo
- MoinMoin versions
- 1.9.8
- Platforms
- FreeBSD 10.2-RELEASE
- Preamble
- This guide will show you step by step the manual installation of a
single MoinMoin Wiki under a fresh install of FreeBSD 10.2. It is intentionally simple, and tries to explain the reason why we are executing each step. At the end of this guide, you will have a working
MoinMoin Wiki running on your system.
Installation
There are many ways to setup a MoinMoin server--here we will concentrate on a simple setup for lower traffic server that does not require a bunch of configuration and manual compiling.
We will be using the a module built for Apache HTTP server that allows us to read python code from our server and send it to the enduser. It does this through a standard called WSGI, and thus the module is called mod_wsgi.
Advanced users note: This install is single threaded and embedded, not using daemon mode. If you know what that means you probably know how to do that anyway, if you do not know what that means, check out some of the other guides on this site and the mod_wsgi documentation to see how to setup a multithreaded/daemon installation. It will require some manual compile time options using the Ports system. Beginners are advised to ignore all of this paragraph and just continue to follow along!
Requirements
The software that we need installed are:
- Python 2.7
- Apache HTTP Server 2.4
- Apache Module WSGI 4
- sudo command or superuser account access
MoinMoin 1.9.8
Python
Ensure that Python 2.7.9 is installed (it is by default of FreeBSD 10.2):
pkg info lang/python27
If it is not installed somehow, install from Ports with:
cd /usr/ports/lang/python27 make config-recursive make install clean
Apache HTTP Server
Ensure that Apache HTTP Server 2.4 is installed:
pkg info www/apache24
If it is not installed, install it with:
sudo pkg install apache24
Apache Module WSGI
Ensure that mod_wsgi4 is installed:
pkg info www/mod_wsgi4
If it is not installed, install it with:
sudo pkg install ap24-mod_wsgi4
sudo installation
If you are running FreeBSD through a online service like digitalocean (a VPS), then you may have the sudo command already installed. It is not installed by default in FreeBSD. You can install it with:
su pkg install sudo
MoinMoin Installation
Now we proceed to the installation of MoinMoin. We use the MoinMoin port for that:
cd /usr/ports/www/moinmoin sudo make MOINTYPE=WSGI install sudo make MOINTYPE=WSGI MOINDEST=/usr/local/www/wiki instance
This will create an instance of MoinMoin in /usr/local/www/wiki setup to use WSGI, but we will need to alter a few more details first before it will run properly.
Configuration
Apache HTTP Server
All the configuration of the Apache HTTP Server will be done using the httpd.conf file. Please open it in your favorite text editor.
sudo vim /usr/local/etc/apache24/httpd.conf
Now, navigate to the end of the file, and add the following information that instructs the Apache HTTP Server to:
map the URL /moin_static198/ to the (filesystem) directory where MoinMoin stores its static files
allow access to the directory where MoinMoin stores its static files
- map the URL /mywiki to the file moin.wsgi and designate it a WSGI script
- look in these directories for Python files/packages
allow access to the directory that our MoinMoin Wiki instance lives
WSGIPythonPath /usr/local/lib/python2.7/site-packages:/usr/local/www/wiki Alias /moin_static198/ "/usr/local/lib/python2.7/site-packages/MoinMoin/web/static/htdocs/" <Directory "/usr/local/lib/python2.7/site-packages/MoinMoin/web/static/htdocs/"> Require all granted </Directory> WSGIScriptAlias /mywiki "/usr/local/www/wiki/moin.wsgi" <Directory "/usr/local/www/wiki/"> Require all granted </Directory> <Directory "/usr/local/lib/python2.7/site-packages/MoinMoin/web/static/htdocs/"> Require all granted </Directory>
Execution
Start apache up:
sudo apachectl start
If apache reports it is already running, restart it to update configuration:
sudo apachectl graceful
Fire up your favorite Internet browser to (example here if running a local server):
http://localhost/mywiki
You can see the Welcome page of MoinMoin. You can follow the instructions there for further configuration.
Congratulations! Your first MoinMoin Wiki is waiting for you!