Compile LXC

 

 


Version 3.0.4

 

準備

# Centos 7

yum install libcap-devel libacl-devel libseccomp-devel

yum install libseccomp libcap libacl

./configure flag

--with-distro=DISTRO

# centos, debian ...

--with-init-script[=TYPE[,TYPE,...]]

# Type(s) of init script to install: sysvinit, systemd, upstart, distro [default=distro]

--with-systemdsystemunitdir=DIR

# Directory for systemd service files

--with-config-path=dir

# lxc configuration repository path

MySetting

./configure \
--prefix=/opt/lxc \
--with-init-script=systemd \
--with-systemdsystemunitdir=/usr/lib/systemd/system \
--with-config-path=/var/lib/lxc \
--with-log-path=/var/log/lxc

make -j

make install

/usr/lib/systemd/system/lxc.service

[Unit]
Description=LXC Container Initialization and Autoboot Code
After=network.target lxc-net.service
Wants=lxc-net.service
Documentation=man:lxc-autostart man:lxc

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/opt/lxc/libexec/lxc/lxc-apparmor-load
ExecStart=/opt/lxc/libexec/lxc/lxc-containers start
ExecStop=/opt/lxc/libexec/lxc/lxc-containers stop
# Environment=BOOTUP=serial
# Environment=CONSOLETYPE=serial
Delegate=yes
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target