Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fedora - Installing and running Vagrant using qemu-kvm

#1
Installing and running Vagrant using qemu-kvm

Vagrant is a brilliant tool, used by DevOps professionals, coders, sysadmins and regular geeks to stand up repeatable infrastructure for development and testing. From their website:

Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the “works on my machine” excuse a relic of the past.

If you are already familiar with the basics of Vagrant, the documentation provides a better reference build for all available features and internals.

Vagrant provides easy to configure, reproducible, and portable work environments built on top of industry-standard technology and controlled by a single consistent workflow to help maximize the productivity and flexibility of you and your team.

https://www.vagrantup.com/intro

This guide will walk through the steps necessary to get Vagrant working on a Fedora-based machine.

I started with a minimal install of Fedora Server as this reduces the memory footprint of the host OS, but if you already have a working Fedora machine, either Server or Workstation, then this should still work.

Check the machine supports virtualisation:


$ sudo lscpu | grep Virtualization
Virtualization:                  VT-x
Virtualization type:             full

Install qemu-kvm:


sudo dnf install qemu-kvm libvirt libguestfs-tools virt-install rsync

Enable and start the libvirt daemon:


sudo systemctl enable --now libvirtd

Install Vagrant:


sudo dnf install vagrant

Install the Vagrant libvirtd plugin:


sudo vagrant plugin install vagrant-libvirt

Add a box


vagrant box add fedora/32-cloud-base --provider=libvirt

Create a minimal Vagrantfile to test


$ mkdir vagrant-test
$ cd vagrant-test
$ vi Vagrantfile

Vagrant.configure("2") do |config| config.vm.box = "fedora/32-cloud-base"
end

Note the capitalisation of the file name and in the file itself.

Check the file:


vagrant status

Current machine states: default not created (libvirt) The Libvirt domain is not created. Run 'vagrant up' to create it.

Start the box:


vagrant up

Connect to your new machine:


vagrant ssh

That’s it – you now have Vagrant working on your Fedora machine.

To stop the machine, use vagrant halt. This simply halts the machine but leaves the VM and disk in place.
To shut it down and delete it use vagrant destroy. This will remove the whole machine and any changes you’ve made in it.

Next steps


You don’t need to download boxes before issuing the vagrant up command – you can specify the box and the provider in the Vagrantfile directly and Vagrant will download it if it’s not already there. Below is an example which also sets the amount memory and number of CPUs:

# -*- mode: ruby -*-
# vi: set ft=ruby : Vagrant.configure("2") do |config| config.vm.box = "fedora/32-cloud-base" config.vm.provider :libvirt do |libvirt| libvirt.cpus = 1 libvirt.memory = 1024 end
end

For more information on using Vagrant, creating your own machines and using different boxes, see the official documentation at https://www.vagrantup.com/docs

There is a huge repository of boxes ready to download and use, and the official location for these is Vagrant Cloud – https://app.vagrantup.com/boxes/search. Some are basic operating systems and some offer complete functionality such as databases, web servers etc.



https://www.sickgaming.net/blog/2020/09/...-qemu-kvm/
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Fedora - Announcing the release of Fedora 33 Beta xSicKxBot 0 28 09-29-2020, 09:01 PM
Last Post: xSicKxBot
  Fedora - Now available: Fedora on Lenovo laptops! xSicKxBot 0 26 09-25-2020, 07:51 PM
Last Post: xSicKxBot
  Fedora - Ankur Sinha: How do you Fedora? xSicKxBot 0 41 09-11-2020, 02:22 PM
Last Post: xSicKxBot
  Fedora - Contribute at the Fedora Test Week for Btrfs xSicKxBot 0 67 08-26-2020, 01:20 PM
Last Post: xSicKxBot
  Fedora - Btrfs Coming to Fedora 33 xSicKxBot 0 73 08-24-2020, 01:28 PM
Last Post: xSicKxBot
  Fedora - Configure Fedora to practice and compose music xSicKxBot 0 61 08-22-2020, 12:44 PM
Last Post: xSicKxBot
  Fedora - Contribute at the Fedora Kernel and GNOME test days xSicKxBot 0 72 08-18-2020, 02:42 PM
Last Post: xSicKxBot
  Fedora - Create a wifi hotspot with Raspberry Pi 3 and Fedora xSicKxBot 0 89 08-12-2020, 12:36 PM
Last Post: xSicKxBot
  Fedora - install Fedora on a Raspberry Pi 3 xSicKxBot 0 103 08-07-2020, 01:04 PM
Last Post: xSicKxBot
  Fedora - Matthew Arnold: Why I switched to Fedora xSicKxBot 0 121 08-05-2020, 08:52 AM
Last Post: xSicKxBot

Forum Jump:

Become a Patron!
[-]
Upcoming Events

[-]
Latest Threads
[Tut] How To Kill A Thread In Python?
Last Post: xSicKxBot
Today 05:40 AM
» Replies: 0
» Views: 3
(Indie Deal) FREE Ghost Sweeper, ? NBA 2...
Last Post: xSicKxBot
Today 05:40 AM
» Replies: 0
» Views: 3
News - Nintendo Is Permanently Reducing ...
Last Post: xSicKxBot
Today 04:13 AM
» Replies: 0
» Views: 2
News - Blade Runner: Enhanced Edition De...
Last Post: xSicKxBot
Today 04:13 AM
» Replies: 0
» Views: 4
Humble Ultimate Fantasy Game Development...
Last Post: xSicKxBot
Yesterday 10:00 PM
» Replies: 0
» Views: 7
Microsoft - Honeywell teams up with Micr...
Last Post: xSicKxBot
Yesterday 09:59 PM
» Replies: 0
» Views: 6
Fedora - Secure NTP with NTS
Last Post: xSicKxBot
Yesterday 09:59 PM
» Replies: 0
» Views: 6
News - Video: First 4 Figures Unboxes It...
Last Post: xSicKxBot
Yesterday 09:59 PM
» Replies: 0
» Views: 6
News - Battlefield 5 Definitive Edition ...
Last Post: xSicKxBot
Yesterday 09:59 PM
» Replies: 0
» Views: 7
(Indie Deal) Alien Cat Bundle, RIDE 4 re...
Last Post: xSicKxBot
Yesterday 05:21 PM
» Replies: 0
» Views: 6

[-]
Twitter

[-]
Sponsored
Get the Deal of the Week at RefurBees.com

Copyright © SickGaming.net 2012-2020