How to run MoinMoin from a Mercurial work directory
About this HowTo
- MoinMoin versions
- 1.8.x, 1.7.x 1.9x
- Platforms
- Linux and other POSIX (on Windows, steps are similar, but you'll have to figure them out yourself)
Mercurial is the version control system used by the moin developers. We keep all our files under revision control, in a so-called repository.
If you decide to use revision control, too, you can frequently and easily get the most current code from our repository and run your wikis directly from it without having to "install" the code.
Why (or why not)?
MoinMoin development's release cycles are more frequent than the ones of most popular Linux distributions.
Thus, if you are very lucky, your favourite distribution might have a recent and fully working moin package. If you are happy with your distribution's release cycle: use that package and stop reading.
If you are less lucky, it could be that their package is already very outdated or does offer reduced functionality compared to what we offer. Sometimes you can try to find a more recent package from them, but you might end up in dependency hell, especially if you only wanted a fresher moin, not to upgrade multiple other packages.
Using an outdated moin version can mean:
- additional upgrade work later (for a fresh wiki)
- having additional work every day (e.g. if you use moin 1.5.x that has no textchas against spammers)
Using a distribution package can mean:
- no updates except security for a long time
- having (non-security) bugs that are already fixed by us
- if they do a new distribution release, lots of upgrade work will have to be done at once
- having security issues, if your Linux distributor is slow or not caring
Thus, it sometimes can make sense not to use a moin package from your Linux distribution (please note that we will not pollute filesystem locations used by your system, but keep moin and wiki stuff separate at a single place you choose).
In that case, you have 2 options:
- just grab our most recent release archive (this is a bit simpler, but updating that code later will be harder - and you'll have to wait until we release the next one)
- use code from one of our repositories (a bit more effort first, but you can easily get updates directly from the repo)
The 2nd option is what we describe here (you can just skip the Mercurial / repository stuff if you choose the 1st option).
Users and Permissions
You have to be a bit careful about that.
If you want moin just as personal desktop wiki, the easiest way is to ever work under your user account (not as root) and to run the wiki on a unprivileged port (like 8080, it uses that by default).
If you want to run moin in a typical server setup, it might be appropriate to create a separate user "moin" for it (and a group "moin"). Then you should usually work as that user when installing or doing maintenance (or use chown -R moin.moin and chmod -R ug+rwX moin.moin to make sure the moin process has appropriate access to the files. And of course you start the moin process as moin.moin uid/gid).
Install Mercurial
Install a package called "mercurial" (or "hg" maybe) or download and install it from the Mercurial home page.
You are done with this if you can type in hg on the command line and it gives you its builtin help.
We have some docs about Mercurial usage on MoinDev/MercurialGuide (targetted at new developers, you maybe only need the basics from there).
The official moin repositories
There are some "official" repositories at http://hg.moinmo.in/.
The most interesting repositories for general use are the moin/X.X repos and especially the one that is the current stable version (see the repository description).
As of March 2009, the stable repo is at http://hg.moinmo.in/moin/1.8. If you read X.X below, it currently means 1.8.
Choose a nice place for moin
We won't install moin by using setup.py but just run it from the place where we have our copy of the repository and the related "work directory" with all the moin files.
On Linux (or POSIX) systems, you could put it at one of these places:
- your home directory (for personal use)
- /opt/moin
/srv/moin/code/X.X (we'll use this in this HowTo)
- whereever else you like
Clone our repository
cd /srv/moin/code hg clone http://hg.moinmo.in/moin/X.X X.X
Depending on the speed and latency of your internet connection, this might take a while, just wait until it has finished.
After this, you have the latest moin/X.X code from moin development.
Unpack underlay files
What you have now is almost the same as when you unpack one of our release archives, but:
- you also have the complete development history (maybe not interesting if you are not a developer)
- the system and help pages are still packed in a underlay.tar archive
Thus, you need to unpack the underlay pages:
cd /srv/moin/code/X.X make pagepacks # will create the page packages (zip) for the different languages
Now you have about the same thing as when unpacking a release archive, just more recent stuff.
Making it work
You could run ./wikiserver.py now to start the standalone server and have a working wiki!
For other server setups, you likely have to customize some files.
Caution: Do not change revision controlled files if you like to have easy updates (if you do, it will require merging), but better copy these files to a place somewhere else, e.g.:
- copy wiki configuration files to /srv/moin/cfg/X.X/
- copy moin.wsgi or other server script there, too
- copy data/ and underlay/ directories to /srv/moin/wikis/WIKINAME/
- fix the server script so it finds code (insert /srv/moin/code/X.X into sys.path)
- fix the server script so it finds your wiki configuration (insert /srv/moin/cfg/X.X into sys.path)
- fix the configuration so it finds data and underlay dir
Updating to most recent stuff from the official repo
cd /srv/moin/code/X.X hg pull -u
If you were cautious (see section above), this will just work and give you the latest stuff from the official repo.
If it tells that it has updated wiki/underlay.tar, repeat the steps from above to unpack it and refresh the underlay directories used by your wiki(s).
If it tells that it has updated wiki/server/* or wiki/config/* maybe look what's new there and update your copy accordingly.
Caring about updates and security
As moin won't be automatically updated by your package manager, you'll have to care about it (see previous section).
It is a good idea to do that regularly and keep up-to-date with moin developments (hey, that was the reason you chose to run from repo code!).
Watch our page SecurityFixes and make sure you switch to newer major release before we stop updating the repository you use for pulling.
the moin command
If some docs tell you to run "moin ..." you need to use "python MoinMoin/script/moin.py ...".