How to install WKHTMLTOX on Linux 9

Share on Social Media

In this Linux Tutorial, you will learn how to install WKHTMLTOX on Linux 9 or other Red Hat based Linux distributions. #centlinux #linux

What is WKHTMLTOX?:

WKHTMLTOX is a combination of wkhtmltopdf and wkhtmltoimage, that are open source (LGPLv3) command line tools to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely “headless” and do not require a display or display service.

Video to install WKHTMLTOX on Linux:

YouTube player

Environment Specification:

We are using a minimal Rocky Linux 9 operating system with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – Rocky Linux release 9.1 (Blue Onyx)
  • Hostname – rocky9.centlinux-com.preview-domain.com
  • IP Address – 192.168.88.128/24

Prepare your Linux Server:

Login as root user on your Rocky Linux server, with the help of a ssh client.

Update software packages in your Linux operating system by using dnf package manager.

# dnf update -y

Occasionally, above command also updates your Linux Kernel. If it happens, then you should reboot your Linux operating system before moving forward in this Linux tutorial.

# reboot

After reboot, check the Linux operating system and Kernel versions.

# cat /etc/os-release
NAME="Rocky Linux"
VERSION="9.1 (Blue Onyx)"
ID="rocky"
ID_LIKE="rhel centos fedora"
VERSION_ID="9.1"
PLATFORM_ID="platform:el9"
PRETTY_NAME="Rocky Linux 9.1 (Blue Onyx)"
ANSI_COLOR="0;32"
LOGO="fedora-logo-icon"
CPE_NAME="cpe:/o:rocky:rocky:9::baseos"
HOME_URL="https://rockylinux.org/"
BUG_REPORT_URL="https://bugs.rockylinux.org/"
ROCKY_SUPPORT_PRODUCT="Rocky-Linux-9"
ROCKY_SUPPORT_PRODUCT_VERSION="9.1"
REDHAT_SUPPORT_PRODUCT="Rocky Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="9.1"

# uname -r
5.14.0-162.18.1.el9_1.x86_64

WKHTMLTOX is not available in standard yum repositories. But you can download the latest version of WKHTMLTOX from their official website.

To download WKHTMLTOX rpm you may need wget command. Therefore, install it now with the help of dnf command.

# dnf install -y wget

Install WKHTMLTOX on Linux:

Now, use wget command to download WKHTMLTOX rpm. You can either use the following commands to download WKHTMLTOX or get the URL of latest version from their website.

# cd /tmp
# wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm
...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16198412 (15M) [application/octet-stream]
Saving to: ‘wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm’

wkhtmltox-0.12.6.1- 100%[===================>]  15.45M   515KB/s    in 20s

2023-03-27 12:08:50 (801 KB/s) - ‘wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm’ saved [16198412/16198412]

Execute following command to install WKHTMLTOX on your Rocky Linux server.

# dnf localinstall -y wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm

After installation, check the versions of wkhtmltopdf and wkhtmltoimage commands.

# wkhtmltopdf --version
wkhtmltopdf 0.12.6.1 (with patched qt)

# wkhtmltoimage --version
wkhtmltoimage 0.12.6.1 (with patched qt)

WKHTMLTOX has been installed successfully.

You can use –help switch as follows to get help on wkhtmltopdf and wkhtmltoimage commands.

# wkhtmltopdf --help
# wkhtmltoimage --help

Conclusion:

In this Linux tutorial, you have learned how to install WKHTMLTOX on Linux 9 or other Red Hat based Linux distributions.