Ruby is a programming language, it was designed and developed by Yukihiro “Matz” Matsumoto in mid 1995. This article will help you to install Ruby on Rails on CentOS 7 / Ubuntu 14.10, 14.04 LTS / RHEL 7 / Fedora 22 / Fedora 21 from source.
This is the least preferable choice to install Ruby, from source code. If you are facing any difficulty in setting up ruby from source, consider to use any one method mentioned below.
Article will continue after the ad
Before installing ruby, you must install the dependent packages. As said earlier, we will be using rbenv, it provides an easy way to install and manage the versions of Ruby, and it is simpler than RVM.
### Ubuntu / LinuxMint ### $ sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev ### CentOS / Fedora ### # yum install git-core zlib zlib-devel gcc-c++ patch readline readline-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison curl sqlite-devel
Download and Install Ruby:
Download the latest Ruby from the official website, we use latest available version (2.2.2). Use following command to download directly in terminal.
cd wget http://ftp.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
Extract downloaded archive.
tar -xzvf ruby-2.2.2.tar.gz cd ruby-2.2.2/
./configure make make install
Once the Ruby is compiled, check the version of it.
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
We will install Rails 4.2.3 with this command, you can also install specific version of Rails by defining –v during installation.
gem install rails -v 4.2.3
Verify the version of rails, this will confirm us the successful installation of rails.
rails -v Rails 4.2.1
Once you have installed Ruby on Rails, we can create a test application to test it out. To do that, follow below steps.
That’s All!!!, you have successfully installed Ruby on Rails on Ubuntu / CentOS / Fedora from Source.