Skip to content

Building Ruby on Rails

aborkar-ibm edited this page Mar 28, 2022 · 77 revisions

Building Ruby on Rails

Below versions of Ruby on Rails are available in respective distributions at the time of creation of these build instructions:

  • Ubuntu 18.04 has 4.2.10
  • Ubuntu 20.04 has 5.2.3
  • Ubuntu 21.10 has 6.0.3.7
  • SLES 15 SP3 has 5.1.4

The instructions provided below specify the steps to build Rails version 7.0.2.3 on Linux on IBM Z for following distributions:

  • RHEL (7.8, 7.9, 8.2, 8.4, 8.5)
  • SLES (12 SP5, 15 SP3)
  • Ubuntu (18.04, 20.04, 21.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.

Step 1: Build Ruby

1.1) Build Ruby

  • Building Ruby (For RHEL (7.8, 7.9, 8.2, 8.4, 8.5) , SLES 12 SP5)

1.2) Correct the gem environment for a standard user

  • RHEL (7.8, 7.9, 8.2, 8.4, 8.5) , SLES (12 SP5, 15 SP3) , Ubuntu 18.04
       export GEM_HOME=$HOME/.gem/ruby
       export PATH=$HOME/.gem/ruby/bin:$PATH
    

Step 2: Install Ruby on Rails

2.1) Add build dependencies

  • RHEL (7.8, 7.9)

    sudo yum install -y patch make gcc  gcc-c++ npm 
    
  • Install sqllite 3.8 (Only for RHEL 7.x)

    wget https://www.sqlite.org/2019/sqlite-autoconf-3280000.tar.gz
    tar zxvf sqlite-autoconf-3280000.tar.gz
    cd sqlite-autoconf-3280000
    ./configure
    make
    sudo make install
    sqlite3 --version
  • RHEL (8.2, 8.4, 8.5)

    sudo yum groupinstall -y 'Development Tools'
    sudo yum install -y zlib zlib-devel ruby-devel patch gcc-c++ npm sqlite-devel
    
  • SLES 12 SP5

    sudo zypper install -y bison flex libopenssl-devel libyaml-devel libffi48-devel readline-devel zlib-devel gdbm-devel ncurses-devel tcl-devel tk-devel sqlite3-devel gcc make wget shared-mime-info tar  gcc-c++ libxslt-devel npm14 timezone 
    
  • SLES 15 SP3

    sudo zypper install -y gcc zlib-devel gawk make patch tar gzip shared-mime-info sqlite-devel gcc-c++ libxslt-devel npm14	
    
  • Ubuntu (18.04, 20.04)

    sudo apt-get update
    sudo apt-get install -y ruby ruby-dev make gcc zlib1g-dev patch build-essential libsqlite3-dev  npm tzdata
    
  • Ubuntu 21.10

    sudo apt-get update
    sudo apt-get install -y ruby ruby-dev make gcc zlib1g-dev patch ruby-nokogiri build-essential libsqlite3-dev  npm tzdata
    

2.2) Install Ruby on Rails via gem

   sudo gem install rake                  # For Ubuntu
   gem install rails -v 7.0.2.3             # For RHEL and SLES 12.x
   sudo gem install rails -v 7.0.2.3        # For Ubuntu
   sudo gem install rails -v 7.0.2.3 -- --use-system-libraries	#For SLES 15.x

2.3) Ruby on Rails is now installed. Verify version with command rails -v

  • (Output)

    Rails 7.0.2.3

2.4) Verification

  • Install NodeJS

    cd $SOURCE_ROOT
    wget  https://nodejs.org/download/release/v16.3.0/node-v16.3.0-linux-s390x.tar.gz
    tar xvf node-v16.3.0-linux-s390x.tar.gz
    export PATH=$SOURCE_ROOT/node-v16.3.0-linux-s390x/bin:$PATH
    node -v
  • Install required dependencies

    sudo gem install  bundler  # For Ubuntu and SLES 15.x
    gem install bundler  # For RHEL 7.x and SLES 12.x
    sudo npm install -g yarn
  • Create a new Rails application and start the web server

    rails new myapp
    cd myapp/
    bin/rails server &
  • After starting Rails server, go to http://localhost:3000

    curl http://127.0.0.1:3000 

References:

Clone this wiki locally