Setup your build environment(dependencies) [1]

  • macOS:
    If you haven’t done so, install Xcode Command Line Tools(xcode-select --install) and Homebrew. Then:
# optional, but recommended:
brew install openssl libyaml libffi

# required for building Ruby <= 1.9.3-p0:
brew tap homebrew/core && brew install apple-gcc42
  • Ubuntu/Debian/Mint:
# Depending on your version of Ubuntu/Debian/Mint, libgdbm5 won't be available. In that case, try with libgdbm3.
apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm5 libgdbm-dev
  • CentOS/Fedora:
# (`dnf install` on Fedora 22+) 
yum install -y gcc-6 bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel
  • OpenSUSE:
zypper install -y gcc6 automake gdbm-devel libffi-devel libyaml-devel libopenssl-devel ncurses-devel readline-devel zlib-devel
  • Arch Linux:
zypper install -y gcc6 automake gdbm-devel libffi-devel libyaml-devel libopenssl-devel ncurses-devel readline-devel zlib-devel

For more information about build environment check this

Download Ruby source code

Go to https://www.ruby-lang.org/en/downloads/ address and download the latest stable tar archive. To download Ruby version 2.5.1 click here or execute the following command.

wget https://cache.ruby-lang.org/pub/ruby/2.5/ruby-2.5.1.tar.gz

When it’s downloaded extract the archive to a folder. I’ll keep the folder name same as the archive name(ruby-2.5.1).

tar -xvf ruby-2.5.1.tar.gz

Install Ruby

When it finishes extracting change directory into ruby-2.5.1 folder and execute the following commands by the given order.[2]

./configure
make
sudo make install

Now you can check if it’s installed by executing this ruby --version. If it prints like this ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] this means you installed Ruby successfully.

Ruby Installed

Then download Ruby Gems

Go to https://rubygems.org/pages/download address and download the tar archive. To download Ruby Gems version 2.7.7 click here or execute the following command.

wget https://rubygems.org/rubygems/rubygems-2.7.7.tgz

When it’s downloaded extract the archive to a folder. I’ll keep the folder name same as the archive name(rubygems-2.7.7).

tar -xvf rubygems-2.7.7.tgz

Install RubyGems

When it finishes extracting change directory into rubygems-2.7.7 folder and execute the following command. It may need the administrator privileges(SUDO).[3]

sudo ruby setup.rb

Now you can check if RubyGems installed successfully by executing this gem --version. It will print 2.7.7 if the installation successful.

RubyGems Installed

Then Install Jekyll [4]

If you installed dependencies as instructed above then execute the following command. It may need a administrator privileges.

gem install bundler jekyll

Now you can check if Jekyll installed successfully by executing this jekyll --version. It will print jekyll 3.8.3 if the installation successful.

Ruby Installed

Reference:

  1. 1: Setup suggested build environment from https://github.com/rbenv/ruby-build/wiki#suggested-build-environment 

  2. 2: Setup instractions from ruby-lang.org 

  3. 3: Setup instractions from rubygems.org 

  4. 4: Setup instractions from jekyllrb.com