Why RVM (and not native ruby packages)
There may be debate, but I have found that for a development system, it is increadibly easy to use rvm, with it’s different ruby versions, different gemsets per project.
Install RVM
build-essential
. So this is the first package that should be installed.
$ sudo apt-get install build-essential
In addition, RVM will also need curl to download files. This is also a simple apt-get.
$ sudo apt-get install curl
Next you’re going to need a few libraries and their development package counterparts. Two of these libraries are readline, which lets you edit lines of text in bash or IRB, and zlib, which Rubygems will need to function. Also included is OpenSSL and LibXML.
$ sudo apt-get install zlib1g-dev libreadline-dev libssl-dev libxml2-dev
Now that you’re all set up, install RVM itself. This is done via a shell script which you can download and run directly with a single command.
$ \curl -L https://get.rvm.io | bash -s stable
Append the following line to your ~/.bashrc
file.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM
And then reload your bash environment (or close the terminal window and open a new one).
$ source ~/.bashrc
$ rvm requirements
Setup Ruby and Rails
$ rvm install 1.9.3
And that’s it. Remember to rvm use 1.9.3 before you start using Ruby and that’s it, Ruby is installed.
Install basic rails in this gemset.
$ gem install rails
Now make and use a gemset for rails 3.1
$ rvm gemset create rails31
$ rvm gemset use rails31
And that’s it, Ruby and Rails installed.
A list of Ubuntu package dependencies for gem ‘mysql2’
$ sudo apt-get install mysql-client mysql-server libmysqlclient-dev
Hope you find this tutorial helpful. Feel free to ask questions! Don’t forget to like or to leave a comment if its really help you.
Reblogged this on Fortune Makers and commented:
Install rails and ruby in ubuntu
LikeLike
Thank you 🙂 that was very helpful
LikeLike
Really very helpful, very nice thanks for sharing your experience. … 🙂
LikeLike
Very useful blog for beginners ..keep it up..
LikeLike