Skip to content

Instantly share code, notes, and snippets.

@romanblanco
Last active April 23, 2023 05:01
Show Gist options
  • Save romanblanco/3413a1da7380987a401d1e582ff389b4 to your computer and use it in GitHub Desktop.
Save romanblanco/3413a1da7380987a401d1e582ff389b4 to your computer and use it in GitHub Desktop.

KVM on OpenVZ

yum group install virtualization-host-environment
yum install virt-manager xauth
yum install qemu-kvm qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils
systemctl enable libvirtd
systemctl disable firewalld
reboot
systemctl start libvirtd
> [root@vps ~]# virsh -c qemu:///system list
>  Id    Name                           State
> ----------------------------------------------------

Add KVM module:

lsmod
rmmod kvm
modprobe -a kvm

Install VM

sudo virt-install --connect qemu:///system -n kvm1 -r 2048 --vcpus=2 \
--disk path=/var/lib/libvirt/images/kvm1-image.img,size=20 \
-c ./CentOS-8-x86_64-1905-dvd1.iso --vnc --noautoconsole --os-type linux \
--accelerate --network=network:default --hvm --vncport=5951

...

Install Wireguard

curl -Lo /etc/yum.repos.d/wireguard.repo https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install epel-release
yum install wireguard-dkms wireguard-tools
modprobe wireguard
mkdir /etc/wireguard && cd /etc/wireguard
bash -c 'umask 077; touch wg0-server.conf'
ip link add dev wg0-server type wireguard

Docker

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment