Skip to main content

Basic steps to setup RVM

The next time you decide to install ruby for multiple applications, rvm is the best option to handle various versions easily. Just follow the below steps which i have compiled to make things clear and easy:


Install rvm,Ruby 1.9.2 and rails 3.0.0


Execute the commands as specified:

$ which ruby
$
$ sudo apt-get install curl git-core ruby
$ bash < <( curl https://rvm.beginrescueend.com/releases/rvm-install-head )
$ vim $HOME/.bashrc

You need to replace the line that says

       [ -z "$PS1" ] && return

with

       if [[ -n "$PS1" ]]; then

Now add this to the last line of the file

       if [[ -s $HOME/.rvm/scripts/rvm ]] ; then source $HOME/.rvm/scripts/rvm ; fi
       fi

Reload the environment by running

$ source ~/.bash_profile or restart the terminal

Now enter,
$ rvm notes

This lists the packages to be installed for various ruby flavours, install the packages under the MRI & ree section as we require 1.9.2.

$ sudo aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf

$ rvm list known
$ rvm package install readline  or use rvm pkg install readline
$ rvm install 1.9.2-head -C --with-readline-dir=$HOME/.rvm/usr
$ rvm --default 1.9.2-head
$ ruby -v
$ gem install rails

So, the installation is complete and you can start with your first project. I would suggest you to refer this link and install the basic libraries which are required by various gems when you use then in your application.

Installing on Ubuntu

These libraries needs to be installed with sudo permissions and are installed once. There are issues with bundle install which gives errors like building with native extensions and then displays the list of errors. To fix those errors just checkout the installation fails for which gem and install the libraries suggested or search the appropriate libraries.

Comments

Popular posts from this blog

Cannot allocate memory error while computing files - Setup Swap space

ActionView::Template::Error (Cannot allocate memory - nodejs /tmp/execjs20131021-26716-fckzo3.js 2>&1
Nodejs is used to compile javascript at runtime. In RoR applications, this error comes when server is started in production mode which compiles the assets or while running rake assets:precompile.
check for swap space and allocate

upload images to AWS::S3 in ruby using aws sdk gem

Using gem aws-sdk for a ROR application for uploading images to s3
Uploading images to a fixed bucket with different folders for each object or application. The s3 keeps a limitation on the number of buckets creation whereas there is no limitation for content inside a bucket. This code will upload image for a user to s3 using aws-sdk gem. The bucket and the image uploaded are made public, so that the images uploaded are directly accessible. The input is takes is the image complete path where it is present, folder in which it should be uploaded and user_id for whom it should be uploaded. def save_screenshot_to_s3(image_location, folder_name,user_id) service = AWS::S3.new(:access_key_id => ACCESS_KEY_ID, :secret_access_key => SECRET_ACCESS_KEY) bucket_name = "app-images" if(service.buckets.include?(bucket_name)) bucket = service.buckets[bucket_name] else bucket = service.buckets.create(bucket_name) …

Fresh server start after instance degraded

So the issue was, amazon issued an warning regarding the server to be terminated, before i could think of making an backup the instance stopped.

The troubleshoot operations like reboot, stop and start didn't worked.
Simple Steps to start a fresh instance with the previous content on server.