平台环境:
#Python 2.7.5
#python扩展:python-gearman / gci / Django 1.6.8注意版本号 / MySQL-python / django-enumfield / django-mongodb-engine / djangotoolbox / djangotoolbox / django-standalone / gci-python / #gcilog-python / gearman / pycrypto / pymongo / PIL / pytesseract / python-arrow.noarch / pytz / pytesseract
#安装mariadb 10.0.14
#安装gearman
#安装leptonica
#安装tesseract-ocr
配置文档:
#python02-new安装
#安装扩展源epel
cd /root
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -ivh epel-release-7-5.noarch.rpm
yum -y update
#安装mariadb 10.0.14
#yum -y install mariadb-10.0.14,yum search没有找到安装包
cd /root/
wget http://archive.mariadb.org//mariadb-10.0.14/bintar-linux-x86_64/mariadb-10.0.14-linux-x86_64.tar.gz
#直接下载源码包,无需编译,直接复制即可。
tar zxvf mariadb-10.0.14-linux-x86_64.tar.gz
mv mariadb-10.0.14-linux-x86_64 /usr/local/mysql
groupadd mysql
useradd -s /sbin/nologin -g mysql mysql
#cat /etc/passwd |grep mysql
chown -R root.root /usr/local/mysql
cd /usr/local/mysql
cp support-files/my-medium.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 !$
vim /etc/my.cnf
[client]
socket = /data/mysql/mysql.sock
[mysqld]
datadir = /data/mysql
socket = /data/mysql/mysql.sock
pid-file=/data/mysql/mysql.pid
log-error=/data/mysql/mysql.err
user=mysql
[mysqldump]
socket = /data/mysql/mysql.sock
[mysql]
socket = /data/mysql/mysql.sock
cd /usr/local/mysql
scripts/mysql_install_db --user=mysql --datadir=/data/mysql --basedir=/usr/local/mysql
export PATH=/usr/local/mysql/bin:$PATH
source /etc/profile
vim /lib/systemd/system/mysqld.service
[Unit]
Description=mysql
After=network.target
[Service]
Type=forking
ExecStart=/etc/init.d/mysqld start
ExecReload=/etc/init.d/mysqld restart
ExecStop=/etc/init.d/mysqld stop
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable mysqld.service
systemctl start mysqld.service
mysqladmin -uroot password xxxx创建root用户
mysql -uroot -pmariadb_admin_release
create database gearman;
grant all privileges on gearman.* to gearman@localhost identified by 'xxxx';创建gearman库,创建gearman用户,并授权。使gearman程序可以调用mysql队列。
#安装gearman
yum -y install libgearman-1.1.12
yum -y install gearmand-1.1.12
echo "### Settings for gearmand" >/etc/sysconfig/gearmand
echo 'OPTIONS=" --log-file /var/log/gearmand/gearmand.log -q mysql --mysql-user gearman --mysql-password xxxx --mysql-db gearman"' >> /etc/sysconfig/gearmand echo写入的内容有""时,需要用''代替echo格式的双引号。
vim /lib/systemd/system/gearmand.service
[Unit]
Description=Gearmand distributed job system
After=syslog.target network.target
[Service]
EnvironmentFile=/etc/sysconfig/gearmand
User=gearmand
Type=forking
ExecStart=/usr/sbin/gearmand -d $OPTIONS
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable gearmand.service
systemctl start gearmand.service
#安装leptonica
yum -y install gcc gcc-c++ make
yum -y install autoconf automake libtool
yum -y install libjpeg-devel libpng-devel libtiff-devel zlib-devel 需要先安装这些依赖包
wget http://www.leptonica.org/source/leptonica-1.72.tar.gz
tar zxvf leptonica-1.72.tar.gz
cd leptonica-1.72
./configure
make
make install
#安装tesseract-ocr
wget https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.02.tar.gz
tar zxvf tesseract-ocr-3.02.02.tar.gz
cd tesseract-ocr/
./autogen.sh
./configure
make
make install
ldconfig
cd /root/
wget https://tesseract-ocr.googlecode.com/files/tesseract-ocr-3.02.eng.tar.gz
下载相应版本英语语言包
tar zxvf tesseract-ocr-3.02.eng.tar.gz
mv /root/tesseract-ocr/tessdata /usr/local/share/tessdata
cd tesseract-ocr/
tesseract phototest.tif phptotest -l eng
ll phpto*
上一条命令运行成功,则会在当前目录下生成phptotest.txt文件。测试成功。