1、下载安装包
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.centos7.x86_64.rpm
2、执行命令
rpm -ivh wkhtmltox-0.12.6-1.centos7.x86_64.rpm
若出现报错:
rpmdb: BDB0113 Thread/process 3062867/281468364164160 failed: BDB1507 Thread died in Berkeley DB lib
顺序执行以下命令语句
cd /var/lib/rpm ls rm -rf __db* rpm --rebuilddb
若出现报错:
error: Failed dependencies:
xorg-x11-fonts-75dpi is needed by wkhtmltox-1:0.12.6-1.centos7.x86_64
xorg-x11-fonts-Type1 is needed by wkhtmltox-1:0.12.6-1.centos7.x86_64
请先执行下面这个命令后再执行安装命令:yum install -y libpng libjpeg openssl icu libX11 libXext libXrender xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi
3、查看版本信息
wkhtmltopdf --version
若出现报错:
error while loading shared libraries: libssl.so.10: cannot open shared object file: No such file or directory
wget http://rpmfind.net/linux/centos/8-stream/AppStream/x86_64/os/Packages/compat-openssl10-1.0.2o-3.el8.x86_64.rpm
安装
rpm -i compat-openssl10-1.0.2o-3.el8.x86_64.rpm
若出现报错:
error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory
yum install libpng15
其他错误运行
yum -y install libncurses*