Aug 162014
 

Debian wheezyをFedora 20上のContainerとして動かしてみました。

まずはrootファイルシステムとなるディレクトリを作成します。名前はdebian01としています。

[root@localhost ~]# mkdir -p /var/lib/libvirt/filesystems/debian01

debootstrapを入手して展開、実行します。
展開用にbinutilsに含まれるarコマンド、実行用にperlなどが必要になりますので、インストールします。

[root@localhost ~]# yum install binutils perl wget gnupg

debootstrap自体のインストール手順はD.3. Unix/Linux システムからの Debian GNU/Linux のインストール」の「D.3.2. debootstrap のインストール」を参照ください。
インストールしたdebootstrapを実行します。

[root@localhost ~]# /usr/sbin/debootstrap --arch amd64 stable /var/lib/libvirt/filesystems/debian01

Linux Containerとして起動します。

[root@localhost ~]# virt-install --connect lxc:// --name debian01 --ram 512 --filesystem /var/lib/libvirt/filesystems/debian01/,/

いったん止めます。

[root@localhost ~]# virsh -c lxc:// shutdown debian01

rootパスワードやコンソールログイン許可するttyデバイスを追加します。

[root@localhost ~]# chroot /var/lib/libvirt/filesystems/debian01 /bin/passwd root
[root@localhost ~]# echo "pts/0" >> /var/lib/libvirt/filesystems/debian01/etc/securetty

起動してコンソール接続します。

[root@localhost ~]# virsh -c lxc:// start --console debian01

これで先に設定したrootパスワードでコンソールログインできるはずです。

以下を参考にしました。
Launch secure LXC containers on Fedora 20 using SELinux and sVirt – major.io

Sorry, the comment form is closed at this time.