FreeBSD 14
Sponsored Link

Vagrant : Install2024/04/12

Install Vagrant that is wrapper tool for Virtualization software like Libvirt or VirtualBox and others.
Vagrant supports many Virtualization software like VirtualBox or Libvirt on Linux and others,
this example is based on the VirtualBox installed environment.
[1] Install Vagrant.
root@dlp:~ #
pkg install -y vagrant
[2] This is the basic usage of Vagrant. It's possible to use it by any common users.
# download and add virtual machine images
# for downloadable image, refer to the official site below

# ⇒

freebsd@dlp:~ $
vagrant box add generic/freebsd13 --provider virtualbox

==> vagrant: A new version of Vagrant is available: 2.4.1 (installed version: 2.3.7)!
==> vagrant: To upgrade visit:

==> box: Loading metadata for box 'generic/freebsd13'
    box: URL:
==> box: Adding box 'generic/freebsd13' (v4.3.12) for provider: virtualbox
    box: Downloading:
    box: Calculating and comparing box checksum...
==> box: Successfully added box 'generic/freebsd13' (v4.3.12) for 'virtualbox'!

# initialize ([Vagrantfile] is created on the current path)

freebsd@dlp:~ $
vagrant init generic/freebsd13

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`` for more information on using Vagrant.

# start virtual machine

freebsd@dlp:~ $
vagrant up

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'generic/freebsd13'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'generic/freebsd13' version '4.3.12' is up to date...
==> default: Setting the name of the VM: freebsd_default_1712893189651_68795
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
VMMR0InitVM: eflags=40246 fKernelFeatures=0x2 (SUPKERNELFEATURES_SMAP=1)
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address:
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default: Vagrant insecure key detected. Vagrant will automatically replace
    default: this with a newly generated keypair for better security.
    default: Inserting generated public key within guest...
    default: Removing insecure key from the guest if it's present...
    default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!

# show state of virtual machine

freebsd@dlp:~ $
vagrant status

Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

# connect to virtual machine with SSH

freebsd@dlp:~ $
vagrant ssh

[vagrant@freebsd13 ~]$ cat /etc/os-release 

[vagrant@freebsd13 ~]$ exit 

# stop virtual machine

freebsd@dlp:~ $
vagrant halt

==> default: Attempting graceful shutdown of VM...
# if you'd like to change settings of virtual machine, edit Vagrantfile

freebsd@dlp:~ $
vi Vagrantfile
# for example to change CPU and Memory settings
# uncomment line 57 like follows and add or change values

  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #   # Customize the amount of memory on the VM:
     vb.memory = "4096"
     vb.cpus = 2
Matched Content