Building Ruby - linux-on-ibm-z/docs GitHub Wiki
Building Ruby
Below versions of Ruby are available in respective distributions at the time of creation of these build instructions:
- RHEL (7.8, 7.9) have
2.0.0.648
- RHEL (8.6, 8.8, 8.9) have
2.5.9
- RHEL (9.0, 9.2, 9.3) have
3.0.4
- SLES 12 SP5 has
2.1-1.6
- SLES 15 SP5 has
2.5-1.21
- Ubuntu 20.04 has
2.7
- Ubuntu 22.04 has
3.0
- Ubuntu 23.10 has
3.1
The instructions provided below specify the steps to build Ruby version 3.3.1 on Linux on IBM Z following distributions:
- RHEL (7.8, 7.9, 8.6, 8.8, 8.9, 9.0, 9.2, 9.3)
- SLES (12 SP5, 15 SP5)
- Ubuntu (20.04, 22.04, 23.10)
General Notes:
-
When following the steps below please use a standard permission user unless otherwise specified.
-
A directory
/<source_root>/
will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
1. Build using script
If you want to build Ruby using manual steps, go to STEP 2.
Use the following commands to build Ruby using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Ruby/3.3.1/build_ruby.sh
# Build Ruby
bash build_ruby.sh [Provide -t option for executing build with tests]
If the build completes successfully, go to STEP 7. In case of error, check logs
for more details or go to STEP 2 to follow manual build steps.
2. Install dependencies
export SOURCE_ROOT=/<source_root>/
-
RHEL (7.8, 7.9)
sudo subscription-manager repos --enable=rhel-7-server-for-system-z-rhscl-rpms sudo yum install -y devtoolset-7-gcc-c++ devtoolset-7-gcc bison flex openssl-devel readline-devel gdbm-devel gcc make wget tar libyaml-devel source /opt/rh/devtoolset-7/enable
-
RHEL (8.6, 8.8, 8.9, 9.0, 9.2, 9.3)
sudo yum install -y bison flex openssl-devel readline-devel gdbm-devel gcc make wget tar libyaml-devel
-
SLES (12 SP5)
sudo zypper install -y bison flex libopenssl-devel readline-devel gdbm-devel gcc7 make wget tar gzip gawk libyaml-devel sudo ln -sf /usr/bin/gcc-7 /usr/bin/gcc sudo ln -sf /usr/bin/gcc /usr/bin/cc
-
SLES (15 SP5)
sudo zypper install -y bison flex libopenssl-devel readline-devel gdbm-devel gcc make wget tar gzip gawk libyaml-devel
-
Ubuntu (20.04, 22.04, 23.10)
sudo apt-get update sudo apt-get install -y gcc make wget tar bison flex openssl libssl-dev libdb-dev libgdbm-dev libreadline-dev libyaml-dev
3. Download Ruby 3.3.1 source code
cd $SOURCE_ROOT
wget http://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.1.tar.gz
tar zxf ruby-3.3.1.tar.gz
cd ruby-3.3.1
4. Configure and Build Ruby
./configure
make
5. Install Ruby
sudo make install
Note: Add /usr/local/bin
to PATH environment variable if not already present
6. Test the results (optional)
make test
Note: The tests should not report any failures
7. Verify Ruby
ruby -v
gem env
Note: Rubygems support is contained as part of this build, so gem env
should work