Skip to content

Instantly share code, notes, and snippets.

@jtrim
Last active July 25, 2017 03:02
Show Gist options
  • Save jtrim/bcd5d0531e44d4aec46c0d73a228227d to your computer and use it in GitHub Desktop.
Save jtrim/bcd5d0531e44d4aec46c0d73a228227d to your computer and use it in GitHub Desktop.

Installing Ruby 2.3 on Fedora 26

As of this writing (2017-07-24), Ruby 2.3.4 doesn't build on Fedora 26 because of GCC 7 and openssl 1.1 being the defaults.

Fedora 26 allows for installation of only Ruby 2.4 from the default repositories. My preference for Ruby management on Linux are chruby and ruby-install. To install Ruby 2.3 on Fedora 26 with ruby-install:

  • Download openssl 1.0.2l

  • Unpack the openssl archive, then from within the openssl dir, build and install openssl, then link the CA cert bundle and certs dir into place into the new install:

    • $ ./config --prefix=/usr/local/openssl-1.0.2l shared
    • $ sudo make install
    • $ sudo ln -nsf /etc/pki/tls/cert.pem /usr/local/openssl-1.0.2l/cert.pem
    • $ sudo ln -nsf /etc/pki/tls/certs /usr/local/openssl-1.0.2l/certs
      • Note: the --prefix argument above can be whatever you want
  • If you don't already have them installed, follow the installation instructions for chruby and ruby-install

  • Make sure you have patch installed: $ dnf install patch

  • Have a quick read through this relevant github issue on ruby-build, then:

  • $ ruby-install -p https://bugs.ruby-lang.org/attachments/download/6655/ruby_2_3_gcc7.patch ruby-2.3.4 -- --with-openssl-dir=/usr/local/openssl-1.0.2l

    • You'll be prompted to pick files to patch - there is probably a more elegant way of passing the -p0 patch argument through ruby-install, but I didn't investigate. Just type the exact path of the files you're presented to patch with and you'll be all set.

At this point, chruby 2.3.4 should work correctly, and you should have a functional ruby installed.

One important note about the openssl installation

The output from installing openssl leads me to believe that not everything it's doing is isolated to the specified --prefix directory, i.e. it's possible that some man pages are being overwritten with files from the new (old) build. I haven't investigated this fully, but if you're concerned about this, further investigation may be necessary on your part.

One last caveat

I'm no Fedora package management expert, nor an expert in Ruby or OpenSSL internals, so know that there very may well be a better way to go about all of this (and if you're aware of the specifics of a better way, please comment here!)

Proceed at your own risk.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment