Install PDFtk on Red Hat or CentOS

Install PDFtk Server on Red Hat Enterprise Linux (RHEL versions 5 or 6) or CentOS (versions 5 or 6). Download a binary RPM, build from a source RPM, or build from source code.

Here are three ways to install our command-line PDFtk Server on Red Hat Enterprise Linux or CentOS Linux:

Install from Binary RPM

This is the best choice for most people. First, download the RPM that fits your operating system:

Next, install libgcj, on which pdftk depends:

sudo yum install libgcj

Finally, install the pdftk RPM you downloaded:

sudo rpm -i pdftk-2.02-1.*.rpm

Build and Install from Source RPM

If you would like to build PDFtk Server for yourself, consider using our source RPM. You will build a binary RPM which you can then install as described above.

First, set up your RPM build environment. Keep in mind that you’ll be building the RPM as an ordinary user — not as root.

Next, install the tools you’ll need to build PDFtk Server:

sudo yum install gcc gcc-java libgcj libgcj-devel gcc-c++

Next, download our PDFtk Server source RPM:

pdftk-2.02-1.el6.src.rpm

They say you should never build RPMs as root. So perform this next step using an ordinary user account:

rpmbuild --rebuild pdftk-2.02-1.el6.src.rpm

Upon completion, you will find a binary RPM in the RPMS directory you created as part of the first step. Change into this RPMS directory and install the new RPM with:

sudo rpm -i pdftk-2.02-1.*.rpm

Build from Source Code

You can build and install PDFtk Server without using rpm as follows:

sudo yum install gcc gcc-java libgcj libgcj-devel gcc-c++

wget https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk-2.02-src.zip

unzip pdftk-2.02-src.zip

cd pdftk-2.02-dist/pdftk

make -f Makefile.Redhat

sudo make -f Makefile.Redhat install

Upon completion, you will find pdftk in /usr/local/bin.