Vagrant : Install2025/04/25 |
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, |
|
[1] | Install Vagrant. |
[root@dlp ~]#
[root@dlp ~]# dnf -y install vagrant systemctl enable --now virtnetworkd
|
[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 # ⇒ https://portal.cloud.hashicorp.com/vagrant/discover [fedora@dlp ~]$ vagrant box add fedora/41-cloud-base --provider libvirt ==> box: Loading metadata for box 'fedora/41-cloud-base' box: URL: https://vagrantcloud.com/api/v2/vagrant/fedora/41-cloud-base ==> box: Adding box 'fedora/41-cloud-base' (v41-20241024.0) for provider: libvirt box: Downloading: https://vagrantcloud.com/fedora/boxes/41-cloud-base/versions/41-20241024.0/providers/libvirt/amd64/vagrant.box box: Calculating and comparing box checksum... ==> box: Successfully added box 'fedora/41-cloud-base' (v41-20241024.0) for 'libvirt'! # initialize ([Vagrantfile] is created on the current path) [fedora@dlp ~]$ vagrant init fedora/41-cloud-base 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 'fedora/41-cloud-base' version '41-20241024.0' 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: fedora_default ==> default: -- Description: Source: /home/fedora/Vagrantfile ==> default: -- Domain type: kvm ==> default: -- Cpus: 1 ==> default: -- Feature: acpi ==> default: -- Feature: apic ==> default: -- Feature: pae ==> default: -- Clock offset: utc ==> default: -- Memory: 512M ==> default: -- Base box: fedora/41-cloud-base ==> default: -- Storage pool: default ==> default: -- Image(vda): /home/fedora/.local/share/libvirt/images/fedora_default.img, virtio, 5G ==> default: -- Disk driver opts: cache='default' ==> default: -- Graphics Type: vnc ==> default: -- Video Type: cirrus ==> default: -- Video VRAM: 16384 ==> default: -- Video 3D accel: false ==> default: -- Keymap: en-us ==> default: -- TPM Backend: passthrough ==> default: -- INPUT: type=mouse, bus=ps2 ==> default: Creating shared folders metadata... ==> default: Starting domain. ..... ..... default: SSH address: 192.168.122.236:22 default: SSH username: vagrant default: SSH auth method: private key 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: Machine booted and ready! ==> default: Rsyncing folder: /home/fedora/ => /vagrant # 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@localhost ~]$ uname -a Linux localhost.localdomain 6.11.4-301.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Sun Oct 20 15:02:33 UTC 2024 x86_64 GNU/Linux [vagrant@localhost ~]$ exit # stop virtual machine [fedora@dlp ~]$ vagrant halt ==> default: Attempting graceful shutdown of VM... # 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 |
Sponsored Link |
|