Install WKHTMLTOX (WKHTMLTOPDF + WKHTMLTOIMAGE) on AWS ElasticBeanstalk

I need WKHTMLTOX to be installed with my AWS EB application. I found this tutorial and it works, except that it supports the old version.

Has anyone installed the latest version (0.12.3) on AWS EB as this is a slightly different folder structure?

+6
source share
3 answers

After trying various tutorials, including this , I finally got this working - I updated porteaux's answer.

I added the code below to my EB * .config file in the command 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 
  • Amazon Linux runs in the tutorial above for Ubuntu and AWS EB, so they use yum instead of apt-get
  • I had to use the j switch with the tar command to work with the * .xz file
  • Finally, I had to copy the wkhtmltopdf and wkhtmltoimage files to the bin folder.

Done! Hope this helps others.

UPDATE: as suggested by dhollenbeck

  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 have already updated my script and can confirm that this work. Thanks dhollenbeck

+12
source

Updated answer for wkhtmltopdf 0.12.4 installed on the 64-bit version of Amazon Linux 2016.09 v3.3.0.

Create yaml.ebextensions / wkhtmltopdf.config file

  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

+3
source

I do not have enough reputation to comment everywhere, so I apologize that this is another answer, not just a comment on @dhollenbeck. We will gladly delete it if it is updated.

gna.org has disconnected, so 04_command will fail. A worklist of downloads is available at wkhtmltopdf.org.

So the updated YAML scripts will be.

Create file yaml.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 
+3
source

All Articles