Code Monkey home page Code Monkey logo

vagrantlab's Introduction

Vagrant Lab

This is a sample of Vagrantfile for prepare a suitable laboratory with vagrant to make multiple machines on Ubuntu 20.04.


Vagrant boxes

These vagrant boxes exist in this Vagrantfile.

  • CentOS 7
  • Ubuntu 20.04 server
  • Debian 10 buster
  • Ubuntu 20.04 with desktop (GUI)

Requierments

Install KVM qemu libvirt

Official Ubuntu KVM installation

Before continuing with the installation, make sure your Ubuntu host machine supports KVM virtualization. The system should have either an Intel processor with the VT-x (vmx), or an AMD processor with the AMD-V (svm) technology support.

Run the following grep command to verify that your processor supports hardware virtualization:

grep -Eoc '(vmx|svm)' /proc/cpuinfo

If the CPU supports hardware virtualization, the command will output a number greater than zero, which is the number of the CPU cores. Otherwise, if the output is 0 it means that the CPU doesn’t support hardware virtualization.

On some machines, the virtual technology extensions may be disabled in the BIOS by the manufacturers.

  • To check if VT is enabled in the BIOS, use the kvm-ok tool.
kvm-ok
output

INFO: /dev/kvm exists
KVM acceleration can be used
  • Install packages
sudo apt install qemu libvirt-daemon-system \
libvirt-clients libxslt1-dev libxml2-dev libvirt-dev \
zlib1g-dev ruby-dev ruby-libvirt ebtables dnsmasq-base \
qemu-kvm bridge-utils virtinst virt-manager libvirt-doc \
qemu-kvm virtinst virt-viewer virt-manager bridge-utils \
cpu-checker virt-top imvirt
  • Start and enable libvirtd daemon service.
sudo systemctl is-active libvirtd
  • To be able to create and manage virtual machines, you’ll need to add your user to the “libvirt” and “kvm” groups. To do that, enter:
sudo usermod -aG libvirt $USER
sudo usermod -aG kvm $USER

Install Vagrant

Download deb/rpm package from vagrant official website.

  • Install vagrant package.
sudo dpkg -i vagrant_2.2.13_i686.deb
# or
sudo apt install ./vagrant_2.2.13_i686.deb
  • Now, install vagrant-libvirt plugin using command:
vagrant plugin install vagrant-libvirt
  • You also need to install vagrant-mutate plugin which converts vagrant boxes to work with different providers.
vagrant plugin install vagrant-mutate

How does it work?

These are boxes defined name in this Vagrantfile:

  • centos7lab1
  • centos7lab2
  • centos7lab3
  • debian10
  • focal-desktop
  • ubuntu2004

Finally:

vagrant up <boxes defined name>
# e.g vagrant up debian10

Author: Hamid Gholami ([email protected])

Linkedin LinkedIn   GitHub GitHub   Twitter Twitter

vagrantlab's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.