All Projects → kayrus → deploy-vm

kayrus / deploy-vm

Licence: GPL-2.0 license
Libvirt wrapper to spawn VMs using cloud images

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to deploy-vm

Robox
The tools needed to robotically create/configure/provision a large number of operating systems, for a variety of hypervisors, using packer.
Stars: ✭ 303 (+441.07%)
Mutual labels:  freebsd, centos, libvirt
Kvm Install Vm
Bash script to build local virtual machines using KVM/libvirt and cloud-init.
Stars: ✭ 248 (+342.86%)
Mutual labels:  centos, kvm, libvirt
Terrible
An Ansible playbook that apply the principle of the Infrastructure as Code on a QEMU/KVM environment.
Stars: ✭ 161 (+187.5%)
Mutual labels:  freebsd, kvm, libvirt
Postinstall
💻 Bash Script to automate post-installation steps
Stars: ✭ 104 (+85.71%)
Mutual labels:  freebsd, centos
Iredmail
Full-featured, open source mail server solution for mainstream Linux/BSD distributions.
Stars: ✭ 343 (+512.5%)
Mutual labels:  freebsd, centos
Bento
Packer templates for building minimal Vagrant baseboxes for multiple platforms
Stars: ✭ 3,779 (+6648.21%)
Mutual labels:  freebsd, centos
packer-kvm
Create VM templates with Packer for usage with Libvirt/KVM virtualization : CentOS 7, CentOS 8, CentOS 8 Stream, Alma Linux, Rocky Linux, Bionic (Ubuntu 1804), Focal (Ubuntu 2004), Debian 11 (stable), Kali Linux, Fedora 33 and Fedora 34.
Stars: ✭ 99 (+76.79%)
Mutual labels:  centos, kvm
Serverfarmer
Manage multiple servers with different operating systems, configurations, requirements etc. for many separate customers in an outsourcing model.
Stars: ✭ 122 (+117.86%)
Mutual labels:  freebsd, centos
Democratic Csi
csi storage for container orchestration systems
Stars: ✭ 120 (+114.29%)
Mutual labels:  freebsd, centos
vagrant-travisci-libvrt
Example project showing how to run Vagrant on TravisCI using libvrt & KVM
Stars: ✭ 25 (-55.36%)
Mutual labels:  kvm, libvirt
vmdashboard
web-based open source virtualization management interface for QEMU and KVM virtual machines
Stars: ✭ 66 (+17.86%)
Mutual labels:  kvm, libvirt
evcloud
EVCloud是一个基于ceph和libvirt的轻量级云主机管理平台,实用稳定,维护简易
Stars: ✭ 44 (-21.43%)
Mutual labels:  kvm, libvirt
lightstars
Makes it easier for you to control virtual resource.
Stars: ✭ 14 (-75%)
Mutual labels:  kvm, libvirt
insaneworks-packer-template
CentOS 7-8 8Stream / AlmaLinux 8 / FreeBSD 12 - 13 x64 + VirtualBox / VMWare for Packer Template + FreeBSD 13 / AlmaLinux 9 + Parallels
Stars: ✭ 38 (-32.14%)
Mutual labels:  freebsd, centos
Solo5
A sandboxed execution environment for unikernels
Stars: ✭ 659 (+1076.79%)
Mutual labels:  freebsd, kvm
yosild
Yosild is a single shell script that builds a full, minimal Linux distribution based on BusyBox.
Stars: ✭ 97 (+73.21%)
Mutual labels:  kvm, libvirt
okd-lab
Controlled Environment for OKD4 experiments
Stars: ✭ 24 (-57.14%)
Mutual labels:  coreos, kvm
ganeti-rpm
Ganeti RPM Packaging
Stars: ✭ 23 (-58.93%)
Mutual labels:  centos, kvm
packer-centos
Create CentOS images for different hypervisors with Packer
Stars: ✭ 18 (-67.86%)
Mutual labels:  centos, kvm
libvirt-ocp4-provisioner
Automate your OCP4 installation
Stars: ✭ 82 (+46.43%)
Mutual labels:  coreos, libvirt

Install libvirt on Ubuntu

sudo apt-get install -y libvirt-bin virtinst qemu-kvm virt-manager git wget genisoimage
sudo service libvirt-bin start

For the Windows VM support install bsdtar (this tool allows to extract zip archive from stdin):

sudo apt-get install bsdtar

Install on Fedora/CentOS

sudo yum install -y libvirt virt-install qemu-kvm virt-manager git wget genisoimage NetworkManager
sudo service libvirtd start

For the Windows VM support install bsdtar (this tool allows to extract zip archive from stdin):

sudo yum install bsdtar

This string inside your ~/.profile will allow you to use virsh:

export LIBVIRT_DEFAULT_URI=qemu:///system

Configure local resolver to use libvirt's dnsmasq

  • Ubuntu 18.04 (systemd-resolved (c))

The setting below is not preserved on reboot:

systemd-resolve --set-dns=192.168.122.1 --set-domain=vm --interface=virbr0

Verify:

systemd-resolve --status virbr0

Add the following section into libvirt default network (sudo virsh net-edit default):

  <domain name='vm' localOnly='yes'/>

And restart the network:

sudo virsh net-destroy default
sudo virsh net-start default
  • Ubuntu/Debian
virsh net-dumpxml default | sed -r ":a;N;\$!ba;s#.*address='([0-9.]+)'.*#nameserver \1#" | sudo tee -a /etc/resolvconf/resolv.conf.d/head && sudo resolvconf -u
  • Fedora/CentOS
sudo systemctl enable NetworkManager
echo -e "[main]\ndns=dnsmasq" | sudo tee -a /etc/NetworkManager/NetworkManager.conf
virsh net-dumpxml default | sed -r ":a;N;\$!ba;s#.*address='([0-9.]+)'.*#server=\1\nall-servers#" | sudo tee /etc/NetworkManager/dnsmasq.d/libvirt_dnsmasq.conf
sudo systemctl restart NetworkManager

Add current user into libvirt group (will allow you to run scripts without sudo)

sudo usermod -aG libvirtd $USER # for Debian/Ubuntu14.04/Ubuntu16.04
sudo usermod -aG libvirt $USER # for CentOS/Fedora/Ubuntu18.04

NOTE: You have to relogin into your UI environment to apply these changes.

Allow libvirt to read VMs images in your home directory

ACL solution

Add permissions

setfacl -m "u:libvirt-qemu:--x" $HOME # for Debian/Ubuntu
setfacl -m "u:qemu:--x" $HOME # for CentOS/Fedora

Remove permissions

Remove ACL entries only for libvirt
setfacl -m "u:libvirt-qemu:---" $HOME # for Debian/Ubuntu
setfacl -m "u:qemu:---" $HOME # for CentOS/Fedora
Remove all custom ACL entries
setfacl -b $HOME
getfacl $HOME

Groups solution

Add permissions

sudo usermod -aG $USER libvirt-qemu # for Debian/Ubuntu
sudo usermod -aG $USER qemu # for CentOS/Fedora
chmod g+x $HOME

Remove permissions

sudo usermod -G "" libvirt-qemu # for Debian/Ubuntu
sudo usermod -G "kvm" qemu # for CentOS/Fedora
chmod g-x $HOME

Configure virsh environment

echo "export LIBVIRT_DEFAULT_URI=qemu:///system" >> ~/.bashrc

Configure ~/.ssh/config

cat dot_ssh_config >> ~/.ssh/config
chmod 600 ~/.ssh/config

Run Flatcar VMs cluster of 3 nodes

./deploy_flatcar_cluster.sh -s 3

user_data file works only for Flatcar and contains a template for Flatcar configuration and it configures etcd2 and fleet.

Try out Tectonic

Create Tectonoic credentials files:

  • tectonic.lic # raw base64 encoded licence
  • docker.cfg # raw base64 encoded dockercfg

Deploy cluster:

./deploy_k8s_cluster.sh --tectonic

Enter your Kubernetes master node:

ssh core@k8s-master # [-i ~/.ssh/id_rsa]

Get Tectonic [email protected] password:

kubectl --namespace=tectonic-system get secret tectonic-identity-admin-password -o template --template="{{.data.password}}" | base64 -d && echo

Login Tectonic:

https://k8s-master:32000

Username: [email protected] Password: see above

Run other VMs

Linux

Run three CentOS VMs

./deploy_vms_cluster.sh -o centos -s 3

Windows

Run one Windows IE11.Win7 VM

./deploy_vms_cluster.sh -o windows -r IE11.Win7 -m 1024 -u 2

FreeBSD guest (experimental)

Download and run FreeBSD:

./deploy_vms_cluster.sh -o freebsd # for 10.3 RELEASE
./deploy_vms_cluster.sh -o freebsd -c 11.0 -r RC1 # for 11.0 RC1

FreeBSD QEMU images don't support cloud-init, so you have to configure network and ssh manually through the console:

dhclient vtnet0
echo 'sshd_enable=YES' >> /etc/rc.conf
echo 'ifconfig_DEFAULT=DHCP' >> /etc/rc.conf
echo 'PermitRootLogin yes' >> /etc/ssh/sshd_config
service sshd start
passwd

FreeBSD host (experimental)

pkg install bash wget bzip2 gnupg cdrtools libvirt qemu virt-manager
kldload vmm
libvirtd -d
ifconfig tap create
ifconfig bridge create
ifconfig bridge0 addm tap0 up

virt-install version > 1.4 should use following parameters:

--nographic \
--console nmdm,source.master=/dev/nmdm0A,source.slave=/dev/nmdm0B \
--network bridge=bridge0 \

and without --vnc flag. VNC flag produces following XML:

<graphics type="vnc" port="-1" keymap="en-us"/>

which causes internal error: cannot determine default video type error message.

Completely destroy and remove all related VMs cluster data

./remove_cluster.sh flatcar
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].