Vagrant : Install2021/11/11
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.
dnf -y install vagrant
|||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
vagrant box add generic/fedora34 --provider libvirt
==> box: Loading metadata for box 'generic/fedora34' box: URL: https://vagrantcloud.com/generic/fedora34 ==> box: Adding box 'generic/fedora34' (v3.5.0) for provider: libvirt box: Downloading: https://vagrantcloud.com/generic/boxes/fedora34/versions/3.5.0/providers/libvirt.box box: Calculating and comparing box checksum... ==> box: Successfully added box 'generic/fedora34' (v3.5.0) for 'libvirt'!
# initialize ([Vagrantfile] is created on the current path)
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
Bringing machine 'default' up with 'libvirt' provider... ==> default: Checking if box 'generic/fedora34' version '3.5.0' is up to date... ==> default: Starting domain. ==> default: Waiting for domain to get an IP address... ==> default: Waiting for SSH to become available... default: default: Vagrant insecure key detected. Vagrant will automatically replace default: this with a newly generated keypair for better security. default: 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: Creating shared folders metadata...
# show state of virtual machine
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
[vagrant@fedora34 ~]$ uname -a Linux fedora34.localdomain 5.14.13-200.fc34.x86_64 #1 SMP Mon Oct 18 12:39:31 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux [vagrant@fedora34 ~]$ exit
# stop virtual machine
==> default: Halting domain...
# if you'd like to change settings of virtual machine, edit 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