Created
December 3, 2014 09:19
-
-
Save larsbutler/bb8473981760f17cbfdd to your computer and use it in GitHub Desktop.
Vagrant dev environment example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Install Vagrant: http://www.vagrantup.com/downloads.html | |
2. Install VirtualBox: https://www.virtualbox.org/wiki/Downloads | |
3. Put Vagrantfile and vagrant-bootstrap.sh in some working directory | |
4. Open a shell, cd to that directory. | |
5. Run `vagrant up`. This will create the VM and run the vagrant-bootstrap.sh script | |
Other useful commands (run these from the same directory as the Vagrantfile) | |
- `vagrant halt`: shut down a machine | |
- `vagrant destroy -f`: destroy a machine; -f/--force is useful if the machine is running | |
- `vagrant up`: resume a halted machine, or re-create a destroyed machine | |
- `vagrant ssh`: log in to the VM via ssh | |
- `vagrant --help`: show help on all other commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get update | |
sudo apt-get install python-numpy python-scipy python-matplotlib --yes | |
# run any other shell commands you want |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
# All Vagrant configuration is done here. The most common configuration | |
# options are documented and commented below. For a complete reference, | |
# please see the online documentation at vagrantup.com. | |
# Every Vagrant virtual environment requires a box to build off of. | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.box_url = "https://vagrantcloud.com/ubuntu/boxes/trusty64/versions/1/providers/virtualbox.box" | |
# You can shell scripts when `vagrant up` or `vagrant provision` is run. | |
# Just put scripts in the same directory as this `Vagrantfile`. | |
config.vm.provision "shell", privileged: false, path: "vagrant-bootstrap.sh" | |
# You can do multiple scripts, if you want: | |
# config.vm.provision "shell", privileged: false, path: "vagrant-bootstrap2.sh" | |
# Port forwarding examples | |
# Just in case you need to run a database server, web server, etc. | |
#config.vm.network "forwarded_port", guest: 8080, host: 8080 | |
#config.vm.network "forwarded_port", guest: 5000, host: 5000 | |
#config.vm.network "forwarded_port", guest: 35357, host: 35357 | |
# Mem/cpu config example. | |
# If you need more CPUs/RAM, uncomment the next 4 lines and edit as needed. | |
#config.vm.provider "virtualbox" do |v| | |
# v.memory = 1024 | |
# v.cpus = 2 | |
#end | |
# Shared folders | |
# Setting the workspace to the current dir allows you to do editing/ | |
# development on host environment (OSX, etc.) and then actually run/ | |
# test things inside the virtual environvment. | |
# You can map multiple folders in the way. | |
# In this case, the ".", "/workspace" indicates that we want to map | |
# the current directory on the host machine to the "/workspace" directory | |
# on the guest/VM. | |
config.vm.synced_folder ".", "/workspace" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment