OpenVZ
Sissejuhatus
XEN tehnoloogia pole alati sobiv eriti kui pole soovi kasutada erinevaid operatsoonisüstemee vaid sama os põhiseid eraldatud masinaid. OpenVZ ideaalne lahendus.
OpenVZ kasutab Operating system-level virtualiseerimist
virtualizing a physical server at the operating system level, enabling multiple isolated and secure virtualized servers to run on a single physical server. The "guest" OS environments share the same OS as the host system – i.e. the same OS kernel is used to implement the "guest" environments. Applications running in a given "guest" environment view it as a stand-alone system. Examples are Linux-VServer, Virtuozzo (for Windows or Linux), OpenVZ, Solaris Containers, and FreeBSD Jails.
OpenVZ is an open source container-based virtualization solution built on Linux. OpenVZ creates isolated, secure containers (otherwise known as VEs or VPSs) on a single physical server enabling better server utilization and ensuring that applications do not conflict. Each container performs and executes exactly like a stand-alone server; containers can be rebooted independently and have root access, users, IP addresses, memory, processes, files,
As OpenVZ employs a single kernel model, it is as scalable as the 2.6 Linux kernel; that is, it supports up to 64 CPUs and up to 64 GiB of RAM.[citation needed] A single container can scale up to the whole physical box, i.e. use all the CPUs and all the RAM. The OpenVZ is divided into a custom kernel and user-level tools.
Antud pala keskendub OpenVz kasutamisele Gentoo all.
Install
Süsteemi aluseks on valitud gentoo ning antud õpetus sobib vaid sellele operatsioonisüsteemile
Esimesena tuleb teha openvz toega kernel selleleks emergeda openvz patchiga kerneli kood
emerge openvz-sources
edasi siis järgnevad käsud ei hakka peatuma pikemalt linuxi kerneli tegemisel kuna pikem pala
cd /usr/src/linux make menuconfig ...
Seejärel paigaldame openvz utiliidid. Seadistame selle peale rebooti startima ning käivitame.
emerge vzctl rc-update add vz default /etc/init.d/vz start
kaks moodulit. failisüsteemiks ja interneti kasutamiseks
modprobe simfs modprobe vzethdev
need võib lisada ka faili /etc/modules.autoload.d/kernel-2.6 ,et reboodil automaatselt moodulit laetaks
Tõmbame gentoo stage alla näiteks saame selle aadressilt
ftp://ftp.eenet.ee/pub/gentoo/releases/x86/2007.0/stages/
mv stage3-x86-2007.0.tar.bz2 /vz/template/cache bunzip2 stage3-x86-2007.0.tar.bz2 mv stage3-x86-2007.0.tar stage3.tar gzip stage3.tar
Loome openvz masina mille id'ks 800 id alusel käib kogu virtuaalse masinaga töö. Allapoole 100 on id'd reserveeritud
vzctl create 800 --ostemplate stage3
Masina suuruseks tuleb umbes 400Mb
stardime masina
vzctl start 800
ja siseneme sellesse
vzctl enter 800
protsessitabel, nagu näha on pilt väga minimaalne
# ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.2 1564 544 ? Ss 18:47 0:00 init [3] root 29955 0.0 0.2 1928 452 ? Ss 19:16 0:00 vzctl: pts/0 root 29956 0.0 0.7 2664 1544 pts/0 Ss 19:16 0:00 -bash root 24172 0.0 0.4 2192 888 pts/0 R+ 19:37 0:00 ps -aux
Veel üks tähtis asi ,et /dev kaustas töötaksid deviced tuleb teha muudatus faili
/vz/private/800/etc/conf.d/rc
kus tuleb muuta RC_DEVICES selliseks
RC_DEVICES="static"
Probleem seisneb selles ,et udev ei taha millegipärast korrektselt töötada koos vz'iga
Võrgu seadistus
Võrgu seadistamine peaks töötama ka lihtsamalt kohe vz masinat luues kuid millegipärast tõrkus see süsteem
ip mille annan virtuaalsele masinale 800 on 193.40.0.193 netmaskiga 255.255.255.128 ruuteriks on 193.40.0.129
echo 1 > /proc/sys/net/ipv4/conf/eth0/forwarding echo 1 > /proc/sys/net/ipv4/conf/eth0/proxy_arp
vzctl set 900 --veth_add veth900.0,00:12:34:56:78:9A,eth0,00:12:34:56:78:9B --save ifconfig veth900.0 0
Warning: --veth_add option is outdated use --netif_add instead Configure meminfo: 49152 Configure veth devices: veth101.0 Saved parameters for VE 800
echo 1 > /proc/sys/net/ipv4/conf/veth900.0/forwarding echo 1 > /proc/sys/net/ipv4/conf/veth900.0/proxy_arp
vzctl exec 900 ifconfig eth0 0 vzctl exec 900 ifconfig eth0 193.40.0.193 netmask 255.255.255.128 vzctl exec 900 route add default dev eth0 route add 193.40.0.193 dev veth900.0
serveripoolt peaksime nägema
# ifconfig veth900.0 veth900.0 Link encap:Ethernet HWaddr 00:12:34:56:78:9A UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:6569 errors:0 dropped:0 overruns:0 frame:0 TX packets:7785 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1011288 (987.5 Kb) TX bytes:7733410 (7.3 Mb)
Edasine häälestus
Portide ühendamine vz masina külge
mkdir /vz/private/800/usr/portage mount -o bind /usr/portage /vz/private/800/usr/portage
Lingid
http://www.gentoo.org/proj/en/vps/openvz-howto.xml
http://wiki.openvz.org/Virtual_Ethernet_device
http://wiki.openvz.org/Gentoo_template_creation
http://wiki.openvz.org/Getting_started_with_OpenVZ_live_CD
Võrdlustabel operatsioonisüsteemi virtualiseerimisest
http://en.wikipedia.org/wiki/Operating_system-level_virtualization
Veebihaldus