Skip to content

Instantly share code, notes, and snippets.

@pnedunuri
Last active November 13, 2023 07:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pnedunuri/2a16fc2af7ed76f1fc095d683f641952 to your computer and use it in GitHub Desktop.
Save pnedunuri/2a16fc2af7ed76f1fc095d683f641952 to your computer and use it in GitHub Desktop.
Steps to install tesseract on linux

sudo yum update

install git

sudo yum install git

install redis

git clone https://gist.github.com/2776679.git
chmod 777 install-redis.sh
./install-redis.sh

libraries required to compile tesseract

sudo yum install gcc-c++ make
sudo yum install openssl-devel
sudo yum install autoconf aclocal automake
sudo yum install libtool
sudo yum install libjpeg-devel libpng-devel libtiff-devel zlib-devel

install nodejs for any future dependencies, for reference: https://github.com/nodejs/node/blob/master/BUILDING.md

cd ~
mkdir libs && cd libs
git clone https://github.com/nodejs/node.git
cd node
./configure
make -j4
sudo make install

set path

sudo nano /etc/sudoers
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

verify nodejs installation

node -v
npm -v

leptonica

cd ~/libs
wget http://www.leptonica.com/source/leptonica-1.74.1.tar.gz
tar -zxvf leptonica-1.74.1.tar.gz
cd leptonica-1.74.1
./configure
make
sudo make install

Tesseract

cd ~/libs
wget https://github.com/tesseract-ocr/tesseract/archive/3.05.00.tar.gz
tar -zxvf 3.05.00.tar.gz
cd tesseract3..
./autogen.sh
./configure
make
sudo make install
sudo ldconfig

Tesseract Training data -- tessdata

cd /usr/local/share/tessdata

tessdata for tesseract version < 4

sudo wget https://github.com/tesseract-ocr/tessdata/archive/3.04.00.zip
sudo unzip 3.04.00.zip
sudo mv tessdata-3.04.00/*.* .
sudo rm -r tessdata-3.04.00

SET TESSDATA_PREFIX PATH

cd ~
sudo nano .bash_profile
export TESSDATA_PREFIX=/usr/local/share/
save and quit
source .bash_profile

credits to https://gist.github.com/shantanusingh/6526664

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment