Fedora 36
Sponsored Link

Vagrant : Install2022/05/23

 
Install Vagrant that is wrapper tool for Virtualization software like Libvirt or VirtualBox and others.
Vagrant supports many Virtualization software like VirtualBox or Libvirt and others,
this example is based on the Libvirt installed environment.
[1] Install Vagrant.
[root@dlp ~]#
dnf -y install vagrant
[2] 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

# ⇒ https://app.vagrantup.com/boxes/search

[fedora@dlp ~]$
vagrant box add generic/fedora35 --provider libvirt

==> box: Loading metadata for box 'generic/fedora35'
    box: URL: https://vagrantcloud.com/generic/fedora35
==> box: Adding box 'generic/fedora35' (v3.6.14) for provider: libvirt
    box: Downloading: https://vagrantcloud.com/generic/boxes/fedora35/versions/3.6.14/providers/libvirt.box
    box: Calculating and comparing box checksum...
==> box: Successfully added box 'generic/fedora35' (v3.6.14) for 'libvirt'!

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

[fedora@dlp ~]$
vagrant init generic/fedora34

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
`vagrantup.com` for more information on using Vagrant.

# start virtual machine

[fedora@dlp ~]$
vagrant up

Bringing machine 'default' up with 'libvirt' provider...
==> default: Checking if box 'generic/fedora35' version '3.6.14' is up to date...
==> default: Uploading base box image as volume into Libvirt storage...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default:  -- Name:              root_default
==> default:  -- Description:       Source: /root/Vagrantfile
==> default:  -- Domain type:       kvm
==> default:  -- Cpus:              2

.....
.....

    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

[fedora@dlp ~]$
vagrant status

Current machine states:

default                   running (libvirt)

The Libvirt domain is running. To stop this machine, you can run
`vagrant halt`. To destroy the machine, you can run `vagrant destroy`.

# connect to virtual machine with SSH

[fedora@dlp ~]$
vagrant ssh


[vagrant@fedora35 ~]$ uname -a 
Linux fedora35.localdomain 5.16.20-200.fc35.x86_64 #1 SMP PREEMPT Wed Apr 13 22:09:20 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

[vagrant@fedora35 ~]$ exit 

# stop virtual machine

[fedora@dlp ~]$
vagrant halt

==> default: Halting domain...
# if you'd like to change settings of virtual machine, edit Vagrantfile

[fedora@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
  end
Matched Content