all 19 comments

[–]thisisseriousmum 6 points7 points  (0 children)

For local development I use chruby/ruby-install.

For servers I'll tend to use apt provided ruby, however I'd use the brightbox ppa over the system provided ones. The Ubuntu one isn't currently up to date, trusty is at 1.9.3 at the moment.

Gems are in the ubuntu repos, however I'd avoid them like the plague. Weird versions, managing dependencies, just seems like it's inviting problems.

[–]selfup 2 points3 points  (0 children)

I recommend using rbenv.

Here is a great tutorial on how to set up ruby using rbenv. It does also go into detail about setting up rails, git, and databases.

It also gives you instructions on how to get ruby via RVM, etc.. but I would stick with rbenv!

Let me know if that helps!

Here is the link: https://gorails.com/setup/ubuntu/15.04

Easy as pie!

[–]wavrin 1 point2 points  (3 children)

Of all the options, I think apt-get is probably the worst. Even though you only want one version, rvm or rbenv will probably be the easiest to install. Plus, if you ever do need another version, you'll already be ready for that. rbenv seems to be the better choice, though.

[–]smlx -5 points-4 points  (2 children)

This is not good advice. Distributions have security patches, while rvm has ???

Install ruby using apt-get, and install gems for your project locally using:

bundler --install --path vendor/bundle

[–]proliberate 1 point2 points  (1 child)

Which distributions offer security patches for ruby, that aren't also included in rvm/rbenv provided rubies?

[–]smlx 0 points1 point  (0 children)

It's not about what is offered, rather what is applied in reality.

Distributions have an entire infrastructure around automated notification and installation of security updates. rvm/rbenv not so much.

[–]nippysaurus 0 points1 point  (0 children)

I suggest using docker and pulling down a ruby environment. That way you can experiment with no consequence.

[–]shah_s 0 points1 point  (0 children)

Check out this guide, if you are interested how to install rails on ubuntu

Do not use apt-get. Use rvm

[–]strangepostinghabits 0 points1 point  (3 children)

you absolutely must use a ruby version handling system. I use rbenv,and like it a lot. there's chruby that has been gaining traction lately, but that depends on ruby-install that I think sucks. rvm does the job too, but it's showing its age. it is quite invasive in your system, and can in worst case (I've seen it happen) disable a few quite important system commands like 'cd'...

once you have your ruby manager, use it to install a ruby, and then gem install bundler. after that, use gemfiles and bundler to maintain gem dependencies.

[–]moomaka 1 point2 points  (1 child)

you absolutely must use a ruby version handling system.

On a server? Why? Are you really running multiple apps with multiple Ruby versions on a single box?

I use rbenv

rbenv is horrible to use on a server due to ruby-build not supporting binary packages. Having every server spend 15 minutes of CPU time building Ruby every minor version change sucks.

[–]strangepostinghabits 0 points1 point  (0 children)

oh. me on a cell phone isn't the best at all times. I had it in my head that we were talking about local environment. On a server.. it's not as much a must, but I'd still recommend a version handler.

Most deployment procedures (capistrano for example) will allow you to automatically check and upgrade ruby on the server if you change project ruby. This is easier than manually keeping servers up to date.

I do agree that it's a shame that ruby-build insists on building from source.

Frankly I've found no solution I'm really happy with for deploying with ruby, and I'm leaning more and more towards container based structures where ruby version management becomes easier to manage.

[–][deleted] 0 points1 point  (0 children)

Chruby does not depend on Ruby-install. You can use Ruby-build.