Rails 3 on Ubuntu 10.4 with a side of RVM
Jul. 8th, 2010 10:30 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
![[community profile]](https://www.dreamwidth.org/img/silk/identity/community.png)
Hey Ruby folks. I wrote this up the other day, after being disappointed by all the other tutorials out there. Now I am sharing, with you!
This isn't 100% newbie friendly, but if you're comfy enough in the command line or you don't want to deviate too much from what I've presented you should be fine. Please note that this is Rails 3 which is still in beta, it can be a bit of a moving target.
* See Other Notes at the bottom for some modifications for gedit to be more like Textmate, handy for Linux users!
Rails 3 on Ubuntu 10.4 with a side of RVM
As an actual Rails 3 release candidate draws near I thought it was time to make a go at this shiny new toy. I've decided to go with RVM to help me manage and isolate both rubies and gems. Check it out, thank me later.
I started with a very bare Ubuntu 10.4 install so I think I got everything, if you find you're missing any packages please let me know. All of this is typed into your command line.
First lets get rolling with RVM:
This will install RVM, and give you some directions on how it'd like you to modify your .bashrc file. I started with a minimally modified .bashrc file and was fine with the directions provided. DO THIS NOW. We'll be using rvm immediately.
Will give you information on which packages it wants to work on what kind of rubies, if you're going for either 1.8.7 or 1.9.2 (like I did, later on) you'll need to install a fair mess of packages.
To install any MRI head (such as 1.9.2-head) you also need ruby and rubygems:
Now we'll use RVM to install Ruby 1.9.2-head (AFAIK, the best option for Rails 3):
Then we'll create a gemset for our new project. Please note that the @rails3 designates a gemset, you might have better luck creating one gemset per project instead. I've only been doing some very simple things trying out rails.
Now we can get to the fun part, putting rails into our shiny new gemset:
As of this writing you should get 'Rails 3.0.0.beta4' out of this command. If you're getting some other error, such as command not found, something hasn't installed or configured right. You probably have an error in your scrollback buffer somewhere.
Create your new rails 3 app:
And now you're rolling on Rails 3... be sure to check out bundler and the new rails command.
Other Notes:
* If you want to user cucumber (and I suggest you do) make sure you install libxslt-dev
* Get a nice editor for ruby/rails using the already installed gedit:
Then enable your new plugins inside gedit.
This isn't 100% newbie friendly, but if you're comfy enough in the command line or you don't want to deviate too much from what I've presented you should be fine. Please note that this is Rails 3 which is still in beta, it can be a bit of a moving target.
* See Other Notes at the bottom for some modifications for gedit to be more like Textmate, handy for Linux users!
Rails 3 on Ubuntu 10.4 with a side of RVM
As an actual Rails 3 release candidate draws near I thought it was time to make a go at this shiny new toy. I've decided to go with RVM to help me manage and isolate both rubies and gems. Check it out, thank me later.
I started with a very bare Ubuntu 10.4 install so I think I got everything, if you find you're missing any packages please let me know. All of this is typed into your command line.
First lets get rolling with RVM:
$ sudo aptitude install git-core curl
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
This will install RVM, and give you some directions on how it'd like you to modify your .bashrc file. I started with a minimally modified .bashrc file and was fine with the directions provided. DO THIS NOW. We'll be using rvm immediately.
$ rvm notes
Will give you information on which packages it wants to work on what kind of rubies, if you're going for either 1.8.7 or 1.9.2 (like I did, later on) you'll need to install a fair mess of packages.
$ sudo aptitude install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline5-dev libreadline6-dev libxml2-dev git-core subversion autoconf
To install any MRI head (such as 1.9.2-head) you also need ruby and rubygems:
$ sudo aptitude install ruby rubygems
Now we'll use RVM to install Ruby 1.9.2-head (AFAIK, the best option for Rails 3):
$ rvm install 1.9.2-head
Then we'll create a gemset for our new project. Please note that the @rails3 designates a gemset, you might have better luck creating one gemset per project instead. I've only been doing some very simple things trying out rails.
$ rvm --create use 1.9.2-head@rails3
Now we can get to the fun part, putting rails into our shiny new gemset:
$ gem install rails --pre
$ rails --version
As of this writing you should get 'Rails 3.0.0.beta4' out of this command. If you're getting some other error, such as command not found, something hasn't installed or configured right. You probably have an error in your scrollback buffer somewhere.
Create your new rails 3 app:
$ rails new my_app
And now you're rolling on Rails 3... be sure to check out bundler and the new rails command.
Other Notes:
* If you want to user cucumber (and I suggest you do) make sure you install libxslt-dev
$ sudo aptitude install libxslt-dev
* Get a nice editor for ruby/rails using the already installed gedit:
$ sudo apt-add-repository ppa:ubuntu-on-rails/ppa
$ sudo apt-get update
$ sudo apt-get install gedit-gmate
Then enable your new plugins inside gedit.