In the spirit of (and cribbing from) notes that Alan D. Jackson made while setting up Rails 3 on Windows with Ubuntu on a VM, here's my experience doing the same thing:
- If you don't have it already, download and install Putty or Cygwin for the ssh client
- Download VirtualBox for Windows Hosts. Based on this comparison of VMs, VirtualBox is the best choice for this application.
- Install VirtualBox. I installed version 4.1.12.
- Not knowing any better, I left all of the defaults selected. We'll soon see if that was the right choice.
- The install wizard proceeded as expected. Let it start VirtualBox.
- Download the latest Ubuntu ISO file.
- Hrm, first question. I'm running Windows 7 64-bit, so I guess that means I want 64-bit Ubuntu? I don't know, the VirtualBox setup wizard lets me select either 32- or 64-bit. However, the Ubuntu download page recommends 32-bit. I'll go with the 32-bit for now.
- Set up a new VM
- Click the "New" VM button, name it "Rails 3.2 on Ubuntu". Helpfully VB selects Ubuntu from the OS list.
- Memory: the default is 512Mb. Alan recommends 384. Since I have 3Gb available, I'll splurge on 512Mb.
- Virtual Hard Disk: create a new 8Gb disk.
- Virtual Disk Creation Wizard: leave the default "VDI" selected as recommended
- Virtual Disk Storage Details: leave the default "Dynamically allocated" selected as recommended
- Virtual Disk File Location and Size: leave the default values selected
- Review the Summary, then click Create
- File -> Virtual Media Manager
- Select CD/DVD Images
- Add the Ubuntu ISO image
- click Close
- Select the new VM image -> Settings
- Storage
- Storage Tree: Select IDE Controller -> Empty
- Attributes: click the tiny little CD image to right of the "CD/DVD Drive" dropdown and select the ubuntu ISO image
- Network
- Select Adapter 2 tab
- Check Enable Network Adapter
- Select Host-only Adapter
- Click OK
- Start the VM, then select "Install Ubuntu".
- Let the Ubuntu installer do its thing, then reboot the VM.
- After the VM reboots, install guest additions to get shared folder?
- Install samba (Windows file sharing)
- sudo apt-get install samba samba-common
- sudo apt-get install python-glade2
- sudo apt-get install system-config-samba
- Open Samba Server Configuration from Ubuntu desktop -> Dash home -> Applications -> Samba
- In Samba Server Configuration, select File -> Add Share -> Basic
- Directory: /home/[your name]
- Leave share name and description as is
- Select Writable and Visible
- On the Access tab, select Allow access to everyone. You'll still have to logon as the user from Windows
- In Preferences -> Server Settings,
- change the workgroup name to your PC's workgroup name. You can find the Windows workgroup name in the Windows "System" control panel
- Leave all of the other settings at their defaults.
- In Preferences -> Samba Users, you might have to set the Samba password for the user account
- Close Samba
- In windows, browse to \\server\user (e.g. \\ubuntu\philip), then enter the username/password when prompted
- Install Open SSH Server
- sudo apt-get install openssh-server
- ssh from Windows desktop via Cygwin or Putty: ssh you@your_ubuntu
- Create a .bash_profile file to source .bashrc for aliases, etc. when you log in via ssh:
if [ -f ~/.bashrc ]; then
. ~/bashrc
fi - Dev setup
- Install aptitude (if needed): sudo apt-get install aptitude
- Install basic packages: sudo aptitude -y install curl git-core build-essential zlib1g-dev libssl-dev libyaml-dev libreadline5-dev sqlite3 libsqlite3-dev autoconf automake nodejs
- Install rvm (Ruby Version Manager)
- curl -L get.rvm.io | bash -s stable
- Reload shell (or close and reopen it): source ~/.bash_profile
- Add rvm setup to .bashrc file:
- if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then source "$HOME/.rvm/scripts/rvm" ; fi
- Install Ruby and Rails. Insert the latest version numbers:
rvm install 1.9.3 && rvm --default ruby-1.9.3 && gem install rails sqlite3 - Smoke test:philip@ubi:~$ ruby -v && rails -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [i686-linux]
Rails 3.2.3 - Create a Rails test site:
- mkdir ~/sites && cd ~/sites
- rails new rails_app && cd rails_app && rails s
- Browse to http://yoursite:3000/, if all goes well you'll see the default Rails home page
- Make Rails faster! Edit this setting in ~/.rvm/rubies/ruby-1.9.X-pXXX/lib/ruby/1.9.X/webrick/config.rb to speed up browsing the rails app from the Windows host:# :DoNotReverseLookup => nil,
:DoNotReverseLookup => true, - Now the app can be edited from the Samba share on Windows.