This repository is obsolete. Please go to https://github.com/jhsu802701/vagrant-debian-jessie .
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
shared
.gitignore
FAQ.md
README.md
Vagrantfile
changelog.txt
download_new_base.sh
install_local_box.sh
login.sh
reboot.sh
rebuild.sh

README.md

A Virtual Machine for Getting Started with Ruby on Rails

This repository makes it easy to get started in Ruby on Rails. It allows you to download, install, boot up, and enter a Vagrant base box equipped with a very recent version of Ruby on Rails on a Debian Stable platform. The software in the latest Vagrant base box available here will be much more current than the software in most of the other Vagrant base boxes out there. Furthermore, keeping this Vagrant base box updated will be MUCH easier than keeping most of the other publicly available Vagrant base boxes updated.

YouTube Demo

Go to http://www.youtube.com/playlist?list=PLfd4iay29eVD6yscALNcF220jfW-zUgDe to view video demos of my Debian Stable Vagrant box.

What's In The Box

RVM, Ruby, Rails, NVM, Python, node.js, Git, SQLite, PostgreSQL, Chef, Puppet, Redis

WARNING 1

Do NOT execute commands or perform actions as sudo/root/admin UNLESS you are installing software (such as Git, VirtualBox, Vagrant, SQLite database browser, pgAdmin, etc.). Using sudo/root/admin inappropriately can lead to "permission denied" messages later.

WARNING 2

When you start the Rails 4.2 server from an app in your Vagrant box, enter the command "rails s -b 0.0.0.0". The "-b 0.0.0.0" is ESSENTIAL for viewing your app from the web browser on your host machine. If you simply enter "rails s" or "rails server", you will NOT be able to view your app from the web browser on your host machine.

Getting started

Step 1 - Install Git, VirtualBox, and Vagrant.

  • Git: If your host OS is Debian Linux, Ubuntu Linux, or one of their derivatives, the shell command is "sudo apt-get install -y git". If your host OS is OS X or Windows, go to the Git web site, click on Downloads, choose the appropriate Operating System specific package to download, and follow the normal procedure for installing software.

  • VirtualBox: If your host OS is based on Debian Jessie or a newer branch of Debian, the shell command is "sudo apt-get install -y virtualbox". If your host OS is OS X or Windows, go to the VirtualBox web site, click on Downloads, and get the appropriate package for your host OS, and follow the normal procedure for installing software. WARNING: If you're using certain older versions of VirtualBox (such as 4.1.18), the file syncing may not work. If you're still using Debian Wheezy as your host OS, this will be an issue.

  • Vagrant: If your host OS is based on Debian Jessie or a newer branch of Debian, the shell command is "sudo apt-get install -y vagrant". If your host OS is OS X or Windows, go to the Vagrant web site, click on Downloads, and get the appropriate package for your host OS. WARNING: The configuration file in this repository is NOT compatible with Vagrant 1.0.x. If you're still using Debian Wheezy as your host OS, this will be an issue.

Step 2 - Build and SSH into Vagrant Virtual Machine

In the terminal application, enter:

git clone https://github.com/jhsu802701/vagrant-debian-jessie-rvm.git
cd vagrant-debian-jessie-rvm
sh login.sh

The above commands:

  • Create and start the Vagrant Virtual Machine
  • Can take anywhere from 3-45 minutes, depending on your machine and internet connection.

If you are asked to provide a password, enter "vagrant". There should be a README-host.txt file in the /home/vagrant/shared directory, which is the same README-host.txt file in the shared directory in this repository.

Step 3 - View information on the Vagrant box

Use your SSH connection to cd your way into the /home/vagrant/shared directory in your virtual machine, and run the info.sh script with the command "sh info.sh". This displays the time stamp of the Vagrant box and the versions of Ruby, Rails, RVM, node.js, NVM, SQLite, PostgreSQL, and other software included in the box.

Step 4 - Test the RVM Installation (SQLite)

  • Use your SSH connection to cd your way into the /home/vagrant/shared directory in your virtual machine, and run the test_sq.sh script with the command "sh test_sq.sh". NOTE: This command will take a few minutes to complete. At its conclusion, you will see a message ending in "Ctrl-C to shutdown server".

  • When the test_pg.sh script has finished its work, open your browser on your host machine, and go to localhost:3000/pupils. The School App should appear.

Step 5 - Test the RVM Installation (PostgreSQL)

  • Go to your SSH connection from Step 4, press Ctrl-C to turn off the server from the Rails app in Step 4, cd your way into the /home/vagrant/shared directory, and run the test_pg.sh script with the command "sh test_pg.sh". NOTE: This command will take a few minutes to complete. At its conclusion, you will see a message ending in "Ctrl-C to shutdown server".

  • When the test_pg.sh script has finished its work, open your browser on your host machine, and go to localhost:3000/pupils. The School App should appear.

Virtual Machine Management

To exit SSH connection to Vagrant Virtual Machine,

exit        # option 1

# press ^D  # option 2

To reboot and log back in,

# from your host OS

sh reboot.sh # Executes "vagrant halt", "vagrant up", and "vagrant ssh".

To suspend virtual machine,

# from your host OS

vagrant suspend

To resume virtual machine,

# From your host OS

vagrant resume

To shutdown/halt virtual machine,

# From your host OS

vagrant halt

To resume virtual machine,

From your host OS

vagrant up

To get status of virtual machine,

# From your host OS

vagrant status

To completely delete virtual machine,

# From your host OS

vagrant destroy   # DANGER: all is gone

To delete, rebuild, and log back into the virtual machine,

# From your host OS

sh rebuild.sh # Executes "vagrant halt", "vagrant destroy", "vagrant up", and "vagrant ssh"

Please check the Vagrant documentation for more information on Vagrant.

Credits

Thanks to Derek Rockwell for paving the way with his Vagrant setup at https://github.com/railsmn/railsmn-dev-box .