How to Install wkhtmltopdf? - ruby-on-rails

Now i am working on rails 3.0.0.i am using Ubuntu 11.10 ,64 bit os.i want to install wkhtmltopdf.please tell me the static version of wkhtmltopdf.

Installing wkhtmltopdf
on Ubuntu Linux machine
First check os is 32 bit or 64 bit by using following command
Try uname -m. It seems like the uname -m actually gives x86_64 when it is an kernel 64 bits
Run following command
sudo apt-get install openssl build-essential xorg libssl-dev libxrender-dev
Then run following command
sudo apt-get install wkhtmltopdf
Based on OS download wkhtmltopdf package from following site
http://code.google.com/p/wkhtmltopdf/downloads/list
OR
wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-i386.tar.bz2
(wkhtmltopdf-0.9.9-static-i386.tar.bz2 is a stable release for wkhtmltopdf )
Then extract using command
tar xvjf wkhtmltopdf-0.9.9-static-i386.tar.bz2
Then move extracted DIR to usr/local/bin folder
sudo mv wkhtmltopdf-i386 /usr/local/bin/wkhtmltopdf
Check wkhtmltopdf is install or not using following command
which wkhtmltopdf
wkhtmltopdf –help
Installing wkhtmltopdf on MacOs
brew install Caskroom/cask/wkhtmltopdf

Another way to use official binaries within Rails is adding the following line to your Gemfile:
gem 'wkhtmltopdf-installer'
This way the official binaries from http://wkhtmltopdf.org will be downloaded and added to your bundle during bundle install phase.

I encountered this problem this morning.
Before you do anything, please check out: https://github.com/pdfkit/pdfkit/wiki/Installing-WKHTMLTOPDF
Download a binary edition of wkhtmltopdf at http://code.google.com/p/wkhtmltopdf/downloads/list
Decompress the package.
Copy the file like wkhtmltopdf-i386 to /usr/local/bin/ & /opt/ (also you could make soft link).
That's done.
Good luck.

Related

OpenCV error zlib.h: no such file or directory

I am trying to follow this website to install opencv4 on Ubuntu 18.04.
https://www.learnopencv.com/install-opencv-4-on-ubuntu-18-04/
But I get this error after make
In file included from /home/gosztolai/opencv/3rdparty/libpng/pngpriv.h:913:0,
from /home/gosztolai/opencv/3rdparty/libpng/png.c:14:
/home/gosztolai/opencv/3rdparty/libpng/pngstruct.h:30:10: fatal error: zlib.h: No such file or directory
#include "zlib.h"
I tried sudo apt install zlib1g-dev but the system says that it is already isntalled
Could someone help what is going on?
libpng uses the zlib library for image compression. To install it in Ubuntu, run the following code in your bash terminal:
sudo apt-get install zlib1g-dev
But because you already have it installed, and need a newer version, you need to update the library. Try to upgrade your packages, using this code:
sudo apt update
sudo apt upgrade -y
Or you can try to remove it using apt and install again.

error while loading shared libraries: libMagickCore-7.Q16HDRI.so.6

I have been trying to install ImageMagick in Ubuntu 16.04 to use with movie.py
I have installed ImageMagick 7 but when I check the version from the command line
convert --version
It gives error as
convert: error while loading shared libraries: libMagickCore-7.Q16HDRI.so.6: cannot open shared object file: No such file or directory
I also tried running
sudo ldconfig /user/local/lib
But, still getting same error.
Edit 2: How I installed
Downloaded two rpm files from imagemagick.org
run following commands to install in Ubuntu 16.04
sudo alien -i ImageMagick-libs-7.0.7-37.x86_64.rpm
sudo alien -i ImageMagick-7.0.7-37.x86_64.rpm
You may need to run this: ldconfig /usr/local/lib
Found that the LD_LIBRARY_PATH variable isn't being created by the installation of ImageMagick, so when I created it manually (on Linux Mint 19) -
LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
Then the ImageMagick commands work, without generating the error message -
convert: error while loading shared libraries: libMagickCore-7.Q16HDRI.so.6: cannot open shared object file: No such file or directory
I also encountered this error when attempting to install ImageMagick 7.0.10 on Ubuntu 20.04 (using WSL on Windows 10).
Running this fixed my problem:
sudo ldconfig /usr/lib64
I found this folder by examining the deb:
dpkg -c imagemagick-libs_7.0.10-57_amd64.deb | grep libMagickCore-7.Q16HDRI.so.8
This showed:
lrwxrwxrwx root/root 0 2021-01-09 09:59 ./usr/lib64/libMagickCore-7.Q16HDRI.so.8 -> libMagickCore-7.Q16HDRI.so.8.0.0
I would suggest you find where the missing library is located:
sudo find /usr /opt / -type f -name libMagickCore-7.Q16HDRI.so.6
Then check your ldconfig settings match in:
/etc/ld.so.conf
What worked for me:
Uninstall native version (if you have installed from tar.gz)
cd ImageMagick-7.1.0-19/
sudo make uninstall
Remove apt version
sudo apt remove imagemagick
sudo apt purge imagemagick
Do simple install
sudo apt install imagemagick

Installing ruby sudo make command not found (Vagrant, Virtualbox)

I am trying to get a development environment up and running. I installed virtualbox and then used vagrant with the hashicorp/precise32 box. I access the VM through ssh and am trying to install the latest version of ruby.
I pasted
wget -O ruby-install-0.5.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz
tar -xzvf ruby-install-0.5.0.tar.gz
cd ruby-install-0.5.0/
sudo make install
into the command line from https://github.com/postmodern/ruby-install#readme
The prompt shows sudo make install and when I hit enter I get a message that says "sudo: make: command not found."
What am I doing wrong?
I know there are boxes with ruby already setup but I wanted to go through the process myself so learn a bit along the way.
A separate issue I came across was that this box has an outdated version of ubuntu. When I try to upgrade it warns me not to do it over SSH. Is there a better way?
Thanks
Maybe you don't have make installed on Ubuntu. You can install the package build-essential which will install make and other building tools.
sudo apt-get install build-essential
also, here's a good reference on installing Ruby, Ruby on Rails, and other tools on Ubuntu.

Installing Ruby on Rails on Linux mint?

When I used "sudo apt-get install ruby-full build-essential" in the terminal I got this:
$ sudo apt-get install ruby-full build-essential
Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/packages.medibuntu.org_dists_quantal_non-free_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.
Can anybody tell me how can I install Ruby on Rails in my Linux Mint machine?
I think you don't need features of rvm. You just want to install ruby easy, fast and without troubles, right? Good news to you. We got an alternative to rvm. It's called rbenv. You can find an installation guide here.(don't skip ruby-build, it is necessary!).
And yes, follow ubuntu instructions since Mint is build on it (though there's debian-based version but I suppose you use ubuntu-based one).
I installed yesterday Mint 16 and rbenv on it. Works fine.
PS: don't forget to sudo apt-get install build-essential first.
I actually use Mint on my main development system. I'd also recommend using RVM to manage all your Ruby and Rails installation/versions. The command to install it is:
\curl -L https://get.rvm.io | bash -s stable
You can also append --ruby and --rails to get (I believe) the most recent versions of the two of them. I'd recommend not using apt-get for installing Ruby, as I've noticed that it can be out of date and/or lead to strange errors like those that you're seeing. You can get more information from the RVM website. I really enjoy using Mint, so I hope that helps.
Use rvm to install Ruby then simply install rails gem , but before that fix your repository related problem.
sudo rm -rf /var/log/apt/list
sudo apt-get update
sudo apt-get upgrade
Then install rvm see rvm.io for installation info
If you are new want to setup everything from start then see this blog post
https://www.computersnyou.com/4235
Use rbenv
instead, use this link DigitalOcean since mint is an ubuntu based distro, it will work.

Can I install gems with apt-get on Ubuntu?

I am new to Ruby and just diving in. The Ruby tutorial says I should get the packaging system from here: http://rubyforge.org/frs/?group_id=126
I am on Ubuntu Linux. The page has a .tar and a .gem option for downloading. Which should I download?
Also, are gems exactly analogous to Java jars? And why do I need the gem packaging system if I can just download gems one by one as they are needed?
Ubuntu now have rubygems as a package
For Ubuntu 12:
sudo apt-get install rubygems
For Ubuntu 14.04:
sudo apt-get install rubygems-integration
On Ubuntu 16.04 and Ubuntu 18.04, both sudo apt-get install rubygems and sudo apt-get install rubygems-integration failed for me. Instead, I had to do this:
sudo apt-get install ruby-dev
If on Ubuntu 14.04 try below
sudo apt-get install rubygems-integration
First, download *.tar file, unpack this file, then go to rubygems directory in your console, and type
ruby setup.rb
That's it :)
If you install the full ruby application set with
sudo apt-get install ruby-full
You will get gems and much more by default. Tested on Ubuntu 16, it could also work on other version.
For me in Ubuntu 20.04 I did 3 things to create a new Ruby and Rails app.
Install Ruby development version
sudo apt install ruby-dev
Install rails from gem
sudo gem install rails
Create new application
rails new blog
I got error while installing rails(sudo apt install rails) only, So I installed devlopment version. I got permission related error while not using Sudo as well while installing gems and rails.
For Ubuntu
First install ruby:
sudo apt install ruby
Note that : sudo snap install ruby will throw this error :
error: This revision of snap "ruby" was published using classic
confinement and
thus may perform arbitrary system changes outside of the security
sandbox that snaps are usually confined to, which may put your system at
risk.
If you understand and want to proceed repeat the command including
--classic.
Finally, download latest tar version of ruby gems here:
https://rubygems.org/pages/download
Unzip and cd to the folder and finally type in terminal:
sudo ruby setup.rb

Resources