User Tools

Site Tools


технология_lxc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
технология_lxc [2020/06/22 20:24]
val [Управление учетными записями в дочерней системе]
технология_lxc [2022/07/23 21:56]
val [Создание ветки дочерней системы]
Line 3: Line 3:
   * [[http://​ru.wikipedia.org/​wiki/​LXC|LXC wiki]]   * [[http://​ru.wikipedia.org/​wiki/​LXC|LXC wiki]]
   * [[https://​help.ubuntu.com/​lts/​serverguide/​lxc.html|Ubuntu-Руководство по Ubuntu Server-Виртуализация]]   * [[https://​help.ubuntu.com/​lts/​serverguide/​lxc.html|Ubuntu-Руководство по Ubuntu Server-Виртуализация]]
 +  * [[https://​linuxcontainers.org/​lxc/​getting-started/​|LXC Getting started]]
  
  
Line 31: Line 32:
         gateway 192.168.X.1         gateway 192.168.X.1
         ​         ​
-#        ​bridge_ports eth0 +        ​bridge_ports eth0
-#        bridge_ports enp0s3+
  
 #        bridge_stp off #        bridge_stp off
Line 48: Line 48:
  
 root@server:​~#​ cat /​etc/​default/​lxc root@server:​~#​ cat /​etc/​default/​lxc
 +</​code><​code>​
 +...
 +#[ ! -f /​etc/​default/​lxc-net ] || . /​etc/​default/​lxc-net
 +</​code>​
  
 +  ИЛИ
 +
 +<​code>​
 root@server:​~#​ cat /​etc/​default/​lxc-net root@server:​~#​ cat /​etc/​default/​lxc-net
 </​code><​code>​ </​code><​code>​
Line 60: Line 67:
  
 ==== Создание ветки дочерней системы ==== ==== Создание ветки дочерней системы ====
 +
 +=== Debian ===
 <​code>​ <​code>​
 debian# lxc-create -t debian -n www debian# lxc-create -t debian -n www
 </​code>​ </​code>​
  
 +=== Ubuntu ===
 +<​code>​
 +ubuntu# lxc-create -t download -n www -- -d ubuntu -r focal -a amd64
 +</​code>​
 ==== Установка ПО в дочерней системе ==== ==== Установка ПО в дочерней системе ====
 <​code>​ <​code>​
Line 90: Line 103:
 ==== Управление учетными записями в дочерней системе ==== ==== Управление учетными записями в дочерней системе ====
 <​code>​ <​code>​
-www:/# getent passwd 
- 
 www:/# passwd www:/# passwd
-123+... 123
  
 www:/# exit www:/# exit
Line 105: Line 116:
 </​code><​code>​ </​code><​code>​
 ... ...
-#​lxc.network.link = lxcbr0 
-... 
-# lxc.network.hwaddr = 00:​16:​3e:​5c:​c0:​fb # need comment 
-lxc.network.type = veth 
-lxc.network.flags = up 
-lxc.network.link = br0 
-lxc.network.ipv4 = 192.168.X.20/​24 
-lxc.network.ipv4.gateway = 192.168.X.1 
  
 lxc.net.0.type = veth lxc.net.0.type = veth
Line 132: Line 135:
  
 root@server:​~#​ lxc-attach -n www -- ps ax root@server:​~#​ lxc-attach -n www -- ps ax
 +  или
 +root@server:​~#​ ps -eo pid,cmd,lxc | grep www
 +
 root@server:​~#​ lxc-attach -n www -- /bin/bash root@server:​~#​ lxc-attach -n www -- /bin/bash
  
Line 140: Line 146:
 root@server:​~#​ systemctl start lxc@www root@server:​~#​ systemctl start lxc@www
  
- 
-debian9# systemctl edit lxc@server 
- 
-  или 
- 
-debian9# mkdir /​etc/​systemd/​system/​lxc@www.service.d/​ 
-debian9# cat /​etc/​systemd/​system/​lxc@www.service.d/​kill_signal_fix.conf 
-</​code><​code>​ 
-[Service] 
-KillSignal=SIGRTMIN+3 
-</​code><​code>​ 
 root@server:​~#​ systemctl stop lxc@www root@server:​~#​ systemctl stop lxc@www
 </​code>​ </​code>​
технология_lxc.txt · Last modified: 2022/07/28 12:21 by val