Install capyabara-webkit gem on Amazon Linux AMI - ruby-on-rails

I am trying to install the capybara-webkit gem on Amazon Linux AMI release 2017.09.
I tried following the install instructions for CentOS (maybe the wrong approach):
sudo yum install -y epel-release
sudo yum install -y qt5-qtwebkit-devel
The first package installed fine, but qt5-qtwebkit-devel gave the following error:
Error: Package: qt5-qtbase-gui-5.6.1-3.el6.x86_64 (epel)
Requires: libgdk-x11-2.0.so.0()(64bit)
Error: Package: qt5-qtbase-gui-5.6.1-3.el6.x86_64 (epel)
Requires: libgdk_pixbuf-2.0.so.0()(64bit)
Error: Package: qt5-qtbase-gui-5.6.1-3.el6.x86_64 (epel)
Requires: libatk-1.0.so.0()(64bit)
Error: Package: qt5-qtbase-gui-5.6.1-3.el6.x86_64 (epel)
Requires: libgtk-x11-2.0.so.0()(64bit)
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I am unable to resolve the libgdk_pixbuf-2.0.so.0 dependency in Amazon Linux. I tried installing libX11-devel but that did not resolve the issue.
Of course gem install capybara-webkit -v '1.10.1' fails because qt5 is not installed.
I found a blog with instructions for installing capybara with qt-4.8, I would rather use the latest version and would prefer to use a package manager instead of compiling the package manually.
My question is, how can I install capybara-webkit on Amazon Linux AMI using the package managers?

Amazon AMI doesn’t have a yum repo for the libgtk-x11-2.0.so.0. So you need to install other distro packages. In this case, did used CentOS.
$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/hicolor-icon-theme-0.11-1.1.el6.noarch.rpm
$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/atk-1.30.0-1.el6.x86_64.rpm
$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/gdk-pixbuf2-2.24.1-6.el6_7.x86_64.rpm
$ sudo yum install ftp://ftp.riken.jp/Linux/centos/6/os/x86_64/Packages/gtk2-2.24.23-9.el6.x86_64.rpm
Once the packages are install the setup should work for you
PS: Source https://ubunifu.co/python/installing-libgtk-x11-2-0-so-0-in-amazon-linux-ami-2017-03-1

I'm using chef but this is where I got the necessary dependencies.
just add this repo to yum repos, and then do the install
yum_repository 'centos-base' do
url 'http://mirror.centos.org/centos/6/os/x86_64/'
gpgkey 'http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6'
action :add
end
package 'qt5-qtwebkit-devel'

Related

Kong-OIDC Plugin Installation Issue

I am installing Kong-OIDC plugin in a Kong docker container and get following error:
Error: Failed installing dependency: https://luarocks.org/lua-resty-openidc-1.6.0-1.src.rock - Failed installing dependency: https://luarocks.org/lua-resty-jwt-0.2.2-0.src.rock - Rockspec format 3.0 is not supported, please upgrade LuaRocks.
Seems like one of the underlying dependency "lua-jesty-jwt" is using Rockpsec format 3.0 version, which is not supported any more. Is there a way to get around this issue ?
I updated the Dockerfile with a previous version of the kong-oidc plugin. The Dockerfile looks like this:
FROM kong:0.14-centos
LABEL description="Centos 7 + Kong 0.14 + kong-oidc plugin"
RUN yum install -y git unzip && yum clean all
RUN luarocks install kong-oidc 1.0.1
But running docker build -t kong:0.14-centos-oidc returns this error:
Error: Failed installing dependency: https://luarocks.org/lua-resty-openidc-1.2.3-1.src.rock - Failed installing dependency: https://luarocks.org/lua-resty-hmac-v1.0-1.rockspec - Failed installing dependency: https://luarocks.org/luacrypto-0.3.2-2.src.rock - Could not find header file for OPENSSL
No file openssl/evp.h in /usr/local/include
No file openssl/evp.h in /usr/include
You may have to install OPENSSL in your system and/or pass OPENSSL_DIR or OPENSSL_INCDIR to the luarocks command.
Example: luarocks install luacrypto OPENSSL_DIR=/usr/local
So we need to add RUN yum install openssl-devel -y to the Dockerfile. So, if you run again the docker build command, you'll get this error:
Build error: Failed compiling object src/lcrypto.oError: Failed installing dependency: https://luarocks.org/lua-resty-openidc-1.2.3-1.src.rock - Failed installing dependency: https://luarocks.org/lua-resty-hmac-v1.0-1.rockspec - Failed installing dependency: https://luarocks.org/luacrypto-0.3.2-2.src.rock - Build error: Failed compiling object src/lcrypto.o
So we need to install the gcc compiler adding RUN yum install -y gcc to the Dockerfile. The final result is:
FROM kong:0.14-centos
LABEL description="Centos 7 + Kong 0.14 + kong-oidc plugin"
RUN yum install -y git unzip && yum clean all
RUN yum install -y openssl-devel -y
RUN yum install -y gcc
RUN luarocks install kong-oidc 1.0.1
Now the container builds successfully, but I think the current kong-oidc plugin is not maintained anymore.
UPDATE: Check this repository to get a working example of the kong-oidc plugin with Keycloak.
The latest version of kong-oidc (1.1.0) did not work for me, but I was able to install an older version (1.0.1) without much issue. I did have to install an additional library "openssl-devel" (yum install openssl-devel).

Installing Docker CE in redhat

I have tried to install Docker CE in my system and it ends with some problem.
I did the below steps:
sudo yum install -y yum-utils – No error
sudo yum-config-manager --add-repo
https://download.docker.com/linux/centos/docker-ce.repo - No error
sudo yum makecache fast – No error
sudo yum -y install docker-ce – Failed with error
Error: Package: docker-ce-17.06.0.ce-1.el7.centos.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2.9
yum can be configured to try to resolve such errors by temporarily enabling
disabled repos and searching for missing dependencies.
To enable this functionality please set 'notify_only=0' in /etc/yum/pluginconf.d/search-disabled-repos.conf
Error: Package: docker-ce-17.06.0.ce-1.el7.centos.x86_64 (docker-ce-stable)
Requires: container-selinux >= 2.9
You could try using --skip-broken to work around the problem
Can someone please help me in this?
The container-selinux package is available from the rhel-7-server-extras-rpms channel. You can enable it using:
subscription-manager repos --enable=rhel-7-server-extras-rpms
But if you do not have any subscription for Enterprise Linux, you can use CentOS Extra repo as a workaround. Add the below content into /etc/yum.repos.d/centos.repo
[CentOS-extras]
name=CentOS-7-Extras
mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Installing ROS Indigo on Ubuntu 14.04.2

System Information:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
Error message we get:
The following packages have unmet dependencies:
ros-indigo-desktop-full : Depends: ros-indigo-desktop but it is not going to be installed
Depends: ros-indigo-perception but it is not going to be installed
Depends: ros-indigo-simulators but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
If I explore the error message further, this is what I get:
ros-indigo-cpp-common : Depends: libconsole-bridge0.2 but it is not installable
Depends: libboost-all-dev but it is not installable
Depends: libconsole-bridge-dev but it is not installable
I have successfully installed ROS Indigo on Ubuntu 14.04. So be assured that it can be done.
I have seen many of these errors when installing ROS packages. There seems to be some error in the package management system in Ubuntu (aptitude). You may try
sudo apt-get update
sudo apt-get install -f
If it doesn't work, try to manually install some dependencies by
sudo apt-get install ros-indigo-simulators
sudo apt-get install ros-indigo-perception
Hope it helps.
My suggestion would be to delete the old installation as manual installations of dependencies may be too much. I have written a complete end to end blog on the installation of ROS Indigo over Ubuntu 14.04.
For those whom still had problems after trying everything.
I have tracked dependencies and found out that the problem is libboost, I had the version 1.55 but some of ros-indigo modules require the 1.54 version
Try these commands
sudo apt-get install libboost1.54-tools-dev
sudo apt-get install libboost-tools-dev
sudo apt-get install libboost-mpi-python1.54.0
sudo apt-get install libboost-mpi-python1.54-dev
sudo apt-get install libboost-mpi-python-dev
then you can finally
sudo apt-get install ros-indigo-desktop-full
Hope this helps

Rails: Error installing rmagick - ERROR: Failed to build gem native extension

I am trying to run one project on my local machine. I installed Ruby and Rails on my Mac OS system. It is working properly. I can create a new project and can run it properly without any error, but when I try to run the existing project it says that we have to bundle install. When I run that command I get the following error:
"An error occurred while installing rmagick (2.13.2), and Bundler cannot continue.
Make sure that `gem install rmagick -v '2.13.2'` succeeds before bundling."
When I run gem install rmagick -v '2.13.2' it gives me the following error:
ERROR: Error installing rmagick:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for gcc-4.2... yes
checking for Magick-config... no
Can't install RMagick 2.13.2. Can't find Magick-config in /usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392#global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392/bin:/usr/local/rvm/gems/ruby-1.9.3-p392#global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p392/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rmagick-2.13.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/gems/rmagick-2.13.2/ext/RMagick/gem_make.out
I have searched and did not find an answer anywhere.
For Ubuntu, I used the ff. based on this link:
$ sudo apt-get install libmagick++-dev
On a mac (the below code works on OSX Mavericks):
brew install imagemagick
gem install rmagick
On Mac you can try this:
$ brew unlink imagemagick
$ brew install imagemagick#6 && brew link imagemagick#6 --force
$ gem install rmagick
I have solved this problem by installing imagemagic:
sudo apt-get install imagemagick
and then install libmagick package:
sudo apt-get install libmagick++-dev
For Linux Fedora, I got same error and fixed with below two commands:
yum install ImageMagick
gem install rmagick
For Centos install ImageMagick-devel package. using below commands:
yum install ImageMagick-devel
gem install rmagick
First, make sure you've installed Imagemagick :
$ sudo apt-get install imagemagick
Now, it can build the gem native extension.
Then, install the Rmagick gem :
$ sudo gem install rmagick
here's what i did on 16.04,
sudo apt-get install libmagickwand-dev
sudo apt-get install graphicsmagick-imagemagick-compat
and then install gem like that
PATH="/usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16:$PATH" gem install rmagick -v '2.13.2'
May be you are installing ImageMagick version 7.x.x which will generate different folder names in your usr/lib/local/include/ImageMagick7.x.x folder.
E.g.
In ImageMagick6.x.x version we have magick, wand named folders, where in ImageMagick7.x.x version have named this MagickCore , MagickWand . So this updation is causing the problem in some gem installation like here. Which is using
magick/some_header.h or wand/some_header.h (Means they are not updated with the new 7.x.x ImageMagick version).That's why we are getting this error :
```
checking for outdated ImageMagick version (<= 6.4.9)... no
checking for presence of MagickWand API (ImageMagick version >= 6.9.0)... no
....
checking for wand/MagickWand.h... no
```
and in log file something like this :
error: 'MagickCore/method-attribute.h' file not found
#include "MagickCore/method-attribute.h"
^
Solution
Install the ImageMagick6.x.x version in your system from the official site : https://www.imagemagick.org/download/ and install it using this commands(after extract zip/tar) :
./configure
make
make install
Then do
gem install rmagick
It will work.
As per the error log it looks like "Magick-config" is missing.
You need to install ImageMagik or GraphicsMagick. These are the commands you should follow which is taken from RMagik Documentation:
1) Go to http://www.imagemagick.org or http://www.graphicsmagick.org and download the latest version of the software to a temporary directory. the extract them :
- tar xvzf ImageMagick.tar.gz
- cd ImageMagick-x.x.x
- ./configure --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8
- make
- sudo make install
- sudo gem install rmagick
Solution for Ubuntu:
sudo apt-get install imagemagick
ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Magick-config /usr/bin/Magick-config
first run this:
sudo apt-get install imagemagick
then: sudo apt-get install libmagick++-dev
now install rmagick: gem install rmagick
Just run these command
• $ sudo apt-get install imagemagick
• $ sudo apt-get install libmagick++-dev
• $ sudo gem install rmagick
• $ bundle install
I had this same issue when setting up a Rails 6 application in Ubuntu 20.04.
Here's how I solved it
RMagick is an interface between the Ruby programming language and the ImageMagick image processing library. So we first need to install development libraries for ImageMagick:
Step 1:
On Ubuntu, you can run:
sudo apt-get install libmagickwand-dev
On Centos, you can run:
sudo yum install gcc ImageMagick-devel make which
On Arch Linux, you can run:
pacman -Syy pkg-config imagemagick
On Alpine Linux, you can run:
apk add pkgconfig imagemagick imagemagick-dev imagemagick-libs
or you can run if you would like to use ImageMagick 6:
apk add pkgconfig imagemagick6 imagemagick6-dev imagemagick6-libs
On macOS, you can run:
brew install pkg-config imagemagick
or you can run if you would like to use ImageMagick 6:
brew install pkg-config imagemagick#6
On Windows:
Install the latest Ruby+Devkit package which you can get from RubyInstaller for Windows.
You might need to configure PATH environment variable to where the compiler is located.
(Ex: set PATH=C:\Ruby27-x64\msys64\usr\bin;C:\Ruby27-x64\msys64\mingw64\bin;%PATH%)
Download ImageMagick-7.XXXX-Q16-x64-dll.exe (not, ImageMagick-7.XXXX-Q16-x64-static.exe) binary from Windows Binary Release, or you can download ImageMagick 6 from Windows Binary Release.
Install ImageMagick. You need to turn on checkboxes Add application directory to your system path and Install development headers and librarries for C and C++ in an installer for RMagick.
Step 2:
Install the RMagick ruby gem:
gem install rmagick
Step 3:
Now you can add the RMagick ruby gem to your Gemfile:
gem 'rmagick', '~> 4.1'
Note: As of this writing the latest version is 4.1
Step 4:
Finally, you can run bundle install to install the gem to your application.
Resources: rmagick/rmagick GitHub page
That's all.
I hope this helps
Just install ImageMagick-devel package and everything should be fine :)
For Ubuntu Server, I installed it by doing this:
sudo apt-get install imagemagick
sudo apt-get install libmagick++-dev
sudo gem install rmagick -v '2.15.4'
All here wrong for me :(
this helped:
sudo apt-get install libmagickwand-dev
according to rmagick github page
then bundle install went with no errors
If you are using openSUSE, then first check if the ImageMagick installed or not. If it is installed, then do install it development header file.
[arup#sztukajedzenia]$ sudo zypper se imagemagic
root\'s password:
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
--+-------------------+-------------------------------------------------------+-----------
i | ImageMagick | Viewer and Converter for Images | package
| ImageMagick | Viewer and Converter for Images | srcpackage
| ImageMagick-devel | Include Files and Libraries Mandatory for Development | package
| ImageMagick-doc | Document Files for ImageMagick Library | package
| ImageMagick-extra | Viewer and Converter for Images - extra codecs | package
[arup#sztukajedzenia]$ sudo zypper in ImageMagick-devel
root\'s password:
Loading repository data...
Reading installed packages...
Resolving package dependencies...
The following 2 NEW packages are going to be installed:
ImageMagick-devel libbz2-devel
........
You need to run both the command for ubuntu
sudo apt-get install libmagick++-dev
sudo apt-get install imagemagick
Then try to install
gem install rmagick
For mac users, install imagemagick 6 since the newest version 7 isn't compatible.
brew install imagemagick#6
gem install rmagick
The above should work after you uninstall what you already have.
For Fedora 27 I resolved this problem:
sudo dnf install ImageMagick-devel ImageMagick
gem install rmagick

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