How to Install MoinMoin 2 on AlmaLinux 9 or Rocky Linux 9 with Nginx
MoinMoin 1.9 needs Python 2, which the RHEL 9 family lacks. This guide installs the MoinMoin 2 pre-release with Python 3.12, Gunicorn and Nginx.
MoinMoin is a wiki engine written in Python that stores its pages on the file system, with no database server to run. This guide installs MoinMoin 2 on AlmaLinux 9 or Rocky Linux 9 (the commands also apply to CentOS Stream 9) in a Python virtual environment, runs it with Gunicorn as a systemd service and puts Nginx in front of it.
Two facts shape the setup. CentOS 7 reached end of life in June 2024, and the RHEL 9 family that replaces it has no Python 2. MoinMoin 1.9, the long-time stable series, requires Python 2.7 and therefore cannot be installed on a current system. Its successor, MoinMoin 2, runs on Python 3.10 or newer, but it is still published as a pre-release: the newest version is 2.0.0b5 from 24 March 2026, and the project describes the 2.0 code as unstable. Use it knowing that, keep backups, and expect to apply updates yourself.
Requirements
- An AlmaLinux 9 or Rocky Linux 9 server and a user with
sudorights. - A DNS record such as
wiki.example.compointing to the server. - Python 3.10 or newer. The system Python on these distributions is 3.9, so the steps install the separate
python3.12package.
Step 1: Install Python 3.12 and Nginx
sudo dnf install python3.12 nginx nano
Create a system account that owns the wiki and has no login shell:
sudo useradd --system --create-home --home-dir /opt/moin --shell /sbin/nologin moin
Step 2: Install MoinMoin in a virtual environment
The MoinMoin documentation recommends a virtual environment and pip install --pre moin for as long as version 2 is in its pre-release phase. Install Gunicorn, the WSGI server that will run the wiki, next to it:
sudo -u moin python3.12 -m venv /opt/moin/venv
sudo -u moin /opt/moin/venv/bin/pip install --pre moin gunicorn
Check that the command-line tool works:
sudo -u moin /opt/moin/venv/bin/moin --help
Step 3: Create and configure the wiki instance
Each wiki has an instance directory that holds its configuration, data and search index. Open a shell as the moin user, activate the environment and create the instance:
sudo -u moin bash
source /opt/moin/venv/bin/activate
moin create-instance --path /opt/moin/wiki
cd /opt/moin/wiki
Generate a random value for the session secret and copy it:
python -c "import secrets; print(secrets.token_hex(32))"
Edit the configuration file that create-instance placed in the directory:
nano /opt/moin/wiki/wikiconfig.py
Change these existing settings:
interwikiname = "ExampleWiki"
sitename = "Example Wiki"
registration_only_by_superuser = True
acl_functions = "WikiAdmin:superuser"
SECRET_KEY = "paste-the-generated-value-here"
SESSION_COOKIE_SECURE = True
interwikinamemust be a unique, stable name; do not change it once the wiki has content.acl_functionsnames the account that may administer users.WikiAdminis the user you create in a moment.registration_only_by_superuser = Truedisables self-registration, which the configuration file recommends for public wikis.- Set
SESSION_COOKIE_SECURE = Trueonly if you complete the HTTPS step; with plain HTTP the login cookie would not be sent.
The default access rules give anonymous visitors read access only. The comments in wikiconfig.py explain the acls section if you want a different policy.
Still inside /opt/moin/wiki, initialise the storage and index, load the start page and the English help, and create the administrator:
moin index-create
moin welcome
moin load-help -n help-en
moin load-help -n help-common
moin account-create --name WikiAdmin --email admin@example.com --password 'choose-a-strong-password'
The password is visible in the shell history of this session; change it in the wiki's user settings after the first login.
Step 4: Run the wiki with Gunicorn
MoinMoin is a Flask application. Its documentation states that a web server obtains the WSGI application by calling create_app() with the path to the configuration file. Put those two lines in a small module, still as the moin user:
cat > /opt/moin/wiki/wsgi.py <<'EOF'
from moin.app import create_app
application = create_app("/opt/moin/wiki/wikiconfig.py")
EOF
exit
Back in your own account, create the service unit:
sudo nano /etc/systemd/system/moin.service
[Unit]
Description=MoinMoin wiki (Gunicorn)
After=network.target
[Service]
User=moin
Group=moin
WorkingDirectory=/opt/moin/wiki
ExecStart=/opt/moin/venv/bin/gunicorn --workers 2 --bind 127.0.0.1:8000 wsgi:application
Restart=on-failure
[Install]
WantedBy=multi-user.target
Apply the default SELinux labels to the new tree so that systemd may execute the programs in the virtual environment, then start the service:
sudo restorecon -R /opt/moin
sudo systemctl daemon-reload
sudo systemctl enable --now moin
curl -I http://127.0.0.1:8000/
The curl command should return an HTTP status line from Gunicorn. If it does not, read sudo journalctl -u moin -n 40 --no-pager.
Step 5: Configure Nginx as a reverse proxy
sudo nano /etc/nginx/conf.d/moin.conf
server {
listen 80;
listen [::]:80;
server_name wiki.example.com;
client_max_body_size 20m;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
SELinux blocks Nginx from opening outgoing connections by default. Allow it, test the configuration, start Nginx and open the firewall:
sudo setsebool -P httpd_can_network_connect 1
sudo nginx -t
sudo systemctl enable --now nginx
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --reload
Step 6: Add HTTPS
Certbot is available from the EPEL repository:
sudo dnf install epel-release
sudo dnf install certbot python3-certbot-nginx
sudo certbot --nginx -d wiki.example.com
Certbot adds the TLS server block and a redirect from HTTP.
Verify the wiki
- Open
https://wiki.example.com/. TheHomepage loaded bymoin welcomeappears. - Log in as
WikiAdminand create a test page. - Restart the service with
sudo systemctl restart moinand confirm the page is still there.
Maintenance
- Updates: there is no distribution package, so you install new releases yourself. Back up first, then run
sudo -u moin /opt/moin/venv/bin/pip install --pre --upgrade moinand restart the service. Read the release notes on the project's GitHub releases page before upgrading between pre-releases. - Backups: everything that belongs to the wiki is in
/opt/moin/wiki:wikiconfig.py, the page data and the index. Stop the service, archive the directory, start the service. - Command-line administration: every
moincommand must run as themoinuser from inside/opt/moin/wiki, as in Step 3.moin --helplists the available commands.
The administrator documentation is at moin-20.readthedocs.io.
Frequently asked questions
Can I still install MoinMoin 1.9?
Only on a system with Python 2.7, which the RHEL 9 family, current Debian and current Ubuntu no longer provide. Python 2 itself has had no security fixes since 2020, so a new public wiki should not be built on it.
How do I move an existing 1.9 wiki to MoinMoin 2?
MoinMoin 2 includes an importer. After moin create-instance, run moin import19 -d /path/to/1.9/wiki/data instead of moin index-create. Work on a copy of the old data directory and check the converted pages before you switch users over.
Is MoinMoin 2 ready for production?
The project still labels it a beta. It is under active development and usable, but storage details and features can change between pre-releases. If you need a wiki with long-term stable releases today, consider that before committing important content, or plan regular backups and test upgrades on a copy.
Why Gunicorn rather than the built-in server?
moin run starts the Werkzeug development server, which the MoinMoin documentation recommends only for desktop, testing and small ad hoc wikis. For anything public it tells you to use a real WSGI-capable server; Gunicorn behind Nginx is one of the options Flask's deployment documentation covers.