Difference between revisions of "Mwlib"

From SME Server
Jump to navigationJump to search
(logrotate)
Line 100: Line 100:
  
 
EOM
 
EOM
</syntaxhighlight>/etc/logrotate.d/mwlib
+
</syntaxhighlight>
  
 
===Sources===
 
===Sources===

Revision as of 07:08, 12 December 2017

Warning.png Work in Progress:
This page is a Work in Progress. The contents off this page may be in flux, please have a look at this page history the to see list of changes.


this how-to is an help to install mediawiki libraries (mwlib) on SME 9

install

you will need pdftk from dag (this repo does not exist anymore so here a way to get the files)

/sbin/e-smith/db yum_repositories set dag repository  Name 'Dag - EL6'  BaseURL 'http://www.mirrorservice.org/sites/apt.sw.be/redhat/el6/en/$basearch/dag'  EnableGroups no  GPGCheck yes  GPGKey https://www.mirrorservice.org/sites/apt.sw.be/RPM-GPG-KEY.dag.txt  Visible no  Exclude freetype,htop,iptraf,rsync,syslinux  status disabled
signal-event yum-modify
yum install pdftk --enablerepo=dag

add the repo epel

install compilation tools

yum install gcc gcc-c++ cpp make python-devel libjpeg-devel zlib-devel freetype-devel  lcms-devel libxslt-devel libxml2-devel git ocaml

install needed dependencies

yum install python-pip python-gevent python-py python-apipkg  ImageMagick texlive-latex texlive-texvc blahtexml --enablerepo=epel

pip install :

# apipkg provided in the repo is 1.4 and does not work with python 2.6
pip install  apipkg==1.2
# Pillow is required, but the version 4.0 has a syntax error when running with python 2.6
pip install -i http://pypi.pediapress.com/simple/ Pillow==3.4.2 --trusted-host pypi.pediapress.com
# last version fails with python 2.6
pip install -i http://pypi.pediapress.com/simple/ --trusted-host pypi.pediapress.com  pygments==1.6
pip install -i http://pypi.pediapress.com/simple/ mwlib mwlib.rl   pyfribidi --trusted-host pypi.pediapress.com

install texvc

cd ~ 
git clone https://github.com/pediapress/texvc
cd texvc; make; make install PREFIX=~/pp

ultimately, unless you upgrade to python 2.9 you will need a small hack on the PIL library :

vim /usr/lib64/python2.6/site-packages/PIL/Image.py

find

def tostring(self, *args, **kw): 
   raise Exception("tostring() has been removed. " + "Please use tobytes() instead.") 

and replace it with

def tostring(self): return self.tobytes()

startup script

mkdir /var/log/mediawiki/
chown www:www -R /var/log/mediawiki/
cat  >/etc/init.d/mw-serve <<- EOM
#!/bin/sh

PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin

case "\$1" in
        start)
                su - www -s /bin/bash -c 'nserve --port=19737 --qserve=localhost:19252  >> /var/log/mediawiki/mw-serve_log.txt 2>&1 &'
                su - www -s /bin/bash -c 'mw-qserve -p 19252 -i localhost >> /var/log/mediawiki/mw-serve_log.txt 2>&1 &'
                su - www -s /bin/bash -c 'nslave --serve-files-port=20361 --host=localhost --port=19252 --numprocs=1 --cachedir /var/log/mediawiki/ >> /var/log/mediawiki/mw-serve_log.txt 2>&1 &'
                #su - www -s /bin/bash -c 'postman --cachedir /var/log/mediawiki/ >> /var/log/mediawiki/mw-serve_log.txt 2>&1 &'
        ;;
        stop)
                #mv /var/log/mediawiki/mw-serve_log.txt /var/log/mediawiki/mw-serve_log.txt.old
                killall nserve
                killall mw-qserve
                killall nslave
                #killall postman
        ;;
        force-reload|restart)
                \$0 stop
                \$0 start
        ;;
        *)
                echo "Usage: /etc/init.d/mw-serve {start|stop}"
                exit 1
        ;;
esac

exit 0
EOM
chmod +x /etc/init.d/mw-serve
pushd /etc/rc.d/rc7.d/
ln -s  /etc/rc.d/init.d/mw-serve S80mw-serve
popd

logrotate :

cat  > /etc/logrotate.d/mwlib <<- EOM

/var/log/mediawiki/mw-serve_log.txt
{
        compress
        weekly
        rotate 4
        maxsize 5M
        dateext
        dateformat -%Y%m%d%H%M%S
        missingok
        postrotate
                /etc/init.d/mw-serve restart
        endscript



}

EOM

Sources

  1. http://mwlib.readthedocs.io/en/latest/installation.html
  2. https://stackoverflow.com/questions/36592618/reportlab-image-to-pdf-please-call-tobytes
  3. http://edutechwiki.unige.ch/en/Mediawiki_collection_extension_installation


ALternatives

use rpm for centos7 https://gitlab.com/harbottle/epypel

https://harbottle.gitlab.io/epypel/7/x86_64/