Mac Virtualbox Vagrant
I recently started a new job at Phone2Action and am setting up a new macbook pro for software development. These are some of the steps I’ve taken to get up and running with Vagrant on a new Macbook. Vagrant is a virtual environment on your computer. You can install Vagrant Boxes to have a common development environment with other developers on your team. By installing and using a Vagrant box it can eliminate the need to install many other softwares like PHP, MySQL, Redis etc.
If you want to use a different version of Singularity, or want to get more familiar with how Vagrant and VirtualBox work, you can build your own Vagrant Box from scratch. In this case, we will use the Vagrantfile for bento/ubuntu-16.04, however you could also try any of the other bento boxes that are equally delicious. In this section, you will learn how to install VirtualBox and Vagrant onto a macOS environment. This website uses cookies and other tracking technology to analyse traffic, personalise ads and learn how we can improve the experience for our visitors and customers.
## Install Xcode and Xcode developer tools.Conventional wisdom is to run xcode-select --install
to install Xcode. I ran into an error that “Xcode is not currently available from the Software Update server”. I then had to download Xcode and the developer tools with my Apple Developer account here. It takes a while to download but is an important first step for software development.
## Install Homebrew
Once Xcode is installed install Homebrew with the one liner from their website:
## Optional: Install iTerm and Oh My ZSH
iTerm has some extra functionality for your terminal: https://www.iterm2.com/
Oh My Zsh: https://github.com/robbyrussell/oh-my-zsh
## Install packages
Once Homebrew is installed you can use it to install lots of important packages for software development. I’ll be using PHP and MySQL with Node.js. These commands install composer, package manager for PHP. Yarn, which is the new new version of NPM. PHP version 7.1 and the AWS command line tools.
This is the ending summary from the PHP install:
## Optional: Symlink Sublime Text
Symbolic links help you quickly open applications or programs using the command line. In my case I like to have a file or directory open in Sublime Text (which you can download here) when I type subl filename
.
To do this you need to add Sublime Text to your load path. Check the load path location by running echo $PATH
. This will show the load paths separated by colons.
This creates a symbolic link or sym link so that you can open Sublime from the command line. This tutorial is super helpful.
## Install VirtualBox
Vagrant runs on top of VirtualBox. You’ll need to have it installed on your machine.
## Install Vagrant
You can download Vagrant for Mac here.
Move to a folder where you’d like to set up your virtual environment. For example you can make a folder named mkdir vm
to run vagrant commands inside of. Install Laravel Homestead by running:
When I tried to run this command the first time I got an error: OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
. The next morning I ran vagrant destroy
and then ran the command to add the vagrant box and it worked. I believe that issue was due to the network. Trying it at a different time of day worked for me.
Once installed clone your project, cd
into it and run vagrant up
. You may need to run vagrant reload --provision
when booting up your machine. Be sure to consult the Laravel Homestead documentation for more notes on running a Laravel 5.8 app with Vagrant and the Homestead box for your development environment!
NSoT engineers have built Vagrantfiles for you to deploy NSoT software in a multitude of linux environments. This tutorial will help you load a Macintonsh computer (OS X) with Vagrant, Virtual Box, and dependencies so that you can start virtual servers and test the software.
NSoT publishes complete installation instructions for linux distributions, branch versions, and Vagrantfiles in addition to, not an alternative for the pip install method:
The Goal:
Install Brew, VirtualBox, Vagrant and Vagrant-Manager, on a Macintosh 10.10.x system to deploy test versions of NSOT. When done we will be able to load a variety of linux distributions with NSOT pre-configured, as virtual servers inside a test environment.
Context:
We will use Vagrant and associated Virtual Server software to build NSoT on a variety of Linux distributions elsewhere in these documents. This guide is to help those unfamiliar with how to install and use Vagrant and Virtualbox, making the Vagrantfiles published more useful.
Vagrant allows us to provision complete virtual machines (Unix, Linux, Mac, or Windows) inside the Mac Operating system as virtual machines. The vagrant virtual servers are configured with a single file (called a “Vagrantfile.”) started with a single command (vagrant up), are contained within a single folder, and can be destroyed with a single command (vagrant destroy). This environment is nicely segregated from your day to day computing, and allows you to test our software in a variety of environments.
Assumptions:
You are running a computer with Mac OS X 10.10.x installed.
Overview:
1 Install Prerequisite Software (XCode)*.2 Install Brew.3 Brew Vagrant.4 “Hello World” Vagrant.
1. Install Prerequisite Software - XCode & XCode Tools:
Click link to Get Xcode —>
Agree to EULA and Install.
Install Prerequisite Software (XCode Tools from Command Line):Open a Terminal (Launchpad —> Other —> Terminal).At the command prompt run the following command to install XCode Tools
$ xcode-select —install
- Accept the EULA.
- Agree to install at Prompt.
2. Install Prerequisite Software (Homebrew from Command Line):
Using the terminal, download and install Homebrew with this command:
Run this command from the terminal to update and confirm install of Homebrew:
From Command line run these commands to update Brew and view the version (licenses):
3. Install Vagrant and Virtualbox via Homebrew:
Download, verify, and install VirtualBox:
Download, verify, and install VirtualBox extension pack for your version of virtualbox:
Download, verify, and install Vagrant:
Download, verify, and install Vagrant-Manager:
4. Start a Virtual Ubuntu Server:
Now that we have it all installed, let's spin up an Ubuntu server, log in to it, play, log out, and then destroy it.
From Command line enter the following to make a sandbox directory, cd into it, and then download the Ubuntu:
Initialize the installation inside the sandbox folder (aka make the Vagrantfile). (You can modify the Vagrantfile and look at it after this step.):
Virtualbox On Mac
Start the Ubuntu server via Vagrant by typing this at command line:
To login to the new server via ssh, enter the following via command line:
Run Mac In Virtualbox
Change what you like. Mess it up if you care to. Once done poking around logout:
To destroy the Ubuntu virtual server installation:
To rebuild from the OS again:
Conclusion: After the login regimen finishes, you should be inside the new server you just created, for the second time. You have built a new server, Destroyed it, and built another in less time than it takes to drink a cup of coffee.
Mac Virtualbox Vagrant Power
Footnotes:Homebrew installation based on the guide published here.http://coolestguidesontheplanet.com/installing-homebrew-os-x-yosemite-10-10-package-manager-unix-apps/
Based on the Vagrant installation guide published here.