Differences between revisions 3 and 4
Deletions are marked like this. Additions are marked like this.
Line 133: Line 133:
 * Set context of wiki
 * Bounce apache
 * Set security context of wiki <<BR>>
 Because of Centos is SELinux (Security Enhanced Linux) beside on the standard access control file
 context setting is used. As default the httpd (apache) has no access to files under the directory
 '''/home'''. The symptoms are:

  * In the '''browser''': <<BR>>
  Forbidden <<BR>>
  You don't have permission to access /dev/wiki on this server. <<BR>>
  Apache/2.2.3 (Red Hat) Server at localhost Port 80

  * In '''/var/log/messages''': <<BR>>
  Oct 20 16:10:16 centos1 setroubleshoot: SELinux is preventing the httpd from using potentially mislabeled files (./wiki). For complete SELinux messages. run sealert -l b7f5021e-3dfe-4308-a21a-5731edb11596

 The solve the problem, set context of /home/wiki as '''root''':
{{{
  $ chcon -R -t httpd_sys_content_t /home/wiki
}}}

 * Bounce '''apache'''
Line 143: Line 160:

 * apache configuration directory is /etc/httpd/conf
- extra steps are needed to access home from httpd (apache) because od the
  context security system of SELinux
- Other user/group for Wiki instnce:
    export USER=apache; export GROUP=drawmgt
- Apache configuration directory is NOT /usr/local/etc/apache2
    cd /etc/httpd/conf
    vi httpd.conf
  In last line '/e/vol001' is unnecessary
- Bounce apache: /etc/rc.d/init.d/httpd restart
- Path to wiki: http://localhost/dev/wiki

Setting Up Wiki on Centos 5.3

Prerequisites

  • version of '''MoinMoin''' is 1.8.5

  • installed python version from Centos distribution is: 2.4.3

  • httpd user/group: apache/drawmgt

  • assumed your homy directory is /home/ntibor

Installation

  • Check python is working:

   $ python -V
   Python 2.4.3
  • Unpack and install MoinMoin as normal user

    mkdir -p ~/work/MoinMoin/tmp
    cd ~/work/MoinMoin/tmp
    tar xvzf moin-1.8.5.tar.gz

    cd /home/ntibor/work/MoinMoin/tmp/moin-1.8.5
    python setup.py install --prefix='/usr/local' --record=install.log
  • Test the installation:

    [ntibor@centos1 moin-1.8.5]$ python
    Python 2.4.3 (#1, Jul 27 2009, 17:57:39)
    [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import MoinMoin
    >>>

Creating a wiki instance

Setup a wiki called wiki, located in /home/wiki

  • Configuration variables:

    export PREFIX=/usr/local
    export SHARE=${PREFIX}/share/moin

    export WIKILOCATION=/home/wiki
    export INSTANCE=wiki                
                # full path is ${WIKILOCATION}/${INSTANCE}

    export USER=apache
    export GROUP=drawmgt
  • Setup as root:

    cd /home
    mkdir wiki
    chmod go+w wiki

    cd $WIKILOCATION
    mkdir $INSTANCE                             # directory for this instance
    cp -R $SHARE/data $INSTANCE                 # template data directory
    cp -R $SHARE/underlay $INSTANCE             # underlay data directory
    cp $SHARE/config/wikiconfig.py $INSTANCE    # copy wiki cfg sample file

    chown -R $USER:$GROUP $INSTANCE   
    chmod -R ug+rwX $INSTANCE                   # USER.GROUP may read and write
    chmod -R o-rwx $INSTANCE                    # everybody else is rejected
  • Apache/Moin configuration (based on moin.cgi):

    cd $WIKILOCATION/$INSTANCE
    mkdir cgi-bin
    cp $SHARE/server/moin.cgi cgi-bin
    chown -R $USER:$GROUP cgi-bin
    chmod -R ug+rx cgi-bin
    chmod -R o-rwx cgi-bin

    vi cgi-bin/moin.cgi
    # Add the following lines (after the 'import sys' line)
    sys.path.insert(0,'/home/wiki/wiki')
    sys.path.insert(0, '/usr/local/lib/python2.4/site-packages')
    :x

    cd /etc/httpd/conf

    vi httpd.conf
    # -- Moin Moin V1.8.5 Test Wiki
    
    <Directory /usr/local/share/moin/htdocs>
        Options
        AllowOverride AuthConfig Limit
        Order allow,deny
        Allow from all
    </Directory>
    
    <Directory /home/wiki/wiki/cgi-bin>
        Options None
        AllowOverride AuthConfig Limit
        Order allow,deny
        Allow from all
    </Directory>
    
    Alias /moin_static185 /usr/local/share/moin/htdocs
    ScriptAlias /dev/wiki /home/wiki/wiki/cgi-bin/moin.cgi
    
    :x

- Setup wikiconfig.py

    cd /home/wiki/wiki
    cp wikiconfig.py wikiconfig.py-ORIG
    vi wikiconfig.py

    # Change:
      data_dir = './data/'
      data_underlay_dir = './underlay/'
    # To:
      data_dir = '/home/wiki/wiki/data/'
      data_underlay_dir = '/home/wiki/wiki/underlay/'
    :x
  • Set security context of wiki
    Because of Centos is SELinux (Security Enhanced Linux) beside on the standard access control file context setting is used. As default the httpd (apache) has no access to files under the directory /home. The symptoms are:

    • In the browser:
      Forbidden
      You don't have permission to access /dev/wiki on this server.
      Apache/2.2.3 (Red Hat) Server at localhost Port 80

    • In /var/log/messages:
      Oct 20 16:10:16 centos1 setroubleshoot: SELinux is preventing the httpd from using potentially mislabeled files (./wiki). For complete SELinux messages. run sealert -l b7f5021e-3dfe-4308-a21a-5731edb11596

    The solve the problem, set context of /home/wiki as root:

  $ chcon -R -t httpd_sys_content_t /home/wiki

Centos_5_3_Wiki (last edited 2009-10-20 17:22:12 by 183-56-147)

Copyright 2008, SoftXS GmbH, Switzerland