Other Topics, Software Technology - Development and Test Engineering, software testing

Settingup RVM on Ubuntu 14.04 – a quicker’s steps

Open terminal and get signature needed for RVM

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

Before any other step install mpapis public key (might need gpg2) (seesecurity)

gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3

For development environment

\curl -sSL https://get.rvm.io | bash

Install RVM stable with ruby:  This is you need in production

\curl -sSL https://get.rvm.io | bash -s stable --ruby

Unless doing guided install you should read all sub-sections under the RVM Section.

Install RVM (development version):

\curl -sSL https://get.rvm.io | bash

Install RVM stable with ruby:

\curl -sSL https://get.rvm.io | bash -s stable --ruby

Run source /usr/local/rvm/scripts/rvm to use RMV

Installing Specific Ruby and Rails Versions And Create Gemsets

If you need to install specific versions of Ruby for your application, you can do so with rvm like this:

rvm install ruby_version

After the installation, we can list the available Ruby versions we have installed by typing:

rvm list

We can switch between the Ruby versions by typing:

rvm use ruby_version

We can use various Rails versions with each Ruby by creating gemsets and then installing Rails within those using the normal gem commands:

rvm gemset create GEMSET_NAME    # create a gemset
rvm ruby_version@GEMSET_NAME  # specify Ruby version and our new gemset
gem install rails -v rails_version   # install specific Rails version

Further Trouble Shooting 

If you have a rails then you should have a bundle, simply run following command inside your application directory.
bundle install

one last thing when you get mysql2 native build error

then run sudo apt-get install libmysqlclient-dev

The error looks like following
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/usr/local/rvm/rubies/ruby-2.1.5/bin/ruby -r ./siteconf20141118-14609-1mklcp7.rb extconf.rb
checking for ruby/thread.h… yes
checking for rb_thread_call_without_gvl() in ruby/thread.h… yes
checking for rb_thread_blocking_region()… yes
checking for rb_wait_for_single_fd()… yes
checking for rb_hash_dup()… yes
checking for rb_intern3()… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes

Javascript Runtime Error ??

If you get an error like following that means you need to install a java run time.

2/lib/execjs/runtimes.rb:51:in `autodetect’: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)

run

sudo apt-get install nodejs
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s