Skip to main content
  1. Resources/
  2. Kali Linux Set-up/

Vagrant

··344 words·2 mins

Please make sure to review the following configuration before proceeding.

  1. Download Vagrant either via their website or via your preferred package manager.
  2. Create a new file, named Vagrantfile in your current directory, with the following configuration:
    • Preferred hypervisor provider (virtualbox or vmware_desktop)
    • Allocated memory
    • Allocated threads
    • Optional: Launch with graphical interface (true or false)
    • Optional: VM name
    • Synced folder between host machine and guest machine
  3. Run vagrant plugin install vagrant-vbguest in your command-line in order to download the plugin that makes sure that VirtualBox Guest Additions is installed on the guest machine.
    • Note: This command will fail to complete if you run it on an Arch-based distribution of Linux. In this case, the Vagrantfile example below uses a password-based authentication instead of the key-based authentication in order to complete the VM set-up. For further information, refer to the Vagrant SSH configuration documentation.
  4. Run vagrant up in your command-line (at the same directory as your Vagrantfile) in order to start the VM.
    • You can follow Kali’s guide on setting-up a Vagrantfile.
    • At this stage you can wait for the VM to boot and interact with it graphically when it is ready.
  5. You can shut-down your VM either graphically, or by running vagrant halt at the same directory as your Vagrantfile.
  6. Run vagrant ssh in your command-line (at the same directory as your Vagrantfile), in order to start an command-line session. This is a great option if your host machine does not have lots of resources for a graphical session, or if you like working with the integrated terminal of your preferred IDE.
  • Example Vagrantfile:
    • VirtualBox hypervisor
    • 2 GiB of memory
    • 2 CPU threads
    • Vagrantfile’s directory on the host is synced to /home/vagrant/Documents/CTFs on the guest machine.
Vagrant.configure("2") do |config|
	if Vagrant.has_plugin?("vagrant-vbguest")
		config.ssh.insert_key = false
		config.ssh.forward_agent = true
	else
		config.ssh.username = "vagrant"
		config.ssh.password = "vagrant"
	end
	config.vm.provider "virtualbox" do |virtualbox|
		virtualbox.memory = 2048
		virtualbox.cpus = 2
		virtualbox.gui = true
		virtualbox.name = "Kali"
	end
	config.vm.box = "kalilinux/rolling"
	# creating a synced folder from current directory on host to /home/vagrant/Documents/CTFs on guest
	config.vm.synced_folder ".", "/home/vagrant/Documents/CTFs", create: true
end