Build minimal install box of Centos 7 or 8. With 8 you can choose Virtual Host and Headless administration and it covers most of this right off the bat.
Watch your disk partitions! Changing storage after the fact isn’t terrible, but if you need to change storage, follow this: https://linuxconfig.org/configure-default-kvm-virtual-storage-on-redhat-linux#h6-1-create-new-virtual-storage-directory
SSH should be enabled and running:
sudo yum install openssh-server
sudo systemctl enable sshd
sudo systemctl start sshd
sudo systemctl status sshd
ssh to box:
yum -y update
yum -y install cockpit cockpit-machines
yum -y install qemu-kvm libvirt libvirt-python libguestfs-tools virt-install
yum -y install mc iperf3 iptraf-ng
yum -y install virt-install virt-viewer
systemctl start cockpit.socket
systemctl enable cockpit.socket
systemctl status cockpit.socket
firewall-cmd –add-service=cockpit –permanent
firewall-cmd –reload
# Cockpit is on: https://SERVER_IP:9090/
Centos 8 needs:
sudo systemctl enable –now cockpit.socket
modprobe fuse
virt-host-validate
systemctl start libvirtd.service
systemctl enable libvirtd.service
systemctl status libvirtd.service
If needed, set up network bridge:
Cockpit – Networking – Add Bridge
Select your ethernet card (em1)
Should now be able to build virtual machines from within cockpit. You might need to reload the page or go out and back in for it to figure out libvirt is enabled.
If you can’t build a new VM, reboot the box at least once before freaking out.
ISO’s to install from:
ISOs should live in /var/lib/libvirt/images/ probably want to mount that as a read only nfs mount:
go to cockpit – storage and add the NFS or SMB share, stupid easy.
Optional
Netdata: Install netdata on CentOS 7 (and for docker host stats)
Docker: You *can* do docker too:
yum install -y cockpit-docker
sudo systemctl restart cockpit.socket
But compared to Portainer, there’s no comparison. Doesn’t mean you can’t do both on one box though, just that the cockpit plugin is garbage. Use Portainer.
sudo dnf config-manager –add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf repolist -v
dnf list docker-ce –showduplicates | sort -r
dnf install –nobest docker-ce –allowerasing (Removes buildah and cockpit-podman and podman, that’s ok, they suck.)
sudo systemctl enable –now docker
systemctl is-active docker
systemctl is-enabled docker
Docker compose:
curl -L “https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)” -o docker-compose sudo mv docker-compose /usr/local/bin && sudo chmod +x /usr/local/bin/docker-compose
# Portainer
docker pull portainer/portainer:latest
docker volume create portainer_data
docker run -d –name portainer –restart unless-stopped -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer