You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

This article describes the steps to deploy a basic Ubuntu 18.04 on your host.

Prerequisite

Virtualbox. (Can be downloaded from this page Download Virtualbox)

Vagrant. (Can from this page Download Vagrant)


Prepare a dir for your VM

Open a terminal and go to the dir 'vagrant_home' created during the installation of Vagrant.

Create a dir, for example 'basic1804vm'

Put the following Vagrantfile in that directory.

Vagrantfile

Vagrant.configure("2") do |config|

  config.vm.box = "generic/ubuntu1804"

# share folder <host>,<guest>
  #config.vm.synced_folder "shared_folder", "/home/vagrant/shared_folder"

  config.vm.provider :virtualbox do |vb|

    vb.customize ["modifyvm", :id, "--memory", "4096", "--cpus", "2"]

  end

end

This file will create an Ubuntu VM and configure in with 4GB om memory and 2 cpus. 

Change the setting if needed for the purpose. However, be careful not to allocate to much of the host resources.

The shared folder is optional. 

Further config is possible, see  Vagrant docs

Start the VM and login

In the dir created above, do

vagrant up #Starts the VM

vagrant ssh #Log in to VM

done!

The VM is now visible in the Virtualbox GUI and is ready to be used.

If more terminals are needed to the same vm, open a new terminal window and go to the same dir and do 'vagrant ssh'

Start the VM and login

Logout from the VM and do

vagrant destroy

After this the VM can be started again according to the previous section "Start the VM and login".


  • No labels