20

I have a recently installed RHEL7 system, and need to do gem install jekyll, however this fails as:

Fetching: yajl-ruby-1.2.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing jekyll:
        ERROR: Failed to build gem native extension.

    /usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/share/include/ruby.h

Google suggest this is due to the lack of a ruby-devel package being installed. However there doesn't seem to be such a package in RHEL7. Do I need to move to a software collection (don't really want to do this as this will be for a production machine, not development) or can I get it some other way?

user3852791
  • 317
  • 1
  • 3
  • 6
  • Did you try RPM ruby devel? http://www.rpmfind.net/linux/rpm2html/search.php?query=ruby-devel – sadaf2605 Jun 05 '15 at 11:59
  • 1
    rpmfind isn't listing any version for redhat 7 - this is the problem. I'm not going to install a random apckage from a different distro/version as that's just asking for problems. We'd also quite like to find a package repository-based solution so we get useful things like security updates... – user3852791 Jun 05 '15 at 13:19

8 Answers8

32

This answer comes by way of piecing together bits from other answers - so to the previous contributors...thank you because I would not have figured this out.

This example is based on the RHEL 7 AMI (Amazon Managed Image) 3.10.0-229.el7.x86_64.

So by default as mentioned above the optional repository is not enabled. Don't add another repo.d file as it already exists just that it is disabled.

  1. To enable first you need the name. I used grep to do this:

    grep -B1 -i optional /etc/yum.repos.d/*
    

    above each name will be the repo id enclosed in [ ] look for the optional not optional-source

  2. Enable the optional repo:

    yum-config-manager --enable <repo-id>
    
  3. Refresh the yum cache (not sure if this is necessary but it doesn't hurt):

    sudo yum makecache
    
  4. Finally, you can install ruby-devel:

    yum install ruby-devel
    

Depending on your user's permissions you may need to use sudo.

the Tin Man
  • 158,662
  • 42
  • 215
  • 303
juice
  • 1,651
  • 15
  • 11
7

You need to subscribe to the optional repo to get all the devel packages.

subscription-manager repos  --enable rhel-7-server-optional-rpms

This is because the ruby-devel package is contained in the rhel-7-server-optional-rpms repository.

user7610
  • 25,267
  • 15
  • 124
  • 150
slk
  • 81
  • 1
  • 5
2

At least on Oracle Linux 7 you have to enable an additional repo.

[root@foo ~]# yum repolist
repo id                     repo name 
[...]
ol7_optional_latest/x86_64  Oracle Linux 7Server Optional Latest (x86_64)

After enabling the repo ruby-devel sits there, awaiting your installation.

[root@foo ~]# yum info ruby-devel | egrep 'Name|Version|From'
Name        : ruby-devel
Version     : 2.0.0.598
From repo   : ol7_optional_latest

That's all.

far4d
  • 21
  • 4
  • there is only i686 (version) in RHEL 7 ? Name : ruby-devel Architektur : i686 Version : 1.8.6.111 Ausgabe : 1 – zond Oct 30 '15 at 11:56
2

ruby-devel RPM is available in the following repo on RHEL 7

rhel-7-server-optional-beta-rpms

Set "enabled = 1" for this repo in your .repo file and then run

yum install ruby-devel

BOH
  • 21
  • 2
0

additional repos are available to your RHEL 7

# yum -y install yum-utils
# yum repolist all

This will list all available repos. Enable the repo you need. The devel packages are in extras for instance:

# yum-config-manager --enable rhui-REGION-rhel-server-extras

After performing these steps, I could then install ruby-devel, augeas-devel and install/compile

# gem install ruby-augeas
0

I had the same issue and ended up downloading the package from:

https://www.rpmfind.net/linux/rpm2html/search.php?query=ruby-devel

In RHEL7.5, this package can be installed with:

rpm -ivh ruby-devel-2.0.0.648-33.el7_4.x86_64.rpm

Also, the development tools can be installed before that using:

yum groupinstall "Development Tools"
0xack13
  • 462
  • 4
  • 8
-1

Install ruby package on your system and try again.

sudo yum install ruby193-ruby-devel.x86_64
rick
  • 1,675
  • 3
  • 15
  • 28
  • ruby is already installed. There are no ruby193-* packages available on the system. You need the developer software collection for that package I think? – user3852791 Jun 05 '15 at 13:15
  • This did not solve the issue package still not found on RHEL 7 AMI – juice Jan 08 '16 at 07:00
-1

You can download from:

http://rpm.pbone.net/index.php3/stat/3/srodzaj/1/search/ruby-devel(x86-64)

Something like this would work:

wget ftp://bo.mirror.garr.it/1/centos/7.2.1511/os/x86_64/Packages/ruby-devel-2.0.0.598-25.el7_1.x86_64.rpm
rpm -ivh ruby-devel-2.0.0.598-25.el7_1.x86_64.rpm
Scott Weldon
  • 9,673
  • 6
  • 48
  • 67