Finally - Setting up Rails!
Posted by Pat Thu, 25 Aug 2005 04:43:00 GMT
Getting started with Rails on FreeBSD
As I said in my Intro to FLPR, I think Rails was made to be on FreeBSD. It just works so well, and as you’ll see installation is a snap. Right now we’re going to install RubyGems, and then install a few of the gems you’ll need to run Rails. Some we’ll install from gems, stome we’ll install from ports. Enough talk.
Installing RubyGems
This is a snap. Just install the port.# cd /usr/ports/devel/ruby-gems && make install clean# gem --version
0.8.11# gem install railsnote: I had previously showed how to install the ruby-postgres adapter through ports. Now you should install the postgres adapter as a gem .
# cd /usr/ports/www/ruby-fcgi/ && make install clean
# cd /usr/ports/converters/ruby-iconv/ && make install cleanGet a Rails app going
Just to see that we got Rails installed, let’s start up a Rails app. We’re just going to create a new app and start the included Webrick server to see that it runs.$ rails myapp
$ ./myapp/script/serverThat’s all we’re going to do as far as setting up Rails. Time to move on to lighttpd and finish up the qua…diad?





Hi Pat,
Great series of posts. I’ve been following (as you’ve been posting) and I’ve run into a couple of questions:
- What is the need for recompiling the kernel? I’ve skipped this part as I don’t need PF.
- I am getting gem 0.8.6 instead of 0.8.11. Any ideas why? Fress 5.4 install, and I’ve followed everything you’ve posted so far, except for the kernel bit.
Cheers,
—John
Hey John,
The reason for upgrading the kernel and userland is for security.
When you first install FreeBSD, you get kernel version 5.4-RELEASE. Since then, the FreeBSD Security Team has patched a number of holes they found (don’t worry though, FreeBSD is not riddled with vulnerabilities). You can find more info at the FreeBSD Security Page. The latest secure build is 5.4-RELEASE-p6. Once you upgrade to the latest version, you only need to upgrade whenever a new security advisory is announced. You can find out about these by signing up to the (very low-volume) FreeBSD-security-notifications@FreeBSD.org mailing list.
I think you got the old gem because of a typo in my ports updating post…in the section on installing portsnap, I incorrectly wrote one of the commands as “portsnap update”. That works fine – after you’ve got the ports tree installed the first time. The first time around though, it should be “portsnap fetch && portsnap extract”. Try doing that, then “portupgrade -a” to upgrade all your ports.
Pat
Have you seen
/usr/ports/www/rubygem-rails ?
This will install rails (+ all the action/active gems) and rake. Further the is a port for typo (/usr/ports/www/typo). Currently its version is 1.6.8 as the ports tree is frozen.
After the freeze I will update the port to 2.5.5
Hey Jonathon,
Yeah, I saw there was a rails port. To be honest, I’m not sure exactly what it does because I find it quite easy to just install Rails via gem. In general, if I can get it from gems instead of ports, I will. The exception is when I need something lower-level that I want to be native, instead of written in Ruby (as is the case with the Postgres adapter), then I’ll install from ports.
Great to hear that typo’s a port as well. I think I noticed it a while ago but dismissed it because it was an old version. Thanks for bringing it to my attention.
Pat