Lxc: Difference between revisions
From ICO wiki
Jump to navigationJump to search
Line 3: | Line 3: | ||
==Taust== | ==Taust== | ||
|-lvmetad | |||
|-lxc-autostart---systemd-+-5*[agetty] | |||
| |-cron | |||
| |-dhclient | |||
| |-mysqld---27*[{mysqld}] | |||
| |-rsyslogd-+-{in:imklog} | |||
| | |-{in:imuxsock} | |||
| | `-{rs:main Q:Reg} | |||
| `-systemd-journal | |||
|-lxc-autostart---systemd-+-5*[agetty] | |||
| |-cron | |||
| |-dbus-daemon | |||
| |-dhclient | |||
| |-gogs---9*[{gogs}] | |||
| |-nginx---2*[nginx] | |||
| |-postgres---7*[postgres] | |||
| |-rsyslogd-+-{in:imklog} | |||
| | |-{in:imuxsock} | |||
| | |-{rs:action 10 qu} | |||
| | `-{rs:main Q:Reg} | |||
| |-sshd---sshd---sshd | |||
| |-systemd-journal | |||
| `-systemd-logind | |||
|-lxc-autostart---systemd-+-5*[agetty] | |||
| |-apache2---6*[apache2] | |||
| |-cron | |||
| |-dbus-daemon | |||
| |-dhclient | |||
| |-mysqld---34*[{mysqld}] | |||
| |-php-fpm7.0---2*[php-fpm7.0] | |||
| |-rsyslogd-+-{in:imklog} | |||
| | |-{in:imuxsock} | |||
| | |-{rs:action 10 qu} | |||
| | `-{rs:main Q:Reg} | |||
| |-sshd | |||
| |-systemd-journal | |||
| `-systemd-logind | |||
|-lxc-autostart---systemd-+-5*[agetty] | |||
| |-apache2---5*[apache2] | |||
| |-cron | |||
| |-dbus-daemon | |||
| |-dhclient | |||
| |-logger | |||
| |-mysqld_safe-+-logger | |||
| | `-mysqld---23*[{mysqld}] | |||
| |-rsyslogd-+-{in:imklog} | |||
| | |-{in:imuxsock} | |||
| | |-{rs:action 10 qu} | |||
| | `-{rs:main Q:Reg} | |||
| |-sshd | |||
| |-systemd-journal | |||
| `-systemd-logind | |||
|-lxc-autostart---systemd-+-5*[agetty] | |||
| |-cron | |||
| |-dbus-daemon | |||
| |-dhclient | |||
| |-gunicorn---gunicorn | |||
| |-nginx---2*[nginx] | |||
| |-nrpe | |||
| |-rsyslogd-+-{in:imklog} | |||
| | |-{in:imuxsock} | |||
| | |-{rs:action 10 qu} | |||
| | `-{rs:main Q:Reg} | |||
| |-sshd | |||
| |-systemd-journal | |||
| `-systemd-logind | |||
|-lxc-autostart---systemd-+-5*[agetty] | |||
| |-cron | |||
| |-dbus-daemon | |||
| |-dhclient | |||
| |-nginx---2*[nginx] | |||
| |-rsyslogd-+-{in:imklog} | |||
| | |-{in:imuxsock} | |||
| | |-{rs:action 0 que} | |||
| | `-{rs:main Q:Reg} | |||
| |-systemd-journal | |||
| `-systemd-logind | |||
|-lxcfs---10*[{lxcfs}] | |||
|-mdadm | |||
=Vajalikumad käsud= | =Vajalikumad käsud= |
Revision as of 18:35, 16 December 2016
Sissejuhatus
Linuxi konteinerid ehk LXC on tehnoloogia mis kasutab Linuxi tuuma control groups funktsionaalsust, mis võimaldab jooksutada mitut isoleeritut Linuxi oeratsioonisüsteemi, host masinas ühe jagatud kerneli peal. Lihtsamalt seletades jagab ühe arvuti resursse mitme konteineri vahel ja kasutatakse ühist kernelit. Resursside jagamise eest vastutabki control groupsi funktsionaalsus kernelis. Namespace selle eest, et konteinerid oleksid ükteisest eraldatud, ühe konteineri seest ei saaks ligi teise teenustele. LXC on kasutatav alates kernelist 2.6.24
Taust
|-lvmetad |-lxc-autostart---systemd-+-5*[agetty] | |-cron | |-dhclient | |-mysqld---27*[{mysqld}] | |-rsyslogd-+-{in:imklog} | | |-{in:imuxsock} | | `-{rs:main Q:Reg} | `-systemd-journal |-lxc-autostart---systemd-+-5*[agetty] | |-cron | |-dbus-daemon | |-dhclient | |-gogs---9*[{gogs}] | |-nginx---2*[nginx] | |-postgres---7*[postgres] | |-rsyslogd-+-{in:imklog} | | |-{in:imuxsock} | | |-{rs:action 10 qu} | | `-{rs:main Q:Reg} | |-sshd---sshd---sshd | |-systemd-journal | `-systemd-logind |-lxc-autostart---systemd-+-5*[agetty] | |-apache2---6*[apache2] | |-cron | |-dbus-daemon | |-dhclient | |-mysqld---34*[{mysqld}] | |-php-fpm7.0---2*[php-fpm7.0] | |-rsyslogd-+-{in:imklog} | | |-{in:imuxsock} | | |-{rs:action 10 qu} | | `-{rs:main Q:Reg} | |-sshd | |-systemd-journal | `-systemd-logind |-lxc-autostart---systemd-+-5*[agetty] | |-apache2---5*[apache2] | |-cron | |-dbus-daemon | |-dhclient | |-logger | |-mysqld_safe-+-logger | | `-mysqld---23*[{mysqld}] | |-rsyslogd-+-{in:imklog} | | |-{in:imuxsock} | | |-{rs:action 10 qu} | | `-{rs:main Q:Reg} | |-sshd | |-systemd-journal | `-systemd-logind |-lxc-autostart---systemd-+-5*[agetty] | |-cron | |-dbus-daemon | |-dhclient | |-gunicorn---gunicorn | |-nginx---2*[nginx] | |-nrpe | |-rsyslogd-+-{in:imklog} | | |-{in:imuxsock} | | |-{rs:action 10 qu} | | `-{rs:main Q:Reg} | |-sshd | |-systemd-journal | `-systemd-logind |-lxc-autostart---systemd-+-5*[agetty] | |-cron | |-dbus-daemon | |-dhclient | |-nginx---2*[nginx] | |-rsyslogd-+-{in:imklog} | | |-{in:imuxsock} | | |-{rs:action 0 que} | | `-{rs:main Q:Reg} | |-systemd-journal | `-systemd-logind |-lxcfs---10*[{lxcfs}] |-mdadm
Vajalikumad käsud
lxc-create - tehakse uus konteiner lxc-start - käivitatakse lxc-console - ühendab konteineris oleva masina terminaliga. lxc-attach - alustab protsessi konteiner masinas, kui ühtegi parameetrit juurde ei anta, siis võetakse host masin konsool ja ühendatakse see konteineriga.Näiteks oled host masinas root kasutajaga sisse logitud, siis tuleb ette root konsool ka konteineris. lxc-stop - sulgeb masina
Seadistamine
Paigaldamine
Installine linux konteineri ja mallid milleg teha konteinereid.
apt-get install lxc lxc-templates bridge-utils
Konteinerite tegemine
lxc-create -n test -t ubuntu -- -r xenial
Haldamine ja seadistamine
Konteineri kävitaimnine
lxc-start -n test -d
Konteineriga ühendamine
lxc-attach -n katse
Võrgu seadistamine
Turvalisus
Konteinerite tegemine