Ubuntu. Step 1: Create the Virtual Machine with Virtual Box - Install VirtualBox , from the website: https://www.virtualbox.org/ on your host system. - Download Ubuntu 64bit Desktop ISO from here: http://www.ubuntu.com/download/desktop - Load the ISO as part of the VM storage and install the OS. - Set the Username and Password as: vagrant - Once installed unload the ISO and restart the VM. - Install the "Guest Additions" Guest Additions will prepare your guest system to create external kernel modules.
VirtualBox Run the following command in the terminal: $ sudo apt-get install virtualbox-guest-utils virtualbox-guest-dkms And then restart the VM OS i.e. Ubuntu.
the minimum necessary. - Use "Software Updater" to get latest updates. - Add the vagrant user to sudoers file: $ sudo su – $ visudo # Add the following line to the end of the file. vagrant ALL=(ALL) NOPASSWD:ALL - Install Vagrant Public Keys: This would enable SSH to the machine without entering the password: $ mkdir -p /home/vagrant/.ssh $ wget --no-check-certificate https://raw.githubusercontent.com/mitchellh/vagrant/master/keys/vagrant.pub -O /home/vagrant/.ssh/authorized_keys # Ensure we have the correct permissions set $ chmod 0700 /home/vagrant/.ssh $ chmod 0600 /home/vagrant/.ssh/authorized_keys $ chown -R vagrant /home/vagrant/.ssh
install -y openssh-server $ sudo vi /etc/ssh/sshd_config Ensure the following configuration is enable i.e. doesn’t contain # at the start of line: Port 22 PubKeyAuthentication yes AuthorizedKeysFile %h/.ssh/authorized_keys PermitEmptyPasswords no And restart the ssh service after saving the sshd_config. $ sudo service ssh restart
VM down. Execute the following commands to save space and shut the VM down: $ sudo dd if=/dev/zero of=/EMPTY bs=1M $ sudo rm -f /EMPTY # Shutdown the machine $ sudo shutdown -h now - Create Vagrant Base Box Asuming you have Vagrant installed in the host system already, just run the following command: $ vagrant package –-base <VitualBox VM Name> this will create a file called package.box - Install the box $ vagrant box add {boxname} package.box
a different folder to Init a Vagrant Box by referencing the Base box we have created: $ vagrant init {boxname} - Enable GUI by editing the generated Vagrantfile by adding the following lines: config.vm.provider "virtualbox" do |v| v.gui = true end