Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Alternative for a Mac OS environment for Ruby on Rails

I'm currently on Windows and I can't seem to follow the Ruby on Rails tutorial with it. I'm planning on trying out Ubuntu as an alternative to Mac OS. Is that a good idea?

12 Answers

Gordon, I'm using http://www.turnkeylinux.org/rails. From what I can see, it is Ubuntu pre-packaged with Webmin/Virtualmin, Ruby on Rails, Apache, MySQL, and other important software libraries. I have successfully used the LAMP stack they have to run WordPress and other PHP scripts virtually but RoR is giving me a hard time on every OS.

I'm having trouble with Windows as well. The lesson just jumps into generating a rails app and moves on to scaffolding without any explanation of what's going on. I also tried using a TurnkeyLinux's Ruby on Rails virtual machine in Virtual Box, I had networking set to bridge mode, I was able to access the server through the web browser but was unable to access the default RoR app included with the installation or the Treebook RoR app I created with the command line (it was in the proper web folder /var/www/treebook).

Which parts are you struggling with?

Ugh! it's translating "pound symbols" to bold... and only putting parts into "code blocks"

If you were going to install Ubuntu (which a is great OS), I would also recommend installing the webmin/virtualmin control panel to make setting up the virtual webhosts, mail, etc. easier for you (unless your familiar with it)...

Start by getting the ISO for 12.04 LTS (Long Term Support) at http://www.ubuntu.com/download/server

then burn it to disk and either install it on a clean box, along-side your Windows, or in a VM with something like WMWare Workstation

Install ubuntu but only select Open SSH during the Install (Webmin/Virtualmin will install, and configure the LAMP stack, Postfix, Dovecot, Bind, Ruby packages etc from one script later)

Once you've got the blank OS installed do the following

  1. Log In

  2. Type hostname -f

  3. Set a static IP by typing sudo nano /etc/network/interfaces

and edit it to look something like this (Keep in mind, I just copy/pasted from one of my home ubuntu boxes... "jubuntu"... and have a Active Directory Domain controllers running, with ubuntu as my 3rd and 4th dns servers... you'll have to change the dns server names and host name to suit your needs)

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface

auto lo

iface lo inet loopback

# The primary network interface

auto eth0

# iface eth0 inet dhcp

iface eth0 inet static

        address 192.168.0.5

        netmask 255.255.255.0

        network 192.168.0.0

        broadcast 192.168.0.255

        gateway 192.168.0.1

        dns-nameservers 192.168.0.5 192.168.0.3 127.0.0.1

        dns-search lan.jiroux.com

        # dns-* options are implemented by the resolvconf package, if installed

4 Edit by typing nano /etc/hosts

and edit it to look something like

127.0.0.1       localhost

192.168.0.5    jubuntu.lan.jiroux.com jubuntu

# 127.0.1.1     jubuntu

# The following lines are desirable for IPv6 capable hosts

::1     ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters
  1. type sudo passwd root, (when prompted enter your password), (when prompted set the password for root)

  2. now you can log out and log in as root, or type sudo su -

  3. type wget http://software.virtualmin.com/gpl/scripts/install.sh

  4. execute the install script . ./install.sh

  5. sit back and watch the server get configured for you (Bind, the LAMP stack, Postfix (SMTP), Dovecot (POP & IMAP) etc...

  6. once it's done installing; with your browser go to https://<your ubuntu box ip>:10000. and answer a few questions, and your ready to setup multiple virtual hosts on your ubuntu server with a couple clicks

  7. if you want to, you can add your ubuntu box to your router's DNS server list and your computers will point to the ubuntu box for all of the virtuals on your ubuntu box. (nice for creating multiple workspaces for Treehouse projects in ubuntu)

*** One thing to note: the "Webmin" tab controls stuff at a server level, and the "Virtualmin" tab controls individual virtual hosts (websites)

I'll keep trying to format my post above properly later, so you can see the pound signs (comments) instead of them making the line go bold...

I was unable to access the RoR webrick server on Windows. I searched a lot of different stuff, even the command for starting the server. Tried localhost:3000, 127.0.0.1:3000, same things with /treebook all with no luck. Tried going the virtual machine route and while I can access the server through the web browser, the RoR app does not run. Not even the one that came with it.

I had a similar problem last year with my Mac while trying to learn RoR which ultimately led me to give up after not being able to find any help. Every tutorial or book I come across just installs RoR, creates an app, and it magically works. I know I'm missing something since 15-20 attempts on 6 different computers (Windows 7, Windows 8, OS X, and Linux) can't possibly be a coincidence.

Windows work fine for me at the moment. Will be switching to Mac as soon as I can afford it.

Mike, did you ensure mod_rewrite is enabled?

I don't have any experience with turnkeylinux's "distros"...

I install webmn/virtualmin with the installer shell script and it works out of the box for me

Edward Palomo - I'd like to +1 Mike Torosyan suggestion of using Turnkey Linux's Rails VM, it's a great time (and sanity) saver.

Gordon Jiroux -

it's translating "pound symbols" to bold... and only putting parts into "code blocks"

The forum uses markdown, so tags like <code> don't work here. Here's a great primer on how to enter code on the forum.

James Barnett I will look into that. Thanks!