[Markdown] 

Postsorter: Installation

Pre-Install

Befor you can install the Postsorter Scripts install the Required Packages

Install Ubuntu 14.04 LTS server edition with the installer in default mode. On Setup choose following Packages:

image

Setup Question Mysql:
Choose your Mysql Password

Setup Mail /Postfix
Choose: Internet-Site
Name: example:dms-test.lcl
SSL-Name dms-test.lcl

Allow Root to Access Remote via SSH Root Zugriff erlauben Ubuntu > 14.04
Disable IPv6 if apt-get update wants to connect via IPv6 and Gateway is not Available
IPv6 deaktivieren in Linux

After Installation the System requires about 1.4 GB of Disk Space

root@DMS-TEST:~# df -h
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
/dev/sda1        19G    1,4G   16G    9% /
none            4,0K       0  4,0K    0% /sys/fs/cgroup
udev            991M    4,0K  991M    1% /dev
tmpfs           201M    1,1M  200M    1% /run
none            5,0M       0  5,0M    0% /run/lock
none           1001M       0 1001M    0% /run/shm
none            100M       0  100M    0% /run/user
OPTIONAL: Install Webmin Recommendation

Install required Packages

ImageMagick
GNU Parallel
poppler-utils
unpaper
tesseract
tesseract-data
lxml  //python
reportlab //python
ghostscript
java

apt-get install imagemagick parallel poppler-utils unpaper tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng  python-lxml python-reportlab ghostscript openjdk-7-jre-headless

After sending the Command some dependencies are solved and installed:

root@DMS-TEST:~# apt-get install imagemagick parallel poppler-utils unpaper tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng  python-lxml python-reportlab ghostscript openjdk-7-jre-headless
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
Die folgenden zusätzlichen Pakete werden installiert:
ca-certificates-java fontconfig fontconfig-config fonts-dejavu-core gsfonts
hicolor-icon-theme imagemagick-common java-common libart-2.0-2 libasyncns0
libcairo2 libcroco3 libcupsfilters1 libcupsimage2 libdatrie1
libdjvulibre-text libdjvulibre21 libfftw3-double3 libflac8 libfontconfig1
libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif4 libgomp1 libgraphite2-3
libgs9 libgs9-common libharfbuzz0b libijs-0.35 libilmbase6 libjasper1
libjbig0 libjbig2dec0 libjpeg-turbo8 libjpeg8 liblcms2-2 liblept4 liblqr-1-0
libltdl7 libmagickcore5 libmagickcore5-extra libmagickwand5 libnetpbm10
libnspr4 libnss3 libnss3-nssdb libogg0 libopenexr6 libpango-1.0-0
libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper1 libpixman-1-0
libpoppler44 libpulse0 librsvg2-2 librsvg2-common libsctp1 libsndfile1
libtesseract3 libthai-data libthai0 libtiff5 libvorbis0a libvorbisenc2
libwebp5 libwebpmux1 libwmf0.2-7 libxcb-render0 libxcb-shm0 libxrender1
libxslt1.1 lksctp-tools netpbm poppler-data python-pil python-renderpm
python-reportlab-accel tesseract-ocr-equ tesseract-ocr-osd tzdata
tzdata-java
Vorgeschlagene Pakete:
ghostscript-x hpijs imagemagick-doc autotrace cups-bsd lpr lprng enscript
ffmpeg gimp gnuplot grads hp2xx html2ps libwmf-bin mplayer povray radiance
sane-utils texlive-base-bin transfig xdg-utils ufraw-batch default-jre
equivs libfftw3-bin libfftw3-dev fonts-droid libjasper-runtime
liblcms2-utils ttf-baekmuk ttf-arphic-gbsn00lp ttf-arphic-bsmi00lp
ttf-arphic-gkai00mp ttf-arphic-bkai00mp pulseaudio librsvg2-bin
libwmf0.2-7-gtk icedtea-7-jre-jamvm libnss-mdns sun-java6-fonts
fonts-dejavu-extra fonts-ipafont-gothic fonts-ipafont-mincho
ttf-wqy-microhei ttf-wqy-zenhei ttf-indic-fonts-core ttf-telugu-fonts
ttf-oriya-fonts ttf-kannada-fonts ttf-bengali-fonts fonts-arphic-ukai
fonts-arphic-uming fonts-unfonts-core python-lxml-dbg python-pil-doc
python-pil-dbg python-renderpm-dbg pdf-viewer python-egenix-mxtexttools
python-reportlab-doc
Die folgenden NEUEN Pakete werden installiert:
ca-certificates-java fontconfig fontconfig-config fonts-dejavu-core
ghostscript gsfonts hicolor-icon-theme imagemagick imagemagick-common
java-common libart-2.0-2 libasyncns0 libcairo2 libcroco3 libcupsfilters1
libcupsimage2 libdatrie1 libdjvulibre-text libdjvulibre21 libfftw3-double3
libflac8 libfontconfig1 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgif4
libgomp1 libgraphite2-3 libgs9 libgs9-common libharfbuzz0b libijs-0.35
libilmbase6 libjasper1 libjbig0 libjbig2dec0 libjpeg-turbo8 libjpeg8
liblcms2-2 liblept4 liblqr-1-0 libltdl7 libmagickcore5 libmagickcore5-extra
libmagickwand5 libnetpbm10 libnspr4 libnss3 libnss3-nssdb libogg0
libopenexr6 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0
libpaper-utils libpaper1 libpixman-1-0 libpoppler44 libpulse0 librsvg2-2
librsvg2-common libsctp1 libsndfile1 libtesseract3 libthai-data libthai0
libtiff5 libvorbis0a libvorbisenc2 libwebp5 libwebpmux1 libwmf0.2-7
libxcb-render0 libxcb-shm0 libxrender1 libxslt1.1 lksctp-tools netpbm
openjdk-7-jre-headless parallel poppler-data poppler-utils python-lxml
python-pil python-renderpm python-reportlab python-reportlab-accel
tesseract-ocr tesseract-ocr-deu tesseract-ocr-eng tesseract-ocr-equ
tesseract-ocr-osd tzdata-java unpaper
Die folgenden Pakete werden aktualisiert (Upgrade):
tzdata
1 aktualisiert, 93 neu installiert, 0 zu entfernen und 94 nicht aktualisiert.
Es müssen 92,8 MB an Archiven heruntergeladen werden.
Nach dieser Operation werden 229 MB Plattenplatz zusätzlich benutzt.

Needed by OCR.Script:

lockfile
convmv
zbarimg
pdftk

apt-get install lockfile-progs convmv zbar-tools pdftk

There are also some dependencies thats been solved

root@DMS-TEST:~# apt-get install lockfile-progs convmv libbarcode-zbar-perl pdftk
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.
Statusinformationen werden eingelesen.... Fertig
lockfile-progs ist schon die neueste Version.
Die folgenden zusätzlichen Pakete werden installiert:
gcj-4.8-jre-lib libasound2 libasound2-data libgcj-common libgcj14 libv4l-0
libv4lconvert0 libzbar0
Vorgeschlagene Pakete:
libasound2-plugins alsa-utils libgcj14-dbg libgcj14-awt
Die folgenden NEUEN Pakete werden installiert:
convmv gcj-4.8-jre-lib libasound2 libasound2-data libbarcode-zbar-perl
libgcj-common libgcj14 libv4l-0 libv4lconvert0 libzbar0 pdftk
0 aktualisiert, 11 neu installiert, 0 zu entfernen und 94 nicht aktualisiert.
Es müssen 21,4 MB an Archiven heruntergeladen werden.
Nach dieser Operation werden 72,8 MB Plattenplatz zusätzlich benutzt.

Add User for DMS

Lets add a User for the DMS

root@DMS-TEST:/etc# adduser dms-test
Lege Benutzer »dms-test« an ...
Lege neue Gruppe »dms-test« (1001) an ...
Lege neuen Benutzer »dms-test« (1001) mit Gruppe »dms-test« an ...
Erstelle Home-Verzeichnis »/home/dms-test« ...
Kopiere Dateien aus »/etc/skel« ...
Geben Sie ein neues UNIX-Passwort ein:
Geben Sie das neue UNIX-Passwort erneut ein:
passwd: password updated successfully
Changing the user information for dms-test
Enter the new value, or press ENTER for the default
    Full Name []: DMS-Test
    Room Number []:
    Work Phone []:
    Home Phone []:
    Other []:
Sind diese Informationen korrekt? [J/n] j
root@DMS-TEST:/etc#

.. and add it to the www-data group

root@DMS-TEST:/etc# adduser dms-test www-data                                   Füge Benutzer »dms-test« der Gruppe »www-data« hinzu ...
Adding user dms-test to group www-data
Fertig.
root@DMS-TEST:/etc#

Now create a MySQL Database

mysql -u root -p<password>

mysql> create database dms;
Query OK, 1 row affected (0.00 sec)

Add a User for DB Access

mysql> CREATE USER 'dms'@'localhost' IDENTIFIED BY 'dmstest';
Query OK, 0 rows affected (0.00 sec)

Grant Privileges to the User for Database dms

mysql> use dms
Database changed
mysql> GRANT ALL PRIVILEGES ON dms.* TO 'dms'@'localhost';
Query OK, 0 rows affected (0.00 sec)

Check if you have access:

mysql> show grants for dms@localhost;
+------------------------------------------------------------------------------------------------------------+
| Grants for dms@localhost                                                                                   |
+------------------ ------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'dms'@'localhost' IDENTIFIED BY PASSWORD '*D26F4EC699CF976CF5F6EB655C796E70B6F76340' |
| GRANT ALL PRIVILEGES ON `dms`.* TO 'dms'@'localhost'                                                       |
+------------------------------------------------------------------------------------------------------------+
2 rows in set (0.00 sec)

Import the Database Structure

dms@DMS-TEST:~$ mysql -u dms -pdmstest dms <postsorter.sql
dms@DMS-TEST:~$

Copy Files and Scripts to the Webserver

You can use WIN-SCP if you use Windows.
Use the User dms-test for this.

Befor you can copy the Files to the Webservers Directory you have to allow the www-data group the Permisson to do so. you have already add the User dms-test to the www-data Group.

root@DMS-TEST: cd /var/www/
root@DMS-TEST:/var/www# chgrp www-data html/
root@DMS-TEST:/var/www# chmod g+w html/
Check if you can reach the Webserver
Maybe you see :
Verbindungsversuch zur Datenbank postsorter fehlgeschlagen
So you have to correct the Database Settings in /dms/config.php

If the DB Settings are ok you should see the Empty Postsorter(DMS) Web-Interface

image

Set the Permissions for the Scripts and Folders

cd /var/www/html/dms/
chmod u+x run_ocr.sh OCRmyPDF.sh
chmod u+x src/ocrPage.sh
If you got an Error on Adding Files to the Mysql Table pdftext Please disable your apparmor profile for the Mysql Service, disable_apparmor.

Let the Magic begin To Test the Postsorter copy a PDF or JPG file to the /var/www/html/dms/scan folder

run the Script from Commandline:

dms-test@DMS-TEST:cd /var/www/html/dms/
dms-test@DMS-TEST:./run_ocr.sh
Can't rename scan/*.PDF scan/*.pdf: Datei oder Verzeichnis nicht gefunden
Ready!
OCRmyPDF fuer Rechnung_Dirt_Devil_Spider.pdf startet..
Kein Barcode gefunden
Kein Schlagworttreffer, Pdf nur mit Datum abgespeichert...
Kein neues jpg
dms-test@DMS-TEST:/var/www/html/dms$

Result:

image

[Home]