Развернем desktop:
Восстановление контейнера
# cd /var/lib/lxc
# tar xvzf d_lxc.tar.gz
# lxc-clone -o d_lxc -n kvm
# nano /var/lib/lxc/kvm/rootfs/etc/rc.local
!!!mkdir -p /dev/net || true
!!!mknod /dev/kvm c 10 232
!!!mknod /dev/net/tun c 10 200
!!!exit 0
mkdir -p /dev/net || true
mknod /dev/net/tun c 10 200
chmod 666 /dev/net/tun
mkdir -p /dev/kvm || true
mknod /dev/kvm c 10 232
exit 0
Сохранить.
Проверка:
# grep -v ^# /var/lib/lxc/kvm/rootfs/etc/rc.local
root@i7:~# grep -v ^# /var/lib/lxc/kvm/rootfs/etc/rc.local
mkdir -p /dev/net || true
mknod /dev/kvm c 10 232
mknod /dev/net/tun c 10 200
exit 0
.
# nano /var/lib/lxc/kvm/config
Сохранить.
!!!# grep -v ^# /var/lib/lxc/kvm/config
# lxc-start -n kvm -d
# lxc-ls -f
# ssh ubuntu@192.168.0.63
$ sudo -i
# apt-get update -y
# apt-get upgrade -y
# apt-get install mc samba wget nano -y
# apt-get install qemu-kvm libvirt-bin virtinst -y
qemu-kvm start/running
rmmod: ERROR: ../libkmod/libkmod-module.c:769 kmod_module_remove_module() could not remove 'kvm_intel': Operation not permitted
rmmod: ERROR: could not remove module kvm_intel: Operation not permitted
# kvm-ok
root@kvm:~# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
# cd /home/ubuntu
# wget http://mirror.yandex.ru/ubuntu-releases/14.04.5/ubuntu-14.04.5-server-amd64.iso
# virt-install --connect qemu:///system -n ubuntu1404-vm1 -s 10 -r 512 -f /var/lib/libvirt/images/ubuntu1404-vm1.img --vcpus=1 --os-variant ubuntutrusty --nographics --location ./ubuntu-14.04.5-server-amd64.iso --extra-args='console=tty0 console=ttyS0,115200n8' --keymap ru
# virt-install --connect qemu:///system -n ubuntu1404-vm1 -s 10 -r 512 -f /var/lib/libvirt/images/ubuntu1404-vm1.img --vcpus=1 --os-variant ubuntutrusty --nographics --location ./ubuntu-14.04.5-server-amd64.iso --extra-args='console=tty0 console=ttyS0,115200n8' --keymap ru
Работа с KVM в Debian или Ubuntu из командной строки
Старт контейнера
# lxc-start -n kvm -d
# lxc-ls -f
# ssh ubuntu@kvm
# apt-get update
# apt-get install bridge-utils -y
# apt-get remove network-manager -y
# reboot
# apt-get install qemu-kvm libvirt-bin virtinst -y
# mkdir -p /dev/kvm || true
# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
# apt-get install virt-manager -y
Восстановление контейнера
# cd /var/lib/lxc
# tar xvzf d_lxc.tar.gz
# lxc-clone -o d_lxc -n kvm
# nano /var/lib/lxc/kvm/rootfs/etc/rc.local
!!!mkdir -p /dev/net || true
!!!mknod /dev/kvm c 10 232
!!!mknod /dev/net/tun c 10 200
!!!exit 0
mkdir -p /dev/net || true
mknod /dev/net/tun c 10 200
chmod 666 /dev/net/tun
mkdir -p /dev/kvm || true
mknod /dev/kvm c 10 232
exit 0
Сохранить.
Проверка:
# grep -v ^# /var/lib/lxc/kvm/rootfs/etc/rc.local
root@i7:~# grep -v ^# /var/lib/lxc/kvm/rootfs/etc/rc.local
mkdir -p /dev/net || true
mknod /dev/kvm c 10 232
mknod /dev/net/tun c 10 200
exit 0
.
# nano /var/lib/lxc/kvm/config
lxc.cgroup.devices.allow = b 7:* rwm
lxc.cgroup.devices.allow = c 10:230 rwm
lxc.cgroup.devices.allow = c 10:232 rwm
Сохранить.
!!!# grep -v ^# /var/lib/lxc/kvm/config
# lxc-start -n kvm -d
# lxc-ls -f
# ssh ubuntu@192.168.0.63
$ sudo -i
# apt-get update -y
# apt-get upgrade -y
# apt-get install mc samba wget nano -y
qemu-kvm start/running
rmmod: ERROR: ../libkmod/libkmod-module.c:769 kmod_module_remove_module() could not remove 'kvm_intel': Operation not permitted
rmmod: ERROR: could not remove module kvm_intel: Operation not permitted
# kvm-ok
root@kvm:~# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
# cd /home/ubuntu
# wget http://mirror.yandex.ru/ubuntu-releases/14.04.5/ubuntu-14.04.5-server-amd64.iso
# virt-install --connect qemu:///system -n ubuntu1404-vm1 -s 10 -r 512 -f /var/lib/libvirt/images/ubuntu1404-vm1.img --vcpus=1 --os-variant ubuntutrusty --nographics --location ./ubuntu-14.04.5-server-amd64.iso --extra-args='console=tty0 console=ttyS0,115200n8' --keymap ru
# virt-install --connect qemu:///system -n ubuntu1404-vm1 -s 10 -r 512 -f /var/lib/libvirt/images/ubuntu1404-vm1.img --vcpus=1 --os-variant ubuntutrusty --nographics --location ./ubuntu-14.04.5-server-amd64.iso --extra-args='console=tty0 console=ttyS0,115200n8' --keymap ru
wget wget https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img
Работа с KVM в Debian или Ubuntu из командной строки
Старт контейнера
# lxc-start -n kvm -d
# lxc-ls -f
# ssh ubuntu@kvm
# apt-get update
# apt-get install bridge-utils -y
# apt-get remove network-manager -y
# reboot
# apt-get install qemu-kvm libvirt-bin virtinst -y
# mkdir -p /dev/kvm || true
# kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used
# apt-get install virt-manager -y
Комментариев нет:
Отправить комментарий