lxc: running virtualbox inside a container
lxc: запуск virtualbox внутри контейнера
KVM in LXD · GitHub
Ubuntu 16.04: run KVM(qemu-kvm) in LXD container
VM inside container
lxc config device add CONTAINER kvm unix-char path=/dev/kvm
Cannot run KVM inside privileged container with KVM device exposed #3393
KVM внутри контейнера LXC
Use virt-manager as a non-root user on Linux
KVM и виртуалки с Windows
$ lxc launch ubuntu:18.04 kvm
$ lxc exec kvm /bin/bash
## passwd
# adduser user
# usermod -aG sudo user
# apt update
## apt upgrade
## apt install qemu-user-static -y
# apt install mc samba sudo ssh wget -y
# dpkg-reconfigure locales
## Выбираем ru_RU.UTF-8 ru_RU.UTF-8 UTF-8
# locale -a
## timedatectl set-timezone Europe/Moscow
# dpkg-reconfigure tzdata
## apt install keyboard-configuration
# dpkg-reconfigure keyboard-configuration
# nano /etc/ssh/sshd_config
#PasswordAuthentication no
PasswordAuthentication yes
Сохранить.
# systemctl reload sshd
#apt install tasksel
# tasksel --list-tasks
# tasksel install xubuntu-core
# apt install xrdp
# systemctl enable xrdp
## apt install x2goserver x2goserver-xsession
# reboot
#$ lxc start kvm
#$ lxc config set kvm security.privileged true
$ lxc config device add kvm kvm unix-char path=/dev/kvm mode=0777
$ lxc config device add kvm tun unix-char path=/dev/net/tun mode=0777
$ lxc config set kvm linux.kernel_modules openvswitch,nbd,ip_tables,ip6_tables,kvm
$ lxc config set kvm security.nesting true
$ printf 'lxc.cgroup.devices.allow = c 10:232 rwm' | lxc config set kvm raw.lxc -
$ lxc config edit kvm
$ lxc restart kvm
--------------------------------------------------
Выяснить нужно или нет?
$ lxc exec kvm -- getent group kvm
kvm:x:131:user
$ lxc config device set kvm kvm gid 131
$ lxc exec kvm -- ls -lh /dev/kvm
crwxrwxrwx 1 root kvm 10, 232 Nov 28 17:21 /dev/kvm
--------------------------------------------------
В контейнере:
$ sudo apt install qemu-kvm libvirt-bin bridge-utils
$ sudo apt install virt-manager
$ ip a
inet 192.168.0.246/24
$ sudo nano /etc/netplan/01-network-manager-all.yaml
$ sudo nano /etc/netplan/50-cloud-init.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
bridges:
br0:
interfaces: [eth0]
addresses: [192.168.0.246/24]
gateway4: 192.168.0.1
mtu: 1500
nameservers:
addresses: [8.8.8.8]
parameters:
stp: true
forward-delay: 4
dhcp4: no
dhcp6: no
Сохранить.
$ sudo netplan generate
$ sudo netplan --debug apply
#$ sudo systemctl stop networking.service
#$ sudo systemctl disable networking.service
$ sudo chgrp kvm /dev/kvm
$ sudo usermod -a -G libvirt $(whoami)
-----------------------------------------------------
Выяснить нужно или нет?
$ sudo usermod -a -G kvm $(whoami)
-----------------------------------------------------
$ sudo apt install firefox
$ virt-manager
lxc: запуск virtualbox внутри контейнера
KVM in LXD · GitHub
Ubuntu 16.04: run KVM(qemu-kvm) in LXD container
VM inside container
lxc config device add CONTAINER kvm unix-char path=/dev/kvm
Cannot run KVM inside privileged container with KVM device exposed #3393
KVM внутри контейнера LXC
Use virt-manager as a non-root user on Linux
KVM и виртуалки с Windows
$ lxc launch ubuntu:18.04 kvm
$ lxc exec kvm /bin/bash
## passwd
# adduser user
# usermod -aG sudo user
# apt update
## apt upgrade
## apt install qemu-user-static -y
# apt install mc samba sudo ssh wget -y
# dpkg-reconfigure locales
## Выбираем ru_RU.UTF-8 ru_RU.UTF-8 UTF-8
# locale -a
## timedatectl set-timezone Europe/Moscow
# dpkg-reconfigure tzdata
## apt install keyboard-configuration
# dpkg-reconfigure keyboard-configuration
# nano /etc/ssh/sshd_config
#PasswordAuthentication no
PasswordAuthentication yes
Сохранить.
# systemctl reload sshd
#apt install tasksel
# tasksel --list-tasks
# tasksel install xubuntu-core
# apt install xrdp
# systemctl enable xrdp
## apt install x2goserver x2goserver-xsession
# reboot
#$ lxc start kvm
#$ lxc config set kvm security.privileged true
$ lxc config device add kvm kvm unix-char path=/dev/kvm mode=0777
$ lxc config device add kvm tun unix-char path=/dev/net/tun mode=0777
$ lxc config set kvm linux.kernel_modules openvswitch,nbd,ip_tables,ip6_tables,kvm
$ lxc config set kvm security.nesting true
$ printf 'lxc.cgroup.devices.allow = c 10:232 rwm' | lxc config set kvm raw.lxc -
$ lxc config edit kvm
$ lxc restart kvm
--------------------------------------------------
Выяснить нужно или нет?
$ lxc exec kvm -- getent group kvm
kvm:x:131:user
$ lxc config device set kvm kvm gid 131
$ lxc exec kvm -- ls -lh /dev/kvm
crwxrwxrwx 1 root kvm 10, 232 Nov 28 17:21 /dev/kvm
--------------------------------------------------
В контейнере:
$ sudo apt install qemu-kvm libvirt-bin bridge-utils
$ sudo apt install virt-manager
$ ip a
inet 192.168.0.246/24
$ sudo nano /etc/netplan/01-network-manager-all.yaml
$ sudo nano /etc/netplan/50-cloud-init.yaml
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
bridges:
br0:
interfaces: [eth0]
addresses: [192.168.0.246/24]
gateway4: 192.168.0.1
mtu: 1500
nameservers:
addresses: [8.8.8.8]
parameters:
stp: true
forward-delay: 4
dhcp4: no
dhcp6: no
Сохранить.
$ sudo netplan generate
$ sudo netplan --debug apply
#$ sudo systemctl stop networking.service
#$ sudo systemctl disable networking.service
$ sudo chgrp kvm /dev/kvm
$ sudo usermod -a -G libvirt $(whoami)
-----------------------------------------------------
Выяснить нужно или нет?
$ sudo usermod -a -G kvm $(whoami)
-----------------------------------------------------
$ sudo apt install firefox
$ virt-manager
Комментариев нет:
Отправить комментарий