Created
May 24, 2024 15:51
-
-
Save tkanhe/228a1213104c6f423cb4a94c7f10613b to your computer and use it in GitHub Desktop.
Install Tesseract on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Ref. https://github.com/Unstructured-IO/base-images/blob/main/dockerfiles/deps/tesseract.sh | |
set -ex | |
dnf install -y opencv opencv* zlib zlib-devel perl-core clang libpng libpng-devel libtiff libtiff-devel libwebp libwebp-devel libjpeg libjpeg-devel libjpeg-turbo-devel git-core libtool pkgconfig xz | |
wget https://github.com/DanBloomberg/leptonica/releases/download/1.83.1/leptonica-1.83.1.tar.gz | |
tar -xzvf leptonica-1.83.1.tar.gz | |
cd leptonica-1.83.1 || exit | |
./configure && make && make install | |
cd .. | |
wget http://mirror.squ.edu.om/gnu/autoconf-archive/autoconf-archive-2017.09.28.tar.xz | |
tar -xvf autoconf-archive-2017.09.28.tar.xz | |
cd autoconf-archive-2017.09.28 || exit | |
./configure && make && make install | |
cp m4/* /usr/share/aclocal | |
cd .. | |
git clone --depth 1 --branch 5.3.3 https://github.com/tesseract-ocr/tesseract.git tesseract-ocr | |
cd tesseract-ocr || exit | |
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig | |
./autogen.sh && ./configure --prefix=/usr/local --disable-shared --enable-static --with-extra-libraries=/usr/local/lib/ --with-extra-includes=/usr/local/lib/ | |
make && make install | |
cd .. | |
git clone https://github.com/tesseract-ocr/tessdata.git | |
cp tessdata/*.traineddata /usr/local/share/tessdata | |
rm -rf /tesseract-ocr /tessdata /autoconf-archive-2017.09.28* /leptonica-1.83.1* | |
dnf -y remove opencv* perl-core clang libpng-devel libtiff-devel libwebp-devel libjpeg-devel libjpeg-turbo-devel git-core libtool zlib-devel pkconfig xz | |
# General cleanup | |
rm -rf /var/cache/yum/* | |
rm -rf /tmp/* | |
dnf clean all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment