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 (8.8, 8.10) have
2.5.9
- RHEL (9.2, 9.4) have
3.0.7
- SLES 12 SP5 has
2.1-1.6
- SLES 15 SP5 has
2.5-1.21
- SLES 15 SP6 has
2.5.9-15
- Ubuntu 20.04 has
2.7
- Ubuntu 22.04 has
3.0
- Ubuntu 24.04 has
3.2
The instructions provided below specify the steps to build Ruby version 3.3.4 on Linux on IBM Z following distributions:
- RHEL (8.8, 8.10, 9.2, 9.4)
- SLES (12 SP5, 15 SP5, 15 SP6)
- Ubuntu (20.04, 22.04, 24.04)
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.4/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 (8.8, 8.10, 9.2, 9.4)
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, 15 SP6)
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, 24.04)
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.4 source code
cd $SOURCE_ROOT
wget http://cache.ruby-lang.org/pub/ruby/3.3/ruby-3.3.4.tar.gz
tar zxf ruby-3.3.4.tar.gz
cd ruby-3.3.4
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