Feb 282015
 

とりあえずCentOS 7にインストールしたときのメモ。

インストール、ファイル配置

# tar xzvf moin-1.9.8.tar.gz
# cd moin-1.9.8
# python setup.py install --record=install.log --prefix=/usr/local
# cp -pr /usr/local/share/moin /var/www
# cp -pr /usr/local/lib/python2.7/site-packages/MoinMoin/web/static/htdocs /var/www/moin/static
# mkdir -p /var/www/index
# mkdir -p /var/log/moin
# chown -R apache: /var/www/moin
# chown -R apache: /var/log/moin

Apache設定

# cat /etc/httpd/conf.d/moin.conf
<IfModule wsgi_module>
  WSGIScriptAlias /moin "/var/www/moin/server/moin.wsgi"
</IfModule>

Alias /moin_static "/var/www/moin/static"
<Directory "/var/www/moin/static">
  Require all granted
</Directory>

moin.wsgi設定

# diff -u /usr/local/share/moin/server/moin.wsgi /var/www/moin/server/moin.wsgi
--- /usr/local/share/moin/server/moin.wsgi      2014-10-18 04:45:33.000000000 +0900
+++ /var/www/moin/server/moin.wsgi      2015-02-27 17:39:02.877357919 +0900
@@ -26,11 +26,14 @@
 # a1) Path of the directory where the MoinMoin code package is located.
 #     Needed if you installed with --prefix=PREFIX or you didn't use setup.py.
 #sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')
+sys.path.insert(0, '/usr/local/lib/python2.7/site-packages')

 # a2) Path of the directory where wikiconfig.py / farmconfig.py is located.
 #     See wiki/config/... for some sample config files.
 #sys.path.insert(0, '/path/to/wikiconfigdir')
 #sys.path.insert(0, '/path/to/farmconfigdir')
+sys.path.insert(0, '/var/www/moin')
+sys.path.insert(0, '/var/www/moin/config')

 # b) Configuration of moin's logging
 #    If you have set up MOINLOGGINGCONF environment variable, you don't need this!
@@ -38,6 +41,8 @@
 #    See wiki/config/logging/... for some sample config files.
 #from MoinMoin import log
 #log.load_config('/path/to/logging_configuration_file')
+from MoinMoin import log
+log.load_config('/var/www/moin/config/logging/logfile')

 from MoinMoin.web.serving import make_application

wikiconfig設定

# diff -u /usr/local/share/moin/config/wikiconfig.py /var/www/moin/config/wikiconfig.py
--- /usr/local/share/moin/config/wikiconfig.py  2014-10-18 04:45:33.000000000 +0900
+++ /var/www/moin/config/wikiconfig.py  2015-02-27 17:41:43.537342442 +0900
@@ -45,7 +45,7 @@
     # If that's not true, feel free to just set instance_dir to the real path
     # where data/ and underlay/ is located:
     #instance_dir = '/where/ever/your/instance/is'
-    instance_dir = wikiconfig_dir
+    instance_dir = '/var/www/moin'

     # Where your own wiki pages are (make regular backups of this directory):
     data_dir = os.path.join(instance_dir, 'data', '') # path with trailing /
@@ -60,6 +60,7 @@
     # use this setting and it will automatically work.
     # If you run your wiki script at /mywiki, you need to use this:
     #url_prefix_static = '/mywiki' + url_prefix_static
+    url_prefix_static = '/moin_static'


     # Wiki identity ----------------------------------------------------

logging設定

# diff -u /usr/local/share/moin/config/logging/logfile /var/www/moin/config/logging/logfile
--- /usr/local/share/moin/config/logging/logfile        2014-10-18 04:45:33.000000000 +0900
+++ /var/www/moin/config/logging/logfile        2015-02-27 15:07:46.017232307 +0900
@@ -1,7 +1,7 @@
 [DEFAULT]
 # Logfile to create.
 # Make sure the running moin process has create/write rights there.
-logfile=/tmp/moin.log
+logfile=/var/log/moin/moin.log

 # Default loglevel, to adjust verbosity: DEBUG, INFO, WARNING, ERROR, CRITICAL
 loglevel=INFO

SELinux設定

# WIKIROOT=/var/www/moin
# WIKISTATIC=/var/www/moin/static
# WIKISERVER=/var/www/moin/server
# WIKICONFIG=/var/www/moin/config
# WIKICONFIG_LOG=/var/www/moin/config/logging
# WIKILOG=/var/log/moin
# WIKIINDEX=/var/www/moin/index
# semanage fcontext -a -t httpd_sys_script_exec_t "${WIKISERVER}(/.*)?"
# semanage fcontext -a -t httpd_sys_rw_content_t "${WIKICONFIG}(/.*)?"
# semanage fcontext -a -t httpd_sys_content_t "${WIKICONFIG}/.*\.py"
# semanage fcontext -a -t httpd_sys_content_t "${WIKICONFIG_LOG}(/.*)?"
# semanage fcontext -a -t httpd_sys_rw_content_t "${WIKIROOT}/underlay(/.*)?"
# semanage fcontext -a -t httpd_sys_rw_content_t "${WIKIROOT}/data(/.*)?"
# semanage fcontext -a -t httpd_sys_content_t "${WIKIROOT}/data/plugin(/.*)*/.*\.py"
# semanage fcontext -a -t httpd_sys_rw_content_t "${WIKIINDEX}(/.*)?"
# semanage fcontext -a -t httpd_log_t "${WIKILOG}(/.*)?"

SELinux設定内容確認

# cat /etc/selinux/targeted/contexts/files/file_contexts.local
# This file is auto-generated by libsemanage
# Do not edit directly.

/var/www/moin/server(/.*)?    system_u:object_r:httpd_sys_script_exec_t:s0
/var/www/moin/config(/.*)?    system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/moin/config/.*\.py    system_u:object_r:httpd_sys_content_t:s0
/var/www/moin/config/logging(/.*)?    system_u:object_r:httpd_sys_content_t:s0
/var/www/moin/underlay(/.*)?    system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/moin/data(/.*)?    system_u:object_r:httpd_sys_rw_content_t:s0
/var/www/moin/data/plugin(/.*)*/.*\.py    system_u:object_r:httpd_sys_content_t:s0
/var/www/moin/index(/.*)?    system_u:object_r:httpd_sys_rw_content_t:s0
/var/log/moin(/.*)?    system_u:object_r:httpd_log_t:s0

SELinux設定内容反映

# restorecon -rv /var/www/moin
# restorecon -rv /var/log/moin
 Posted by at 12:48 am

Sorry, the comment form is closed at this time.