{"id":219,"date":"2013-01-07T13:44:37","date_gmt":"2013-01-07T12:44:37","guid":{"rendered":"http:\/\/oprsteny.cz\/?p=219"},"modified":"2013-01-26T12:19:16","modified_gmt":"2013-01-26T11:19:16","slug":"ruby-on-rails-on-ubuntu-12-04-lts","status":"publish","type":"post","link":"https:\/\/oprsteny.cz\/?p=219","title":{"rendered":"Ruby on Rails on Ubuntu 12.04 LTS"},"content":{"rendered":"<h3>About Ruby on Rails<\/h3>\n<hr \/>\n<p>Ruby on Rails is an application stack that provides developers with a framework to quickly create a variety of web applications.<\/p>\n<p>Ruby on Rails does take a little while to install on a virtual server, but luckily there are a lot of helpful tools to make this process as easy as possible.<!--more--><\/p>\n<p>You can run this tutorial on your droplet as a user with sudo privileges. You can check out how to set that up here:\u00a0<a title=\"Ubuntu 12 as Home server running in Virtualbox\" href=\"http:\/\/oprsteny.cz\/?p=163\">Ubuntu Server Setup<\/a><\/p>\n<h2>Step One\u2014 Install Ruby with RVM<\/h2>\n<hr \/>\n<p>Before we do anything else, we should run a quick update to make sure that all of the packages we download to our VPS are up to date:<\/p>\n<pre>sudo apt-get update<\/pre>\n<p>Once that&#8217;s done, we can start installing RVM, Ruby Version Manager. This is a great program that lets you use several versions of Ruby on one server; however, in this case, we will just use it to install the latest version of Ruby on the droplet.<\/p>\n<p>If you do not have curl on your system, you can start by installing it:<\/p>\n<pre>sudo apt-get install curl<\/pre>\n<p>To install RVM, open terminal and type in this command:<\/p>\n<pre>curl -L get.rvm.io | bash -s stable<\/pre>\n<p>After it is done installing, load RVM.<\/p>\n<pre>source ~\/.rvm\/scripts\/rvm<\/pre>\n<p>In order to work, RVM has some of its own dependancies that need to be installed. You can see what these are:<\/p>\n<pre>rvm requirements<\/pre>\n<p>In the text that RVM shows you, look for this paragraph.<\/p>\n<pre>Additional Dependencies:\r\n# For Ruby \/ Ruby HEAD (MRI, Rubinius, &amp; REE), install the following:\r\n  ruby: \/usr\/bin\/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion<\/pre>\n<p>Just follow the instructions to get your system up to date with all of the required dependancies.<\/p>\n<pre>rvmsudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion<\/pre>\n<h2>Step Two\u2014Install Ruby<\/h2>\n<hr \/>\n<p>Once you are using RVM, installing Ruby is easy.<\/p>\n<pre>rvm install 1.9.3<\/pre>\n<p>Ruby is now installed. However, since we accessed it through a program that has a variety of Ruby versions, we need to tell the system to use 1.9.3 by default.<\/p>\n<pre>rvm use 1.9.3 --default<\/pre>\n<h2>Step Three\u2014Install RubyGems<\/h2>\n<hr \/>\n<p>The next step makes sure that we have all the required components of Ruby on Rails. We can continue to use RVM to install gems; type this line into terminal.<\/p>\n<pre> rvm rubygems current<\/pre>\n<h2>Step Four\u2014Install Rails<\/h2>\n<hr \/>\n<p>Once everything is set up, it is time to install Rails.<\/p>\n<p>To start, open terminal and type in:<\/p>\n<pre>gem install rails<\/pre>\n<p>This process may take a while, be patient with it. Once it finishes you will have Ruby on Rails installed on your droplet.<\/p>\n<h2>Step Five \u2014 Deploying Rails application on web<\/h2>\n<p>If you want to run Rails application on Apache web server, I&#8217;d recommand using gem Phussion Passenger as so called &#8220;middleware&#8221;.<\/p>\n<pre>gem install passenger<\/pre>\n<pre>passenger-install-apache2-module<\/pre>\n<p>&#8230;and follow instructions during processing (install required dependencies using sudo apt-get &lt;dependencies&gt; and update httpd.conf directives for apache web server to load passenger modules)<\/p>\n<p>Make a symbolic link from your rails application&#8217;s &#8216;PUBLIC&#8217; folder to web server:<\/p>\n<pre>ln -s \/home\/rails\/rails_app\/public \/var\/www\/subdomains\/rails_app<\/pre>\n<p>Create virtual host in your Apache with at least the following settings<\/p>\n<pre>DocumentRoot \/var\/www\/subdomains\/rails_app\r\nRailsEnv development\r\n&lt;Directory \"\/var\/www\/subdomains\/rails_app\"&gt;\r\n  Options Indexes FollowSymLinks -MultiViews +ExecCGI\r\n  AllowOverride All\r\n  Order allow,deny\r\n  allow from all\r\n&lt;\/Directory&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>About Ruby on Rails Ruby on Rails is an application stack that provides developers with a framework to quickly create a variety of web applications. Ruby on Rails does take a little while to install on a virtual server, but &hellip; <a href=\"https:\/\/oprsteny.cz\/?p=219\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[9,45,50,38,5],"tags":[],"class_list":["post-219","post","type-post","status-publish","format-standard","hentry","category-development","category-linux","category-ruby","category-software","category-tools"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3nYbe-3x","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/219","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=219"}],"version-history":[{"count":4,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/219\/revisions"}],"predecessor-version":[{"id":230,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=\/wp\/v2\/posts\/219\/revisions\/230"}],"wp:attachment":[{"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=219"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=219"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/oprsteny.cz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=219"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}