简体   繁体   中英

I'm trying to install wkhtmltopdf on my VPS but get an errormessage when executing

I'm trying to install wkhtmltopdf on my virtual private server. This is a tool to convert HTML to PDF.

I did the following:

  1. Start SSH terminal and login.
  2. cd /var/www/vhosts/{domain}/subdomains/stage/httpdocs/lib/wkhtmltopdf
  3. wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.10.0_rc2-static-i386.tar.bz2
  4. tar -ixvf wkhtmltopdf-0.10.0_rc2-static-i386.tar.bz2
  5. ./wkhtmltopdf-i386 http://www.example.com/ test.pdf

This is where I get my error:

./wkhtmltopdf-i386: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory

Ok looking at this I'm thinking the libXrender has to be installed. So I tried to find the way to do that, but I'm not really linux expert. What I did find was this:

Before you install you will need to have X11, gcc and openssl installed. On Debian/Ubuntu this can be done as follows:

sudo aptitude install openssl build-essential xorg libssl-dev libxrender-dev

And then I get this:

sudo: aptitude: command not found

I think the vps is running redhat enterprise I'm not sure about the edition. It also has Plesk 10.3 running. In my plesk panel it says the vps is running centOS but when I type help in SSH it says redhat

See if you have any file called libXrender in your /usr/lib directory. If you do, try creating a symbolic link with libXrender.so.1

ln -s libXrender-whatever libXrender.so.1

Try installing again your program.

If you don't have any libXrender file in /usr/lib, find the package by searching in google (you need to know your OS version)

uname -srv (will likely tell you your kernel version and distribution name)

Once you download the package, just run

rpm -Uvh [rpm-file-downloaded-for-libXrender]

Then try installing your program again.

If you use redhat, I believe you can simply do

yum install [any-package-name] and it will download the appropriate version for your distro, if it finds it by the name you provided.

The package would have been libxrender-dev for Ubuntu/Debian systems; and apt-get instead of aptitude usually.

For RPM systems, the package is called xrender and you install it with yum :

sudo yum install xrender

For fedora use this:

sudo yum install libXrender 
sudo yum install libXext

execute following commands.

yum install openssl openssl-devel

ln -s /usr/local/bin/wkhtmltopdf /usr/sbin/

This worked for me on Centos 6.

yum install libXext  libXrender  fontconfig  libfontconfig.so.1
yum install urw-fonts

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM