コンテナ型仮想環境を導入してみます。
user1@plum:~$ sudo apt-get install lxc [sudo] password for user1: Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: apparmor cgmanager libapparmor-perl liblxc1 libseccomp2 python3-lxc rsync Suggested packages: apparmor-profiles apparmor-docs apparmor-utils cgmanager-utils btrfs-tools lvm2 lxctl Recommended packages: uidmap lxc-templates The following NEW packages will be installed: apparmor cgmanager libapparmor-perl liblxc1 libseccomp2 lxc python3-lxc rsync 0 upgraded, 8 newly installed, 0 to remove and 2 not upgraded. Need to get 982 kB of archives. After this operation, 3058 kB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main cgmanager armhf 0.24-0ubuntu7 [45.7 kB] Get:2 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main rsync armhf 3.1.0-2ubuntu0.1 [262 kB] Get:3 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libseccomp2 armhf 2.1.0+dfsg-1 [28.2 kB] Get:4 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main liblxc1 armhf 1.0.4-0ubuntu0.1 [133 kB] Get:5 http://ports.ubuntu.com/ubuntu-ports/ trusty/main libapparmor-perl armhf 2.8.95~2430-0ubuntu5 [24.6 kB] Get:6 http://ports.ubuntu.com/ubuntu-ports/ trusty/main apparmor armhf 2.8.95~2430-0ubuntu5 [279 kB] Get:7 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main python3-lxc armhf 1.0.4-0ubuntu0.1 [17.7 kB] Get:8 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main lxc armhf 1.0.4-0ubuntu0.1 [191 kB] Fetched 982 kB in 5s (189 kB/s) Preconfiguring packages ... Selecting previously unselected package cgmanager. (Reading database ... 25389 files and directories currently installed.) Preparing to unpack .../cgmanager_0.24-0ubuntu7_armhf.deb ... Unpacking cgmanager (0.24-0ubuntu7) ... Selecting previously unselected package rsync. Preparing to unpack .../rsync_3.1.0-2ubuntu0.1_armhf.deb ... Unpacking rsync (3.1.0-2ubuntu0.1) ... Selecting previously unselected package libseccomp2:armhf. Preparing to unpack .../libseccomp2_2.1.0+dfsg-1_armhf.deb ... Unpacking libseccomp2:armhf (2.1.0+dfsg-1) ... Selecting previously unselected package liblxc1. Preparing to unpack .../liblxc1_1.0.4-0ubuntu0.1_armhf.deb ... Unpacking liblxc1 (1.0.4-0ubuntu0.1) ... Selecting previously unselected package libapparmor-perl. Preparing to unpack .../libapparmor-perl_2.8.95~2430-0ubuntu5_armhf.deb ... Unpacking libapparmor-perl (2.8.95~2430-0ubuntu5) ... Selecting previously unselected package apparmor. Preparing to unpack .../apparmor_2.8.95~2430-0ubuntu5_armhf.deb ... Unpacking apparmor (2.8.95~2430-0ubuntu5) ... Selecting previously unselected package python3-lxc. Preparing to unpack .../python3-lxc_1.0.4-0ubuntu0.1_armhf.deb ... Unpacking python3-lxc (1.0.4-0ubuntu0.1) ... Selecting previously unselected package lxc. Preparing to unpack .../lxc_1.0.4-0ubuntu0.1_armhf.deb ... Unpacking lxc (1.0.4-0ubuntu0.1) ... Processing triggers for man-db (2.6.7.1-1) ... Processing triggers for ureadahead (0.100.0-16) ... Setting up cgmanager (0.24-0ubuntu7) ... cgmanager start/running, process 5716 cgproxy stop/pre-start, process 5754 Setting up rsync (3.1.0-2ubuntu0.1) ... Removing any system startup links for /etc/init.d/rsync ... update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match rsync Default-Stop values (none) Adding system startup for /etc/init.d/rsync ... /etc/rc0.d/K20rsync -> ../init.d/rsync /etc/rc1.d/K20rsync -> ../init.d/rsync /etc/rc6.d/K20rsync -> ../init.d/rsync /etc/rc2.d/S20rsync -> ../init.d/rsync /etc/rc3.d/S20rsync -> ../init.d/rsync /etc/rc4.d/S20rsync -> ../init.d/rsync /etc/rc5.d/S20rsync -> ../init.d/rsync Setting up libseccomp2:armhf (2.1.0+dfsg-1) ... Setting up libapparmor-perl (2.8.95~2430-0ubuntu5) ... Setting up apparmor (2.8.95~2430-0ubuntu5) ... Processing triggers for ureadahead (0.100.0-16) ... Setting up liblxc1 (1.0.4-0ubuntu0.1) ... Setting up python3-lxc (1.0.4-0ubuntu0.1) ... Setting up lxc (1.0.4-0ubuntu0.1) ... lxc start/running Setting up lxc dnsmasq configuration. * Restarting DNS forwarder and DHCP server dnsmasq [ OK ] Processing triggers for libc-bin (2.19-0ubuntu6) ... Processing triggers for ureadahead (0.100.0-16) ... localepurge: Disk space freed in /usr/share/locale: 0 KiB localepurge: Disk space freed in /usr/share/man: 0 KiB Total disk space freed by localepurge: 0 KiB user1@plum:~$
user1@plum:~$ sudo apt-get install lxc-templates Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: qemu-user-static Recommended packages: busybox-static cloud-image-utils cloud-utils debootstrap cdebootstrap uuid-runtime The following NEW packages will be installed: lxc-templates 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 61.4 kB of archives. After this operation, 381 kB of additional disk space will be used. Get:1 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main lxc-templates armhf 1.0.4-0ubuntu0.1 [61.4 kB] Fetched 61.4 kB in 1s (53.9 kB/s) Selecting previously unselected package lxc-templates. (Reading database ... 25737 files and directories currently installed.) Preparing to unpack .../lxc-templates_1.0.4-0ubuntu0.1_armhf.deb ... Unpacking lxc-templates (1.0.4-0ubuntu0.1) ... Setting up lxc-templates (1.0.4-0ubuntu0.1) ... localepurge: Disk space freed in /usr/share/locale: 0 KiB localepurge: Disk space freed in /usr/share/man: 0 KiB Total disk space freed by localepurge: 0 KiB user1@plum:~$
user1@plum:~$ sudo apt-get install debootstrap Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: debootstrap 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 30.0 kB of archives. After this operation, 233 kB of additional disk space will be used. Get:1 http://ports.ubuntu.com/ubuntu-ports/ trusty-updates/main debootstrap all 1.0.59ubuntu0.1 [30.0 kB] Fetched 30.0 kB in 0s (35.8 kB/s) Selecting previously unselected package debootstrap. (Reading database ... 25759 files and directories currently installed.) Preparing to unpack .../debootstrap_1.0.59ubuntu0.1_all.deb ... Unpacking debootstrap (1.0.59ubuntu0.1) ... Processing triggers for man-db (2.6.7.1-1) ... Setting up debootstrap (1.0.59ubuntu0.1) ... localepurge: Disk space freed in /usr/share/locale: 0 KiB localepurge: Disk space freed in /usr/share/man: 0 KiB Total disk space freed by localepurge: 0 KiB user1@plum:~$
lxc-create コマンドにより、仮想環境を作成します。
Debian “Wheezy” の環境を作成してみます。
user1@plum:~$ sudo lxc-create -t debian -n debian debootstrap is /usr/sbin/debootstrap Checking cache download in /var/cache/lxc/debian/rootfs-wheezy-armhf ... Downloading debian minimal ... W: Cannot check Release signature; keyring file not available /usr/share/keyrings/debian-archive-keyring.gpg I: Retrieving Release I: Retrieving Packages I: Validating Packages I: Resolving dependencies of required packages... I: Resolving dependencies of base packages... I: Found additional required dependencies: insserv libbz2-1.0 libdb5.1 libsemanage-common libsemanage1 libslang2 libustr-1.0-1 I: Found additional base dependencies: adduser debian-archive-keyring gnupg gpgv isc-dhcp-common libapt-pkg4.12 libbsd0 libclass-isa-perl libedit2 libgdbm3 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libncursesw5 libprocps0 libreadline6 libssl1.0.0 libstdc++6 libswitch-perl libusb-0.1-4 libwrap0 openssh-client perl perl-modules procps readline-common I: Checking component main on http://cdn.debian.net/debian... I: Retrieving libacl1 2.2.51-8 I: Validating libacl1 2.2.51-8 I: Retrieving adduser 3.113+nmu3 I: Validating adduser 3.113+nmu3 I: Retrieving apt 0.9.7.9+deb7u2 I: Validating apt 0.9.7.9+deb7u2 I: Retrieving libapt-pkg4.12 0.9.7.9+deb7u2 I: Validating libapt-pkg4.12 0.9.7.9+deb7u2 I: Retrieving libattr1 1%3a2.4.46-8 I: Validating libattr1 1%3a2.4.46-8 I: Retrieving base-files 7.1wheezy6 I: Validating base-files 7.1wheezy6 I: Retrieving base-passwd 3.5.26 I: Validating base-passwd 3.5.26 I: Retrieving bash 4.2+dfsg-0.1 I: Validating bash 4.2+dfsg-0.1 I: Retrieving libbz2-1.0 1.0.6-4 I: Validating libbz2-1.0 1.0.6-4 I: Retrieving coreutils 8.13-3.5 I: Validating coreutils 8.13-3.5 I: Retrieving dash 0.5.7-3 I: Validating dash 0.5.7-3 I: Retrieving libdb5.1 5.1.29-5 I: Validating libdb5.1 5.1.29-5 I: Retrieving debconf 1.5.49 I: Validating debconf 1.5.49 I: Retrieving debconf-i18n 1.5.49 I: Validating debconf-i18n 1.5.49 I: Retrieving debian-archive-keyring 2012.4 I: Validating debian-archive-keyring 2012.4 I: Retrieving debianutils 4.3.2 I: Validating debianutils 4.3.2 I: Retrieving dialog 1.1-20120215-2 I: Validating dialog 1.1-20120215-2 I: Retrieving diffutils 1%3a3.2-6 I: Validating diffutils 1%3a3.2-6 I: Retrieving dpkg 1.16.15 I: Validating dpkg 1.16.15 I: Retrieving e2fslibs 1.42.5-1.1 I: Validating e2fslibs 1.42.5-1.1 I: Retrieving e2fsprogs 1.42.5-1.1 I: Validating e2fsprogs 1.42.5-1.1 I: Retrieving libcomerr2 1.42.5-1.1 I: Validating libcomerr2 1.42.5-1.1 I: Retrieving libss2 1.42.5-1.1 I: Validating libss2 1.42.5-1.1 I: Retrieving libc-bin 2.13-38+deb7u2 I: Validating libc-bin 2.13-38+deb7u2 I: Retrieving libc6 2.13-38+deb7u2 I: Validating libc6 2.13-38+deb7u2 I: Retrieving locales 2.13-38+deb7u2 I: Validating locales 2.13-38+deb7u2 I: Retrieving multiarch-support 2.13-38+deb7u2 I: Validating multiarch-support 2.13-38+deb7u2 I: Retrieving findutils 4.4.2-4 I: Validating findutils 4.4.2-4 I: Retrieving gcc-4.7-base 4.7.2-5 I: Validating gcc-4.7-base 4.7.2-5 I: Retrieving libgcc1 1%3a4.7.2-5 I: Validating libgcc1 1%3a4.7.2-5 I: Retrieving libstdc++6 4.7.2-5 I: Validating libstdc++6 4.7.2-5 I: Retrieving libgdbm3 1.8.3-11 I: Validating libgdbm3 1.8.3-11 I: Retrieving gnupg 1.4.12-7+deb7u4 I: Validating gnupg 1.4.12-7+deb7u4 I: Retrieving gpgv 1.4.12-7+deb7u4 I: Validating gpgv 1.4.12-7+deb7u4 I: Retrieving grep 2.12-2 I: Validating grep 2.12-2 I: Retrieving gzip 1.5-1.1 I: Validating gzip 1.5-1.1 I: Retrieving hostname 3.11 I: Validating hostname 3.11 I: Retrieving ifupdown 0.7.8 I: Validating ifupdown 0.7.8 I: Retrieving insserv 1.14.0-5 I: Validating insserv 1.14.0-5 I: Retrieving iproute 20120521-3+b3 I: Validating iproute 20120521-3+b3 I: Retrieving isc-dhcp-client 4.2.2.dfsg.1-5+deb70u6 I: Validating isc-dhcp-client 4.2.2.dfsg.1-5+deb70u6 I: Retrieving isc-dhcp-common 4.2.2.dfsg.1-5+deb70u6 I: Validating isc-dhcp-common 4.2.2.dfsg.1-5+deb70u6 I: Retrieving libkeyutils1 1.5.5-3 I: Validating libkeyutils1 1.5.5-3 I: Retrieving libgssapi-krb5-2 1.10.1+dfsg-5+deb7u1 I: Validating libgssapi-krb5-2 1.10.1+dfsg-5+deb7u1 I: Retrieving libk5crypto3 1.10.1+dfsg-5+deb7u1 I: Validating libk5crypto3 1.10.1+dfsg-5+deb7u1 I: Retrieving libkrb5-3 1.10.1+dfsg-5+deb7u1 I: Validating libkrb5-3 1.10.1+dfsg-5+deb7u1 I: Retrieving libkrb5support0 1.10.1+dfsg-5+deb7u1 I: Validating libkrb5support0 1.10.1+dfsg-5+deb7u1 I: Retrieving libbsd0 0.4.2-1 I: Validating libbsd0 0.4.2-1 I: Retrieving libclass-isa-perl 0.36-3 I: Validating libclass-isa-perl 0.36-3 I: Retrieving libedit2 2.11-20080614-5 I: Validating libedit2 2.11-20080614-5 I: Retrieving liblocale-gettext-perl 1.05-7+b3 I: Validating liblocale-gettext-perl 1.05-7+b3 I: Retrieving libselinux1 2.1.9-5 I: Validating libselinux1 2.1.9-5 I: Retrieving libsemanage-common 2.1.6-6 I: Validating libsemanage-common 2.1.6-6 I: Retrieving libsemanage1 2.1.6-6 I: Validating libsemanage1 2.1.6-6 I: Retrieving libsepol1 2.1.4-3 I: Validating libsepol1 2.1.4-3 I: Retrieving libswitch-perl 2.16-2 I: Validating libswitch-perl 2.16-2 I: Retrieving libtext-charwidth-perl 0.04-7+b2 I: Validating libtext-charwidth-perl 0.04-7+b2 I: Retrieving libtext-iconv-perl 1.7-5 I: Validating libtext-iconv-perl 1.7-5 I: Retrieving libtext-wrapi18n-perl 0.06-7 I: Validating libtext-wrapi18n-perl 0.06-7 I: Retrieving libui-dialog-perl 1.08-1.1 I: Validating libui-dialog-perl 1.08-1.1 I: Retrieving libusb-0.1-4 2%3a0.1.12-20+nmu1 I: Validating libusb-0.1-4 2%3a0.1.12-20+nmu1 I: Retrieving lsb-base 4.1+Debian8+deb7u1 I: Validating lsb-base 4.1+Debian8+deb7u1 I: Retrieving mawk 1.3.3-17 I: Validating mawk 1.3.3-17 I: Retrieving libncurses5 5.9-10 I: Validating libncurses5 5.9-10 I: Retrieving libncursesw5 5.9-10 I: Validating libncursesw5 5.9-10 I: Retrieving libtinfo5 5.9-10 I: Validating libtinfo5 5.9-10 I: Retrieving ncurses-base 5.9-10 I: Validating ncurses-base 5.9-10 I: Retrieving ncurses-bin 5.9-10 I: Validating ncurses-bin 5.9-10 I: Retrieving net-tools 1.60-24.2 I: Validating net-tools 1.60-24.2 I: Retrieving netbase 5.0 I: Validating netbase 5.0 I: Retrieving openssh-client 1%3a6.0p1-4+deb7u2 I: Validating openssh-client 1%3a6.0p1-4+deb7u2 I: Retrieving openssh-server 1%3a6.0p1-4+deb7u2 I: Validating openssh-server 1%3a6.0p1-4+deb7u2 I: Retrieving libssl1.0.0 1.0.1e-2+deb7u11 I: Validating libssl1.0.0 1.0.1e-2+deb7u11 I: Retrieving libpam-modules 1.1.3-7.1 I: Validating libpam-modules 1.1.3-7.1 I: Retrieving libpam-modules-bin 1.1.3-7.1 I: Validating libpam-modules-bin 1.1.3-7.1 I: Retrieving libpam-runtime 1.1.3-7.1 I: Validating libpam-runtime 1.1.3-7.1 I: Retrieving libpam0g 1.1.3-7.1 I: Validating libpam0g 1.1.3-7.1 I: Retrieving perl 5.14.2-21+deb7u1 I: Validating perl 5.14.2-21+deb7u1 I: Retrieving perl-base 5.14.2-21+deb7u1 I: Validating perl-base 5.14.2-21+deb7u1 I: Retrieving perl-modules 5.14.2-21+deb7u1 I: Validating perl-modules 5.14.2-21+deb7u1 I: Retrieving libprocps0 1%3a3.3.3-3 I: Validating libprocps0 1%3a3.3.3-3 I: Retrieving procps 1%3a3.3.3-3 I: Validating procps 1%3a3.3.3-3 I: Retrieving libreadline6 6.2+dfsg-0.1 I: Validating libreadline6 6.2+dfsg-0.1 I: Retrieving readline-common 6.2+dfsg-0.1 I: Validating readline-common 6.2+dfsg-0.1 I: Retrieving sed 4.2.1-10 I: Validating sed 4.2.1-10 I: Retrieving sensible-utils 0.0.7 I: Validating sensible-utils 0.0.7 I: Retrieving login 1%3a4.1.5.1-1 I: Validating login 1%3a4.1.5.1-1 I: Retrieving passwd 1%3a4.1.5.1-1 I: Validating passwd 1%3a4.1.5.1-1 I: Retrieving libslang2 2.2.4-15 I: Validating libslang2 2.2.4-15 I: Retrieving initscripts 2.88dsf-41+deb7u1 I: Validating initscripts 2.88dsf-41+deb7u1 I: Retrieving sysv-rc 2.88dsf-41+deb7u1 I: Validating sysv-rc 2.88dsf-41+deb7u1 I: Retrieving sysvinit 2.88dsf-41+deb7u1 I: Validating sysvinit 2.88dsf-41+deb7u1 I: Retrieving sysvinit-utils 2.88dsf-41+deb7u1 I: Validating sysvinit-utils 2.88dsf-41+deb7u1 I: Retrieving tar 1.26+dfsg-0.1 I: Validating tar 1.26+dfsg-0.1 I: Retrieving libwrap0 7.6.q-24 I: Validating libwrap0 7.6.q-24 I: Retrieving tzdata 2014e-0wheezy1 I: Validating tzdata 2014e-0wheezy1 I: Retrieving libustr-1.0-1 1.0.4-3 I: Validating libustr-1.0-1 1.0.4-3 I: Retrieving bsdutils 1%3a2.20.1-5.3 I: Validating bsdutils 1%3a2.20.1-5.3 I: Retrieving libblkid1 2.20.1-5.3 I: Validating libblkid1 2.20.1-5.3 I: Retrieving libmount1 2.20.1-5.3 I: Validating libmount1 2.20.1-5.3 I: Retrieving libuuid1 2.20.1-5.3 I: Validating libuuid1 2.20.1-5.3 I: Retrieving mount 2.20.1-5.3 I: Validating mount 2.20.1-5.3 I: Retrieving util-linux 2.20.1-5.3 I: Validating util-linux 2.20.1-5.3 I: Retrieving liblzma5 5.1.1alpha+20120614-2 I: Validating liblzma5 5.1.1alpha+20120614-2 I: Retrieving xz-utils 5.1.1alpha+20120614-2 I: Validating xz-utils 5.1.1alpha+20120614-2 I: Retrieving zlib1g 1%3a1.2.7.dfsg-13 I: Validating zlib1g 1%3a1.2.7.dfsg-13 I: Chosen extractor for .deb packages: dpkg-deb I: Extracting libacl1... I: Extracting libattr1... I: Extracting base-files... I: Extracting base-passwd... I: Extracting bash... I: Extracting libbz2-1.0... I: Extracting coreutils... I: Extracting dash... I: Extracting libdb5.1... I: Extracting debconf... I: Extracting debconf-i18n... I: Extracting debianutils... I: Extracting diffutils... I: Extracting dpkg... I: Extracting e2fslibs... I: Extracting e2fsprogs... I: Extracting libcomerr2... I: Extracting libss2... I: Extracting libc-bin... I: Extracting libc6... I: Extracting multiarch-support... I: Extracting findutils... I: Extracting gcc-4.7-base... I: Extracting libgcc1... I: Extracting grep... I: Extracting gzip... I: Extracting hostname... I: Extracting insserv... I: Extracting liblocale-gettext-perl... I: Extracting libselinux1... I: Extracting libsemanage-common... I: Extracting libsemanage1... I: Extracting libsepol1... I: Extracting libtext-charwidth-perl... I: Extracting libtext-iconv-perl... I: Extracting libtext-wrapi18n-perl... I: Extracting lsb-base... I: Extracting mawk... I: Extracting libncurses5... I: Extracting libtinfo5... I: Extracting ncurses-base... I: Extracting ncurses-bin... I: Extracting libpam-modules... I: Extracting libpam-modules-bin... I: Extracting libpam-runtime... I: Extracting libpam0g... I: Extracting perl-base... I: Extracting sed... I: Extracting sensible-utils... I: Extracting login... I: Extracting passwd... I: Extracting libslang2... I: Extracting initscripts... I: Extracting sysv-rc... I: Extracting sysvinit... I: Extracting sysvinit-utils... I: Extracting tar... I: Extracting tzdata... I: Extracting libustr-1.0-1... I: Extracting bsdutils... I: Extracting libblkid1... I: Extracting libmount1... I: Extracting libuuid1... I: Extracting mount... I: Extracting util-linux... I: Extracting liblzma5... I: Extracting xz-utils... I: Extracting zlib1g... I: Installing core packages... I: Unpacking required packages... I: Unpacking libacl1:armhf... I: Unpacking libattr1:armhf... I: Unpacking base-files... I: Unpacking base-passwd... I: Unpacking bash... I: Unpacking libbz2-1.0:armhf... I: Unpacking coreutils... I: Unpacking dash... I: Unpacking libdb5.1:armhf... I: Unpacking debconf... I: Unpacking debconf-i18n... I: Unpacking debianutils... I: Unpacking diffutils... I: Unpacking dpkg... I: Unpacking e2fslibs:armhf... I: Unpacking e2fsprogs... I: Unpacking libcomerr2:armhf... I: Unpacking libss2:armhf... I: Unpacking libc-bin... I: Unpacking libc6:armhf... I: Unpacking multiarch-support... I: Unpacking findutils... I: Unpacking gcc-4.7-base:armhf... I: Unpacking libgcc1:armhf... I: Unpacking grep... I: Unpacking gzip... I: Unpacking hostname... I: Unpacking insserv... I: Unpacking liblocale-gettext-perl... I: Unpacking libselinux1:armhf... I: Unpacking libsemanage-common... I: Unpacking libsemanage1:armhf... I: Unpacking libsepol1:armhf... I: Unpacking libtext-charwidth-perl... I: Unpacking libtext-iconv-perl... I: Unpacking libtext-wrapi18n-perl... I: Unpacking lsb-base... I: Unpacking mawk... I: Unpacking libncurses5:armhf... I: Unpacking libtinfo5:armhf... I: Unpacking ncurses-base... I: Unpacking ncurses-bin... I: Unpacking libpam-modules:armhf... I: Unpacking libpam-modules-bin... I: Unpacking libpam-runtime... I: Unpacking libpam0g:armhf... I: Unpacking perl-base... I: Unpacking sed... I: Unpacking sensible-utils... I: Unpacking login... I: Unpacking passwd... I: Unpacking libslang2:armhf... I: Unpacking initscripts... I: Unpacking sysv-rc... I: Unpacking sysvinit... I: Unpacking sysvinit-utils... I: Unpacking tar... I: Unpacking tzdata... I: Unpacking libustr-1.0-1:armhf... I: Unpacking bsdutils... I: Unpacking libblkid1:armhf... I: Unpacking libmount1... I: Unpacking libuuid1:armhf... I: Unpacking mount... I: Unpacking util-linux... I: Unpacking liblzma5:armhf... I: Unpacking xz-utils... I: Unpacking zlib1g:armhf... I: Configuring required packages... I: Configuring lsb-base... I: Configuring ncurses-base... I: Configuring sensible-utils... I: Configuring libsemanage-common... I: Configuring gcc-4.7-base:armhf... I: Configuring libc-bin... I: Configuring libc6:armhf... I: Configuring debianutils... I: Configuring base-passwd... I: Configuring mawk... I: Configuring hostname... I: Configuring insserv... I: Configuring multiarch-support... I: Configuring libselinux1:armhf... I: Configuring libsepol1:armhf... I: Configuring libgcc1:armhf... I: Configuring base-files... I: Configuring libattr1:armhf... I: Configuring e2fslibs:armhf... I: Configuring libcomerr2:armhf... I: Configuring libacl1:armhf... I: Configuring libslang2:armhf... I: Configuring libss2:armhf... I: Configuring liblzma5:armhf... I: Configuring libdb5.1:armhf... I: Configuring libbz2-1.0:armhf... I: Configuring libtinfo5:armhf... I: Configuring sysvinit-utils... I: Configuring libustr-1.0-1:armhf... I: Configuring bsdutils... I: Configuring ncurses-bin... I: Configuring libsemanage1:armhf... I: Configuring tar... I: Configuring zlib1g:armhf... I: Configuring libncurses5:armhf... I: Configuring xz-utils... I: Configuring dpkg... I: Configuring dash... I: Configuring coreutils... I: Configuring perl-base... I: Configuring diffutils... I: Configuring libtext-iconv-perl... I: Configuring sed... I: Configuring grep... I: Configuring findutils... I: Configuring gzip... I: Configuring liblocale-gettext-perl... I: Configuring bash... I: Configuring libtext-charwidth-perl... I: Configuring libtext-wrapi18n-perl... I: Configuring debconf... I: Configuring libpam0g:armhf... I: Configuring sysv-rc... I: Configuring tzdata... I: Configuring debconf-i18n... I: Configuring initscripts... I: Configuring libpam-modules-bin... I: Configuring libpam-modules:armhf... I: Configuring passwd... I: Configuring libpam-runtime... I: Configuring sysvinit... I: Configuring login... I: Configuring libuuid1:armhf... I: Configuring libblkid1:armhf... I: Configuring util-linux... I: Configuring libmount1... I: Configuring mount... I: Configuring e2fsprogs... I: Unpacking the base system... I: Unpacking adduser... I: Unpacking apt... I: Unpacking libapt-pkg4.12:armhf... I: Unpacking debian-archive-keyring... I: Unpacking dialog... I: Unpacking locales... I: Unpacking libstdc++6:armhf... I: Unpacking libgdbm3:armhf... I: Unpacking gnupg... I: Unpacking gpgv... I: Unpacking ifupdown... I: Unpacking iproute... I: Unpacking isc-dhcp-client... I: Unpacking isc-dhcp-common... I: Unpacking libkeyutils1:armhf... I: Unpacking libgssapi-krb5-2:armhf... I: Unpacking libk5crypto3:armhf... I: Unpacking libkrb5-3:armhf... I: Unpacking libkrb5support0:armhf... I: Unpacking libbsd0:armhf... I: Unpacking libclass-isa-perl... I: Unpacking libedit2:armhf... I: Unpacking libswitch-perl... I: Unpacking libui-dialog-perl... I: Unpacking libusb-0.1-4:armhf... I: Unpacking libncursesw5:armhf... I: Unpacking net-tools... I: Unpacking netbase... I: Unpacking openssh-client... I: Unpacking openssh-server... I: Unpacking libssl1.0.0:armhf... I: Unpacking perl... I: Unpacking perl-modules... I: Unpacking libprocps0:armhf... I: Unpacking procps... I: Unpacking libreadline6:armhf... I: Unpacking readline-common... I: Unpacking libwrap0:armhf... I: Configuring the base system... I: Configuring gpgv... I: Configuring libssl1.0.0:armhf... I: Configuring libgdbm3:armhf... I: Configuring isc-dhcp-common... I: Configuring libusb-0.1-4:armhf... I: Configuring libprocps0:armhf... I: Configuring netbase... I: Configuring libclass-isa-perl... I: Configuring adduser... I: Configuring locales... I: Configuring libkeyutils1:armhf... I: Configuring iproute... I: Configuring libkrb5support0:armhf... I: Configuring net-tools... I: Configuring libbsd0:armhf... I: Configuring debian-archive-keyring... I: Configuring libncursesw5:armhf... I: Configuring dialog... I: Configuring libedit2:armhf... I: Configuring libstdc++6:armhf... I: Configuring isc-dhcp-client... I: Configuring readline-common... I: Configuring libwrap0:armhf... I: Configuring procps... I: Configuring libk5crypto3:armhf... I: Configuring ifupdown... I: Configuring libapt-pkg4.12:armhf... I: Configuring libreadline6:armhf... I: Configuring gnupg... I: Configuring libkrb5-3:armhf... I: Configuring libgssapi-krb5-2:armhf... I: Configuring apt... I: Configuring openssh-client... I: Configuring openssh-server... I: Configuring perl-modules... I: Configuring libswitch-perl... I: Configuring perl... I: Configuring libui-dialog-perl... I: Base system installed successfully. Download complete. Copying rootfs to /var/lib/lxc/debian/rootfs...Generating locales (this might take a while)... Generation complete. update-rc.d: using dependency based boot sequencing update-rc.d: using dependency based boot sequencing update-rc.d: using dependency based boot sequencing update-rc.d: using dependency based boot sequencing Creating SSH2 RSA key; this may take some time ... Creating SSH2 DSA key; this may take some time ... Creating SSH2 ECDSA key; this may take some time ... invoke-rc.d: policy-rc.d denied execution of restart. Current default time zone: 'Asia/Tokyo' Local time is now: Fri Jul 25 17:42:59 JST 2014. Universal Time is now: Fri Jul 25 08:42:59 UTC 2014. Root password is 'root', please change ! user1@plum:~$
作成されました。
作成した仮想環境を起動するまえに、
を行っておきます。
user1@plum:~$ sudo chroot /var/lib/lxc/debian/rootfs root@plum:/# passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully root@plum:/# adduser user1 Adding user `user1' ... Adding new group `user1' (1000) ... Adding new user `user1' (1000) with group `user1' ... Creating home directory `/home/user1' ... Copying files from `/etc/skel' ... Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully Changing the user information for user1 Enter the new value, or press ENTER for the default Full Name []: User Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] y root@plum:/# exit
仮想環境を起動します。
user1@plum:~$ sudo lxc-start -n debian
Debian GNU/Linux 7 debian console debian login: user1 Password: Linux debian 3.14.13+ #68 PREEMPT Wed Jul 23 11:52:23 JST 2014 armv7l The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. user1@debian:~$
ログインできました。
プロセス一覧を見てみると、コンテナ内のプロセスのみが見えています。
user1@debian:~$ ps ax PID TTY STAT TIME COMMAND 1 ? Ss 0:00 init [3] 1015 ? Ss 0:00 dhclient -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0 1105 ? Ss 0:00 /usr/sbin/sshd 1114 ? Ss 0:00 /bin/login -- 1115 ? Ss+ 0:00 /sbin/getty 38400 tty1 linux 1116 ? Ss+ 0:00 /sbin/getty 38400 tty2 linux 1117 ? Ss+ 0:00 /sbin/getty 38400 tty3 linux 1118 ? Ss+ 0:00 /sbin/getty 38400 tty4 linux 1119 console S 0:00 -bash 1128 console R+ 0:00 ps ax user1@debian:~$