Download Ubuntu 18.04 Desktop
- Download the image from: http://releases.ubuntu.com/18.04/
- Chose “64-bit PC (AMD64) desktop image”
Create the VM
- In Virtual Box, click on the new button
- Choose the default options for new vbox image
- Name your VM without spaces, save it for later, CASE SENSITIVE
- Click on the Ubuntu VM
- Go to settings and chose the ubuntu iso that was downloaded
- Start the VM
After creation, note the MAC address
- Right click on the VM
- Settings
- Network
- Advanced
- 080027F19737
Install Ubuntu 18.04 on Virtual Box
- Defaults, except
- Minimal Installation
- DO NOT install 3rd party software
- vagrant for all name/username/password
- wait for a long time while ubuntu installs and updates itself
- restart
- remove the installation disk
- restart again ( might be able to prevent this by removing the disk first)
- remove disk by click on the cd looking icon on the bottom right of the vm window and chose host drive.
Ubuntu initial setup
Click through the welcome screen. The live updates sound interesting but require an ubuntu one account. So no.
Changed update settings
- From security updates install immediately to display immediately
- From other updates weekly to immediately
Made these changes so I know to update the base box and update my working environment immediately instead of waiting for my weekly refresh
- Install the updates
Install Guest Additions
- On Virtualbox devices, click insert guest additions
- If install doesn’t start automatically, double click the icon on the desktop and run autorun.sh
- Press enter then restart
- Did not have to install extra packages
- Not sure if guest additions were installed automatically or if the installation was successful
- The command in Terminal to check indicates that it is present and running
$ lsmod | grep vboxguest
vboxguest 219348 6 vboxsf
Password-less sudo for vagrant user
- Open Terminal
- Run
sudo visudo
- add to the end
vagrant ALL=(ALL) NOPASSWD: ALL
- ctrl+o; ctrl+x
Install SSH
- In Terminal
sudo apt-get install -y openssh-server
- Wait for install to finish, then
sudo nano /etc/ssh/sshd_config
- uncomment
AuthorizedKeysFile
- ctrl+o; ctrl+x
mkdir -p /home/vagrant/.ssh
chmod 0700 /home/vagrant/.ssh
wget --no-check-certificate https://raw.github.com/hashicorp/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys
chmod 0600 /home/vagrant/.ssh/authorized_keys
chown -R vagrant /home/vagrant/.ssh
Reduce footprint
- clean apt cache
sudo apt-get autoremove
sudo apt-get clean
- zero out drive
sudo dd if=/dev/zero of=/EMPTY bs=1M
sudo rm -f /EMPTY
- shut down the VM
- in powershell
cd "C:\Program Files\Oracle\VirtualBox\"
.\VBoxManage.exe modifymedium -compact "D:\VirtualBox VMs\Ubuntu1804-Desktop\Ubuntu1804-Desktop.vdi"
- vdi size goes from over 4gb to just under 4gb (not great, but it seems like 4gb is the lowest you can get with an ubuntu install)
Packaging the base box
- Open PowerShell or CMD
- Go to the directory the image is in and run
vagrant package --base Ubuntu1804-Desktop --output Ubuntu1804-Desktop-Base.box
- The box file is now 1.5gb
Upload the box
- Login to app.vagrantup.com, add a name, version, provider, then upload
- Release version to make publicly available