Quick MoinMoin on CentOS 5 with Python 2.6

The approach is very similar to the HowTo for CentOS -- in fact, I was using those very instructions on CentOS 5.5 when I realized that the instructions diverged nontrivially for my non-native-Python2.6 machine.

As mentioned in the other howto, here you work as root.

A quick guide for setting up a first wiki on CentOS 5.5

About this HowTo

MoinMoin versions
1.9.3
Platforms
CentOS 5.4 - 5.6

This tutorial will show you step by step the manual installation of a single MoinMoin Wiki. It's as simple and quick as possible: in a few minutes, you'll be ready to enjoy and play with it ;-)

We'll use CentOS 5.4 and MoinMoin will use the Apache web server, with the recommended WSGI module, and of course Python 2.6. Let's get started.

Quick Installation

Acquire Python 2.6 (skip if you've already got it)

If your version of python is older than 2.6, as below:

[console]$ python
Python 2.4.3 (#1, Feb 22 2012, 16:06:13) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

it would probably make your life infinitely nicer to have python 2.6 implemented. On CentOS 5s, you'll have to enable the EPEL repository, compile it from Google sources or download the mod_wsgi-3.2.1-el5 rpm from suggested sites like Code Point.

In this case, I decided to enable EPEL:

su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm'

Then, install python 2.6 and its development package:

yum install python26 python26-devel

Install the requirements

The basic requirements for MoinMoin 1.9 on !CentOS 5.4 are:

Install httpd if you haven't already

yum install httpd

Yum also has a mod_wsgi package, but most likely, installing it this way won't utilize python 2.6 by default. Sooo, grab the source (I used mod_wsgi-3.3) and compile it manually to use python26.

tar -xzvf mod_wsgi-3.3.tar.gz
cd mod_wsgi-3.3
./configure --with-python=/usr/bin/python2.6  # or wherever you end up finding your python 2.6 binary
make
make install

Install MoinMoin

Go to the Download section on http://moinmo.in/ and download your Python-2.6-compatible version of MoinMoin (I used moin-1.9.4 here) at this time. Open a Terminal shell, go to the download folder and unpack it with:

tar xvzf moin-1.9.4.tar.gz

You can find a file called docs/README_FIRST inside it for all the detailed information you should need. But for now, let's install it with the default options. Note that I called python26 to run the setup script!

cd moin-1.9.4
python26 setup.py install --force --prefix /usr/local --record=install.log

Configuration files copy

cd /usr/local/share/moin
cp server/moin.wsgi .
cp config/wikiconfig.py  .

Go into moin.wsgi and look for the a1) paragraph; the line below it should be as follows:

sys.path.insert(0, '/usr/local/lib/python2.6/site-packages')

also add at the end of the a2) paragraph the line:

sys.path.insert(0, '/usr/local/share/moin')

Web server configuration

vi /etc/httpd/conf/httpd.conf

and add at the end:

#
#  MoinMoin WSGI configuration
#
# you will invoke your moin wiki at the root url, like http://servername/FrontPage:
WSGIScriptAlias /   /usr/local/share/moin/moin.wsgi

# create some wsgi daemons - *** use user/group same as your data_dir:
WSGIDaemonProcess moin user=webserv group=webserv processes=5 threads=10 maximum-requests=1000 umask=0007

# use the daemons we defined above to process requests!
WSGIProcessGroup moin

# WSGISocketPrefix
WSGISocketPrefix /var/run/moin-wsgi

Save & close.

Also, you'll want to make sure that the mod_wsgi that you just installed is being properly loaded, so:

vi /etc/httpd/conf.d/wsgi.conf

and uncomment out the LoadModule line:

LoadModule wsgi_module modules/mod_wsgi.so

Save & close the file.

Needed security setup

cd /usr/local/share
chown -R webserv:webserv moin
chmod -R ug+rwX moin
chmod -R o-rwx moin

This will fix the file security of the Wiki pages, allowing only the Web server service user (webserv, in this case) to be able to modify them.

Apply changes

/etc/init.d/httpd restart

That's all for a basic Wiki! Now open the browser on http://localhost/ and you'll see the Welcome page.

Now let's make it really usable.

Basic Wiki configuration

Just the essential configuration

vi /usr/local/share/moin/wikiconfig.py

(be careful: this is a Python program and proper indentation is very important when you edit it! /!\ ).

Uncomment the Welcome Front Page as:

    page_front_page = u"FrontPage"

+ last but not least, give the name of the superuser like

    superuser = [u"WikiAdmin", ]

save & close the file.

Apply changes

/etc/init.d/httpd restart

Language setup

Open again the FrontPage on http://localhost (it'll be almost empty now!). Create the WikiAdmin user by choosing:

Login

and then:

(If you do not have an account,) you can create one now.

Be careful to obtain a "User account created! You can use this account to login now..." message after its creation /!\ . And also, remember that usernames in our environment are case sensitive <!> .

Login as WikiAdmin and then go to http://localhost/LanguageSetup?action=language_setup

[ATTACH]

Pick up your language if different from English, then press install on the all_pages link (it's the last line in the list). You'll obtain a "Attachment 'English_all_pages.zip installed." message.

Apply last changes

/etc/init.d/httpd restart

END ;-)

Here is the new FrontPage, ready to be changed and enriched by you and all the users!

Quick tips

You can find some quick configuration tips here. They are not mandatory for the wiki, but I think they are the second thing you'll play with (the first one is the wiki itself, if you've wondering!).

     vi /etc/httpd/conf/httpd.conf

     WSGIScriptAlias /mywiki   /usr/local/share/moin/moin.wsgi

     vi /usr/local/share/moin/wikiconfig.py

     url_prefix_static = '/mywiki' + url_prefix_static

     /etc/init.d/httpd restart

     tz_offset = 1.0 # default time zone offset in hours from UTC

That's all, I hope you've found it useful.


Suggestions

MoinMoin: HowTo/CentOSwithPython26 (last edited 2012-05-04 19:27:56 by ari_)