Search code examples
ubuntusshwkhtmltopdfdreamhost

Installing WKHTMLtoPDF 0.12.x 64 bit on Ubuntu 12.04.5 (Dreamhost VPS)


I'm trying to install WKHTMLtoPDf 0.12.x on a Dreamhost VPS running Ubuntu 12.04.5. I found a realatively new resource and it seems like it should be pretty straight forward:

sudo add-apt-repository ppa:pov/wkhtmltopdf
sudo apt-get update
sudo apt-get install wkhtmltopdf 

But, it tells me the user I'm SSH'd in with using Putty is not in the Sudoers file, and the incident will be reported.

Is this the right way to install wkhtmltopdf on the Dreamhost VPS? and if so how do you add a user to the sudoers file?

I'm not overly savy with SSH commands or servers so any explanations would be best at a high-level.

UPDATE

Dreamhost was able to help me get on the sudoers list with no issues, but the commands listed above don't seem to work. I'm at root after typing:

sudo -s

But now

add-apt-repository ppa:pov/wkhtmltopdf
ERROR - add-apt-repository: command not found

and

apt-get ppa:pov/wkhtmltopdf (also tried it with just wkhtmltopdf)
ERROR - Invalid operation ppa:pov/wkhtmltopdf

I also tried

apt-get install wkhtmltopdf

Which installed wkhtmltopdf, but it installed version 0.9.9.3, which is super old. How do I update this? Or just get rid of it?

UPDATE 2

To remove the package and all its dependencies I used this resource:

apt-get remove --purge wkhtmltopdf

and then as suggested by the command prompt ran autoremove afterwards to remove the dependencies.

apt-get autoremove

UPDATE 3

Okay, so through a coordinated effect this bit of help was found, so using:

apt-get install software-properties-common python-software-properties

I can now use

add-apt-repository ppa:pov/wkhtmltopdf

And that allows the use of all the commands above (minus sudo if you typed "sudo -s")

BUT now I'm sitting in front of a freaky pink screen that is asking me to install Grub? and I have no idea what I should do? Should I say yes or no? Why?

UPDATE 4

I SSH'd in using another shell to check if you have grub installed or not and by typing:

grub-install -v

I have 1.99-21ubuntu3.17, so I thought I'd hit no, but then it just keeps asking me to if I want to install Grub, which apparently is issue with this version of Ubuntu. So I was forced to hit yes and everything seems to be working.

In case this was a bad decision to hit yes let me know.


Solution

  • The steps taken to install WKHTMLtoPDF 0.12.x onto Ubuntu 12.04.5 derived from the above question, using these resources (1 and 2) where:

    sudo -s
    add-apt-repository ppa:pov/wkhtmltopdf
    

    If add-apt-repository is not a recognized command:

    apt-get install software-properties-common python-software-properties
    

    Continue if add-apt-repository was a recognized command, or after running the abov command to and rerunning the first command:

    apt-get update
    apt-get install wkhtmltopdf
    

    With regards to Grub, I don't know what you should choose. For me it was made by the fact I couldn't say no, and had to choose yes based on some issue related to Ubuntu.

    Once installed run:

    wkhtmltopdf --version (should say wkhtmltopdf 0.12.1)
    

    and then do a quick test of the install:

    wkhtmltopdf http://www.google.com google.pdf
    

    If this results in a command not found error you'll have to install xvfb:

    apt-get install xvfb
    

    And run the command below (found here) to generate your PDFs:

    xvfb-run --server-args="-screen 0, 1024x768x24" wkhtmltopdf http://www.google.com google.pdf