Last Updated: 2022-05-26
I realized that it is wasteful to learn macOS system tools when I deploy and test exclusively on Linux machines. What's more, with macOS being closed source, the opportunities for learning how things work are reduced, the documentation is worse, and generally my learning is limited.
Therefore I've resolved to do future development on Linux — but while still on my mac. A side goal would to test deploys/provisioning locally before putting them live.
The solution I've decided upon is
brew cask install vagrant virtualbox brew install ansible`
Chose an image and init
$ vagrant init ubuntu/xenial64
Get things going (and load VirtualBox GUI if there)
$ vagrant up
Login with SSH
$ varant ssh
$ vagrant halt
$ vagrant destory
You need to install tools to enable it
# Run all these commands on your host machine vagrant plugin install vagrant-vbguest # maybe if it does not work after provisioning vagrant vbguest install
# Vagrantfile config.vm.provider 'virtualbox' do |vb| vb.customize ['modifyvm', :id, '--clipboard', 'bidirectional'] end # on a fresh install, ubuntu does not know ANY packages sudo apt-get update sudo apt-get install clipit
echo $DISPLAY gives nothing.
Will not be work unless you install a window manager:
sudo apt install xfce4 startxfce4&
You must also assign sufficient video RAM for it to work:
config.vm.provider 'virtualbox' do |vb| # Display the VirtualBox GUI when booting the machine vb.gui = true vb.customize ["modifyvm", :id, "--vram", "<vramsize in MB>"] end
config.vm.provision 'shell', inline: 'sudo apt-get update'
vagrant uprunning on my machine)
Work on the code in the host machine (i.e. edit files etc.), but use
config.vm.synced to sync to virtual machine.
In another tab run commands within the virtual machine.