{"id":154,"date":"2017-03-17T00:00:00","date_gmt":"2017-03-17T04:00:00","guid":{"rendered":"http:\/\/www.dev-notes.com\/blog\/2017\/03\/17\/how-to-install-rails-on-centos-7\/"},"modified":"2018-03-11T21:42:14","modified_gmt":"2018-03-12T01:42:14","slug":"how-to-install-rails-on-centos-7","status":"publish","type":"post","link":"https:\/\/www.dev-notes.com\/blog\/2017\/03\/17\/how-to-install-rails-on-centos-7\/","title":{"rendered":"How to Install Rails on CentOS 7"},"content":{"rendered":"<p>Install prerequisite dependencies<\/p>\n<pre class=\"code\">$ sudo yum install -y 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\r\n<\/pre>\n<p>Install rbenv<\/p>\n<pre class=\"code\">$ git clone https:\/\/github.com\/rbenv\/rbenv.git ~\/.rbenv\r\n$ cd ~\/.rbenv &amp;&amp; src\/configure &amp;&amp; make -C src\r\n$ echo 'export PATH=$HOME\/.rbenv\/bin:$PATH' &gt;&gt; ~\/.bash_profile\r\n<\/pre>\n<p>Run rbenv init, and follow the instructions.<\/p>\n<pre class=\"code\">$ rbenv init\r\n# Load rbenv automatically by appending\r\n# the following to ~\/.bash_profile:\r\n\r\neval \"$(rbenv init -)\"\r\n<\/pre>\n<p>Restart your shell.<\/p>\n<p>Install ruby-build plugin to get access to rbenv install.<\/p>\n<pre class=\"code\">$ git clone https:\/\/github.com\/rbenv\/ruby-build.git ~\/.rbenv\/plugins\/ruby-build\r\n<\/pre>\n<p>Finally, install ruby, and confirm version.<\/p>\n<pre class=\"code\">$ rbenv install 2.2.2\r\n...\r\n$ ruby -v\r\nruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]\r\n<\/pre>\n<p>Confirm sqlite3 is installed<\/p>\n<pre class=\"code\">$ sqlite3 --version\r\n3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668\r\n<\/pre>\n<p>Install rails using gem.<br \/>\nNOTE: I originally had some trouble running this command because the version of ruby kept going back to 2.0.0, which is the default version for my installation of CentOS. I had to manually add a .ruby-version file into my working directory with the contents 2.2.2 in order for the gem command to proceed with the rails installation. I don&#8217;t know if this is the correct way of doing this.<\/p>\n<pre class=\"code\">$ gem install rails\r\n...\r\n$ rails --version\r\nRails 5.0.0.1\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This article will show the steps to install Ruby on Rails on CentOS 7.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,28,41],"tags":[],"class_list":["post-154","post","type-post","status-publish","format-standard","hentry","category-centos","category-linux","category-ruby-on-rails"],"_links":{"self":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/comments?post=154"}],"version-history":[{"count":1,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/154\/revisions"}],"predecessor-version":[{"id":160,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/posts\/154\/revisions\/160"}],"wp:attachment":[{"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/media?parent=154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/categories?post=154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dev-notes.com\/blog\/wp-json\/wp\/v2\/tags?post=154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}