第一步:安装GCC
yum install devtoolset-2-gcc devtoolset-2-binutils devtoolset-2-gcc-c++ -y
mv /usr/bin/gcc /usr/bin/gcc.backup
ln -s /opt/rh/devtoolset-2/root/usr/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++.backup
ln -s /opt/rh/devtoolset-2/root/usr/bin/g++ /usr/bin/g++

第二步:安装JDK
#!/bin/bash
#first, install jdk1.6 in CentOS6.5
mkdir /usr/java
#1, jdk-6u45-linux-x64.bin 这个是自解压的文件,在linux上安装如下:
cd /opt/tomcat_jdk
chmod 755 jdk-6u45-linux-x64.bin
./jdk-6u45-linux-x64.bin
mv jdk1.6.0_45/ /usr/java
rm -rf /opt/tomcat_jdk/jdk-6u45-linux-x64.bin
#根据提示输入yes后,jdk自解压,如果说自解压后是rpm包则还需要执行
# rpm -ivh jdk-6u11-linux-i586-rpm
#默认会安装到/usr/java

#seconed,Configure
echo '
export JAVA_HOME=/usr/java/jdk1.6.0_45
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
' >>/etc/profile.d/java.sh
. /etc/profile
#Check JAVA
#if you want to Uninstall jdk you can do:
#rm -rf jdk1.6.0_30

第三步:安装配置Tomcat
echo 'export CATALINA_HOME=/usr/local/tomcat6
export PATH=$PATH:$CATALINA_HOME/bin
' >> /etc/profile.d/tomcat.sh
tar xf apache-tomcat-6.0.45.tar.gz
mv apache-tomcat-6.0.45 /usr/local/tomcat6
#启动tomcat
/usr/local/tomcat6/bin/startup.sh
#验证
netstat -anpl |grep 8080 >>/tmp/check.txt

第四步:LibreOffice
#以安装到/opt目录下为例子
cd /opt
tar xf LibreOffice_5.0.3_Linux_x86-64_rpm.tar.gz
cd libreOffice
rpm -ivh lib*
#将soffice做一个软链接到bin下方便全局执行
ln -s /opt/libreoffice5.0/program/soffice /usr/bin


#启动tomcat
/usr/local/tomcat6/bin/startup.sh
#验证
netstat -anpl |grep 8080 >>/tmp/check.txt

第五步:升级Python到2.7
更新python 到2.7.参考这里http://www.gowhich.com/blog/553
需要添加配置参数./configure  --enable-shared CFLAGS=-fPIC //指定编辑成共享库文件
cp libpython2.7.so libpython2.7.so.1.0 /usr/lib64/
cp libpython2.7.so libpython2.7.so.1.0 /usr/lib/

第六步:升级pkg-config-0.28
升级pkg-config到版本2.8
下载依赖库:yum install zlib-devel.x86_64 glib2-devel.x86_64 –y
yum install libtool patch libtool-ltdl-devel

cd pkg-config-0.28
./configure --with-internal-glib
make && make install
mv /usr/bin/pkg-config/usr/bin/pkg-configbak
ln -s /usr/local/bin/pkg-config/usr/bin/pkg-config
pkg-config --version 查看版本

第七步:安装Autoconf-2.69
xz -d autoconf-2.69.tar.zx
tar -xvf autoconf-2.69.tar
cd autoconf-2.69
./configure --prefix=/usr
make && make install

第八步:yum install glib2-devel -y https://github.com/fontforge/fontforge/issues/564

第九步:fontforge
yum install libjpeg-turbo.x86_64libjpeg-turbo-devel libjpeg-turbo-devel.x86_64 libtiff.x86_64 libtiff-devel openjpeg-devel.x86_64 openjpeg giflibgiflib-devellibxml2.x86_64 libxml2-devel libspiro.x86_64 libspiro-devel libuninameslist-devel.x86_64 pango-devel -y

./bootsrap

./configure--without-libzmq --without-x --without-iconv --disable-python-scripting--disable-python-extension


make
第十步:安装poppler
yum install expat expat-devel qt4 -y
xz –d poppler-0.41.0.tar.xz
tar xf poppler-0.41.0.tar
cd poppler-0.41.0
./configure --prefix=/usr --enable-xpdf-headers
make && make install
cp /usr/local/lib/pkgconfig/poppler*.pc /usr/lib64/pkgconfig
cp /usr/local/lib/libpoppler*.so /usr/lib64

第十一步:安装cairo -1.12.2
yum install libspectre libspectre-devel
安装pixman
make tar -zxvf pixman-0.32.4.tar.gz
cd pixman-0.32.4
./configure
make
make install
yum install -y cairo

第十二步:编译安装pdf2htmlEX
进入pdf2htmlEX目录

cmake -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++-DENABLE_SVG=OFF
如果cmake失败,rm -rf CMakeCache.txt
rm -rf CMakeFiles/
后重新cmake
pdf2htmlEX -v
pdf2htmlEX: error while loading shared libraries: libfontforge.so.2: cannot open shared object file: No such file or directory
mkdir /usr/local/include/poppler/
find / -name libfontforge.so.2
cp /usr/local/lib/libfontforge.so.2 /usr/local/include/poppler/

/etc/profile 中需要配置的环境变量
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/lib/pkgconfig
export LD_LIBRARY_PATH=/usr/lib:/usr/lib
export png_REQUIRES="libpng"
export LD_LIBRARY_PATH=/usr/local/include/poppler/
centos安装pdf2htm转换软件详细教程_pdf2html


软件安装包下载地址见百度云盘:http://pan.baidu.com/s/1ctSDxc  密码:kglb