Last active
June 12, 2017 11:20
-
-
Save indriApollo/3747912d7c54200b4970f028fceb55fa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup | |
apt install qemu-kvm libvirt-bin virtinst bridge-utils | |
# modify /etc/network/interfaces (replace eth0 with br0) | |
auto br0 | |
iface br0 inet static | |
address 192.168.0.10 | |
network 192.168.0.0 | |
netmask 255.255.255.0 | |
broadcast 192.168.0.255 | |
gateway 192.168.0.1 | |
dns-nameservers 192.168.0.5 8.8.8.8 | |
dns-search example.com | |
bridge_ports eth0 | |
bridge_stp off | |
bridge_fd 0 | |
bridge_maxwait 0 | |
# reboot & check with: | |
brctl show br0 | |
cd /var/lib/libvirt/boot | |
wget http://releases.ubuntu.com/16.04.2/ubuntu-16.04.2-server-amd64.iso | |
cd /var/lib/libvirt/images | |
qemu-img create -f raw ubuntu-guest-2.img 20G | |
# virtio -> faster than ide | |
virt-install --name ubuntu-guest-2 \ | |
--memory 2048 --disk path=/var/lib/libvirt/images/ubuntu-guest-2.img,bus=virtio \ | |
--network bridge=br0 --cdrom=/var/lib/libvirt/boot/ubuntu-16.04.2-server-amd64.iso \ | |
--graphics vnc,listen=0.0.0.0,port=590x | |
# get vnc info | |
virsh dumpxml gitlab-vm | grep vnc | |
vncviewer iphost::590x # from tigervnc | |
# force stop | |
virsh destroy ubuntu-guest-2 | |
#comment vnc lines (<!-- -->) | |
virsh edit ubuntu-guest-2 | |
# to reload xml: | |
virsh define /etc/libvirt/qemu/ubuntu-guest-2.xml | |
virsh start ubuntu-guest-2 | |
# extra | |
# delete vm | |
virsh undefine ubuntu-guest-2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment