Install Tesseract 3.04 on CentOs 7

02 Dec 2016
by cvringer

Tesseract installation is supported beautifully with Ubuntu, but with Centos it requires effort to build. Below is a description of how to install Tesseract on CentOs.

[edit may 2019:] There are other methods now that might fit you better. Please read the comments below. Also: I’ve switched to Ubuntu myself, because Tesseract installs fine with aptitude here. I’m now on version 4

Used versions:
Tesseract: 3.04.01 tesseract-3.04.01.tar.gz
Leptonica: 1.73 leptonica-1.73.tar.gz
Tesseract-ocr 3.02 tesseract-ocr-3.02.deu.tar.gz, tesseract-ocr-3.02.eng.tar.gz, tesseract-ocr-3.02.nld.tar.gz
GhostScript: Install Tesseract 3.04 on CentOs 7

I executed all commands as root, but if you prefer, you can use another account and ‘sudo‘ the commands

1) First update your system:
yum update

Because Tesseract-ocr is not available using yum, we need to download source and build both Tesseract-ocr and leptonica.
This requires development tools to be installed.
yum groupinstall “Development tools”
yum -y install automake autoconf libtool zlib-devel libjpeg-devel giflib libtiff-devel libwebp libwebp-devel libicu-devel openjpeg-devel cairo-devel

2) Now download and install Leptonica:
tar xzvf leptonica-1.73.tar.gz
cd leptonica-1.73
make install

3) Download and install Tesseract:
mv 3.04.01.tar.gz tesseract-3.04.01.tar.gz
tar xzvf tesseract-3.04.01.tar.gz
cd tesseract-3.04.01/
make install

4) Download and install Tesseract trainer files:
tar xzvf tesseract-ocr-3.02.eng.tar.gz
tar xzvf tesseract-ocr-3.02.nld.tar.gz
tar xzvf tesseract-ocr-3.02.deu.tar.gz

export TESSDATA_PREFIX=/usr/share/tesseract-ocr/tessdata

6) Last, install Ghostscript for processing png:
tar xzvf ghostscript-9.20.tar.gz
cd ghostscript-9.20/
make install

That’s it!


  • Brad on August 2, 2017 at 5:39 pm Reply

    Thanks for this.Just wanted to check if Tesseract is installed within leptonica or do I need to cd out after installing leptonica. I appreciate you assistance

  • Jack on December 5, 2017 at 10:05 pm Reply

    An easier way to do it would be to install the epel-repo that contains tesseract: sudo yum install epel-release
    Then do yum install tesseract

    • cvringer on December 6, 2017 at 7:28 am Reply

      @Jack Thanks for this update!

  • Jaba Banik on December 28, 2018 at 5:47 am Reply

    Yes just updating epel-release and then yum install tesseract worked for me !!

  • Hussain on May 28, 2019 at 8:32 am Reply

    Dang! Should’ve read the comments before I started searching for packages and repos. Am now running YUM.

  • Bee on August 11, 2019 at 6:28 pm Reply

    Always read comments first 🙂 yum worked for me too

Leave a Comment:

* - required fields

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© Keienberg Consultants