08.21.2019

How to install Ruby on Rails on Centos 6 via RPM

There are many ways to install Ruby on Rails on Centos 6. Today, I will answer the question "How to install Rails 5 on Centos 6 via RPM"

First, you need to install Development Tool on your server

$ yum -y groupinstall "Development Tools"

Then install some dependencies package from EPEL

$ yum --enablerepo=epel -y install libyaml libyaml-devel readline-devel ncurses-devel gdbm-devel tcl-devel openssl-devel db4-devel libffi-devel

Now, We are ready for installing Ruby on Rails using rpmbuild

$ cd ~
$ mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
# get ruby 2.3.1 file
$ wget http://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.gz -P rpmbuild/SOURCES 
# get spec file 
$ wget https://raw.githubusercontent.com/feedforce/ruby-rpm/master/ruby.spec -P rpmbuild/SPECS --no-check-certificate
# build spec file
$ rpmbuild -bb rpmbuild/SPECS/ruby.spec
$ rpm -Uvh rpmbuild/RPMS/x86_64/ruby-*.rpm 
Preparing...                ################################### [100%]
   1:ruby                   ################################### [100%]
$ ruby -v 
$ gem -v
$ gem install bundle


Finish.
Hope it help

Leave a comment