{"id":1631,"date":"2011-04-29T11:15:36","date_gmt":"2011-04-29T03:15:36","guid":{"rendered":"http:\/\/hazelong.com\/?p=1631"},"modified":"2011-05-04T16:54:48","modified_gmt":"2011-05-04T08:54:48","slug":"deploying-rails-centos-5-ruby-gems-rails","status":"publish","type":"post","link":"https:\/\/musenmaker.com\/hazelong\/?p=1631","title":{"rendered":"Deploying Rails to Centos 5 : Ruby, Gems &#038; Rails"},"content":{"rendered":"<p>Hi there, if you have been following this series you would roughly know that I am trying to setup a remote Centos server to house my rails apps. After installing <a href=\"http:\/\/hazelong.com\/?p=1618\">Apache<\/a>, <a href=\"http:\/\/hazelong.com\/?p=1622\">mySQL<\/a> and <a href=\"http:\/\/hazelong.com\/?p=1625\">Git<\/a>, we are now ready to install Ruby, RubyGems &amp; Rails.<\/p>\n<p><strong>Deploying Rails to Centos 5<\/strong><\/p>\n<ul>\n<li><a href=\"http:\/\/hazelong.com\/?p=1618\"><strong>Part 1 \/\/ Apache<\/strong><\/a><\/li>\n<li><a href=\"http:\/\/hazelong.com\/?p=1622\"><strong>Part 2 \/\/ mySQL<\/strong><\/a><\/li>\n<li><strong><a href=\"http:\/\/hazelong.com\/?p=1625\">Part 3 \/\/ Git<\/a><\/strong><\/li>\n<li><strong>You are here!<\/strong><\/li>\n<li><strong><a href=\"http:\/\/hazelong.com\/?p=1634\">Part 5 \/\/ Passenger<\/a><\/strong><\/li>\n<li><strong><a href=\"http:\/\/hazelong.com\/?p=1637\">Part 6 \/\/ Gitosis<\/a><\/strong><\/li>\n<li><strong><a href=\"http:\/\/hazelong.com\/blog\/2011\/05\/04\/deploying-rails-centos-capistrano\/\">Part 7 \/\/ Capistrano<\/a><\/strong><\/li>\n<\/ul>\n<p>As I like to have multiple versions of Ruby in my system, I am going to install RVM to handle them. But before all that, we should check if ruby already exists. SSH into your remote server and run [shell] ruby -v[\/shell]If terminal shoots you back with a Ruby version number you already have Ruby installed and you should move on to installing rails.<\/p>\n<p>Let&#8217;s install <a href=\"https:\/\/rvm.beginrescueend.com\/rvm\/install\/\">RVM<\/a> by running this: [shell]$ bash &lt; &lt;(curl -s https:\/\/rvm.beginrescueend.com\/install\/rvm)[\/shell]<\/p>\n<p>When you are done installing, you should edit your <code>.bash_profile<\/code> To do just that, [shell] vim ~\/.bash_profile[\/shell] Hit I to edit the file and paste in the following:[shell][[ -s &#8220;$HOME\/.rvm\/scripts\/rvm&#8221; ]] &amp;&amp; source &#8220;$HOME\/.rvm\/scripts\/rvm&#8221; # This loads RVM into a shell session.[\/shell]<\/p>\n<p>Now, hit ESC to exit editing mode and SHIFT+Z twice to get out of vim. After this, you should log out of ssh and then log back in again to refresh the session.<\/p>\n<p>When you are back in again, run this [shell]type rvm | head -1[\/shell] and they should reply with this: [shell] rvm is a function[\/shell] If it doesn&#8217;t it means that the <code>.bash_profile<\/code> isn&#8217;t updated yet.<\/p>\n<p>[shell] rvm notes[\/shell]<br \/>\nRun this to see if you missed any dependencies for installing ruby. The missing dependencies should be listed out for you. Just follow the instructions before proceeding.<\/p>\n<p>Now you can finally install Ruby, [shell]rvm get head<br \/>\nrvm reload<br \/>\nrvm install 1.8.7<br \/>\nrvm install 1.9.2[\/shell]<\/p>\n<p>Create a separate gemset for all your ruby versions by running: [shell]<br \/>\nrvm &#8211;create 1.8.7<br \/>\nrvm &#8211;create use 1.9.2<br \/>\n[\/shell]<\/p>\n<p>And make one of them your default by typing [shell]rvm &#8211;default use 1.9[\/shell] You can also check if ruby is installed by running [shell] ruby -v[\/shell] They should be using your default version that you just set.<\/p>\n<p>The good thing about installing RVM is that they automatically include RubyGems for you already. To check this fact, [shell] which gem<br \/>\n\/Users\/mhartl\/.rvm\/rubies\/ruby-head\/bin\/gem[\/shell]<\/p>\n<p>Now you can install Rails!<br \/>\n[shell]gem install rails &#8211;version 3.0.6[\/shell]<br \/>\nCheck if it is installed by running [shell] rails -v[\/shell]<\/p>\n<p>Now you can has rails. Woot.<br \/>\nNext, we will <strong>set up a test application for rails to try and make it work with Passenger.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi there, if you have been following this series you would roughly know that I am trying to setup a remote Centos server to house my rails apps. After installing Apache, mySQL and Git, we are now ready&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1776],"tags":[1840,1845,1836,1835,1841,1844,1847,1843,1788,1842,1848,1849],"class_list":["post-1631","post","type-post","status-publish","format-standard","hentry","category-coding-tutorials","tag-apache","tag-capistrano","tag-centos","tag-deploying","tag-git","tag-gitosis","tag-mysql","tag-passenger","tag-rails","tag-ruby","tag-rubygems","tag-rvm"],"acf":[],"_links":{"self":[{"href":"https:\/\/musenmaker.com\/hazelong\/index.php?rest_route=\/wp\/v2\/posts\/1631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/musenmaker.com\/hazelong\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/musenmaker.com\/hazelong\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/musenmaker.com\/hazelong\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/musenmaker.com\/hazelong\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1631"}],"version-history":[{"count":0,"href":"https:\/\/musenmaker.com\/hazelong\/index.php?rest_route=\/wp\/v2\/posts\/1631\/revisions"}],"wp:attachment":[{"href":"https:\/\/musenmaker.com\/hazelong\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/musenmaker.com\/hazelong\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/musenmaker.com\/hazelong\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}