Introduction
Vagrant is a powerful tool for building and managing virtualized development environments. It provides a consistent workflow regardless of the operating system and is an essential tool for developers who want to create isolated and reproducible development environments. Installing Vagrant on Fedora 40 ensures that developers can take advantage of the latest features and integrations.
Overview
What
Vagrant is an open-source tool for building and maintaining portable virtual development environments. It simplifies the setup of development environments, ensuring consistency and reproducibility.
Who
Vagrant is developed by HashiCorp and is used by developers, DevOps engineers, and anyone who needs to create and manage virtualized environments efficiently.
Where
Vagrant can be installed on various operating systems, including Fedora 40. It is used in development environments, testing infrastructures, and in any scenario where isolated virtual environments are required.
When
Installing Vagrant on Fedora 40 can be done at any time, ideally when setting up a new development environment or when updating existing ones to leverage the latest features and improvements.
Why
There are several reasons to install Vagrant on Fedora 40:
Pros | Cons |
---|---|
Consistency in development environments | Initial setup can be complex |
Reproducibility of environments | Resource-intensive on host systems |
Easy to share environments with teams | Learning curve for new users |
Wide range of provider support | Potential for configuration drift |
How
To install Vagrant on Fedora 40, follow these steps:
1. Update the System | sudo dnf update |
2. Install Vagrant | sudo dnf install vagrant |
3. Verify Installation | vagrant --version |
4. Initialize a Vagrant Project | vagrant init |
5. Start the Vagrant Environment | vagrant up |
Consequences
Setting up Vagrant in Fedora 40 can lead to several consequences:
Positive |
|
Negative |
|
Conclusion
Installing Vagrant on Fedora 40 is a strategic move for developers who need isolated, reproducible, and consistent development environments. Despite some initial setup challenges, the benefits of streamlined workflows, environment consistency, and extensive provider support make Vagrant an invaluable tool for modern development practices.
Install Vagrant
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.
Step [1]Install Vagrant.
[root@bizantum ~]# dnf -y install vagrant
[root@bizantum ~]# systemctl start virtnetworkd
Step [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://app.vagrantup.com/boxes/search
[fedora@bizantum ~]$ vagrant box add generic/fedora39 --provider libvirt
==> box: Loading metadata for box 'generic/fedora39'
box: URL: https://vagrantcloud.com/generic/fedora39
==> box: Adding box 'generic/fedora39' (v4.3.12) for provider: libvirt
box: Downloading: https://vagrantcloud.com/generic/boxes/fedora39/versions/4.3.12/providers/libvirt/amd64/vagrant.box
box: Calculating and comparing box checksum...
==> box: Successfully added box 'generic/fedora39' (v4.3.12) for 'libvirt'!
# initialize ([Vagrantfile] is created on the current path)
[fedora@bizantum ~]$ vagrant init generic/fedora39
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@bizantum ~]$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Checking if box 'generic/fedora39' version '4.3.12' 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: 2
==> default: -- Feature: acpi
==> default: -- Feature: apic
==> default: -- Feature: pae
==> default: -- Clock offset: utc
==> default: -- Memory: 2048M
==> default: -- Base box: generic/fedora39
==> default: -- Storage pool: default
==> default: -- Image(vda): /home/fedora/.local/share/libvirt/images/fedora_default.img, virtio, 128G
==> default: -- Disk driver opts: cache='default'
==> default: -- Graphics Type: vnc
==> default: -- Video Type: cirrus
==> default: -- Video VRAM: 256
==> 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.125: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!
# show state of virtual machine
[fedora@bizantum ~]$ 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@bizantum ~]$ vagrant ssh
[vagrant@fedora39 ~]$ uname -a
Linux fedora39.localdomain 6.6.9-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jan 1 20:05:54 UTC 2024 x86_64 GNU/Linux
[vagrant@fedora39 ~]$ exit
# stop virtual machine
[fedora@bizantum ~]$ vagrant halt
==> default: Attempting graceful shutdown of VM...
# if you'd like to change settings of virtual machine, edit Vagrantfile
[fedora@bizantum ~]$ 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
- Get link
- X
- Other Apps
Comments
Post a Comment
Thank you for your comment! We appreciate your feedback, feel free to check out more of our articles.
Best regards, Bizantum Blog Team.