I need WKHTMLTOX to be installed with my AWS EB app. I found this tutorial and it works except it supports old version.
Did anyone install the latest (0.12.3) version on AWS EB as this is a bit different folders structure?
I need WKHTMLTOX to be installed with my AWS EB app. I found this tutorial and it works except it supports old version.
Did anyone install the latest (0.12.3) version on AWS EB as this is a bit different folders structure?
After trying different tutorials, including this I finally got this working - I updated porteaux's answer.
I added below code to my EB *.config file in commands section:
commands:
# install WKHTML
03_command:
command: yum install xz urw-fonts libXext openssl-devel libXrender
04_command:
command: wget http://download.gna.org/wkhtmltopdf/0.12/0.12.3/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
05_command:
command: tar -xJf wkhtmltox-0.12.3_linux-generic-amd64.tar.xz
06_command:
command: cp wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
07_command:
command: cp wkhtmltox/bin/wkhtmltoimage /usr/local/bin/wkhtmltoimage
Done! I hope this will help others.
UPDATE: as per dhollenbeck suggestion
04_command:
command: wget https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
test: test ! -f .wkhtmltopdf
05_command:
command: tar -xJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
test: test ! -f .wkhtmltopdf
06_command:
command: cp wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
test: test ! -f .wkhtmltopdf
07_command:
command: cp wkhtmltox/bin/wkhtmltoimage /usr/local/bin/wkhtmltoimage
test: test ! -f .wkhtmltopdf
08_command:
command: touch .wkhtmltopdf
I've updated my script already and can confirm that this work. Thanks dhollenbeck
None of the other answers appear to be fully function at the moment (some because the links are no longer valid and some because of new dependency issues). I don't have enough reputation to comment on Lucas D'Avila's answer so here is the solution that is working for me today with Amazon-Linux/2.9.7:
Create an .ebextensions file named something like .ebextensions/wkhtmltopdf.config
container_commands:
1_install_wkhtmltopdf:
command: yum -y install fontconfig libXrender libXext xorg-x11-fonts-Type1 xorg-x11-fonts-75dpi freetype libpng zlib libjpeg-turbo openssl icu
ignoreErrors: true
2_install_wkhtmltopdf:
# see: https://wkhtmltopdf.org/downloads.html for updates
command: wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz --dns-timeout=5 --connect-timeout=5 --no-check-certificate
test: test ! -f .wkhtmltopdf
3_install_wkhtmltopdf:
command: tar -xJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
test: test ! -f .wkhtmltopdf
4_install_wkhtmltopdf:
command: cp wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
test: test ! -f .wkhtmltopdf
5_install_wkhtmltopdf:
command: cp wkhtmltox/bin/wkhtmltoimage /usr/local/bin/wkhtmltoimage
test: test ! -f .wkhtmltopdf
6_install_wkhtmltopdf:
command: touch .wkhtmltopdf
I have insufficient reputation to comment everywhere, so my apologies that this is another answer, rather than just a comment on @dhollenbeck answer. Happy to delete this if that is updated.
gna.org has shut down thus 04_command will fail. A working list of downloads is on wkhtmltopdf.org.
The updated YAML scripts would therefore be.
Create yaml file .ebextensions/wkhtmltopdf.config:
commands:
03_command:
command: yum install --assumeyes zlib fontconfig freetype X11
04_command:
command: wget https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
05_command:
command: tar -xJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
06_command:
command: cp wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
07_command:
command: cp wkhtmltox/bin/wkhtmltoimage /usr/local/bin/wkhtmltoimage
and if you only want to install wkhtmltopdf once to speed up subsequent deployments:
commands:
03_command:
command: yum install --assumeyes zlib fontconfig freetype X11
test: test ! -f .wkhtmltopdf
04_command:
command: wget https://downloads.wkhtmltopdf.org/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
test: test ! -f .wkhtmltopdf
05_command:
command: tar -xJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
test: test ! -f .wkhtmltopdf
06_command:
command: cp wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf
test: test ! -f .wkhtmltopdf
07_command:
command: cp wkhtmltox/bin/wkhtmltoimage /usr/local/bin/wkhtmltoimage
test: test ! -f .wkhtmltopdf
08_command:
command: touch .wkhtmltopdf
An updated answer for wkhtmltopdf 0.12.4 installed on 64bit Amazon Linux 2016.09 v3.3.0.
Create yaml file .ebextensions/wkhtmltopdf.config
commands: 03_command: command: yum install --assumeyes zlib fontconfig freetype X11 04_command: command: wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz 05_command: command: tar -xJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz 06_command: command: cp wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf 07_command: command: cp wkhtmltox/bin/wkhtmltoimage /usr/local/bin/wkhtmltoimage
If you only want to install wkhtmltopdf once to speed up subsequent deployments:
commands: 03_command: command: yum install --assumeyes zlib fontconfig freetype X11 test: test ! -f .wkhtmltopdf 04_command: command: wget http://download.gna.org/wkhtmltopdf/0.12/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz test: test ! -f .wkhtmltopdf 05_command: command: tar -xJf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz test: test ! -f .wkhtmltopdf 06_command: command: cp wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf test: test ! -f .wkhtmltopdf 07_command: command: cp wkhtmltox/bin/wkhtmltoimage /usr/local/bin/wkhtmltoimage test: test ! -f .wkhtmltopdf 08_command: command: touch .wkhtmltopdf
Complementing Elric Pedder anwser.
If wkhtmltopdf is already installed, it will give and error because yum will give a "Error: Nothing to do" and exit with -1 state. This will occur when you re deploy your elastic beanstalk.
In order to install wkhtmltopdf without failing, i check if is already installed.
wkhtmltopdf.config
container_commands:
01_install_wkhtmltopdf:
command: sudo yum -q list installed wkhtmltox.x86_64 &>/dev/null && sudo yum -y reinstall https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.amazonlinux2.x86_64.rpm || sudo yum -y install https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.amazonlinux2.x86_64.rpm
You can also install wkhtmltopdf by creating a file like .ebextensions/packages.config
with this content:
packages:
rpm:
# find more versions on https://wkhtmltopdf.org/downloads.html
wkhtmltopdf: https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm
wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1.centos6.x86_64.rpm
sudo yum install wkhtmltox-0.12.5-1.centos6.x86_64.rpm
© 2022 - 2024 — McMap. All rights reserved.