hnakamur’s blog

ものすごい勢いで忘れる私のために未整理でもいいからとりあえずメモ

2008-11-25

Linux-VServerのゲストOSとしてCentOSをインストール



Building Guest Systems - Linux-VServerを読みながらトライ中。


まずは、yumを入れておく。



# aptitude install yum


Howtos Linux-Vserver With LVM And Quotas - 5dollarwhitebox.org Media Wikiというページを見つけたのでこれに従ってやってみる。



# aptitude update && aptitude upgrade
# aptitude install lvm2 util-vserver coreutils


NTFSのsparse fileの手順に沿ってcentos5guest.ext3という名前で8Gのsparse fileを作り、coLinuxを以下のような設定で再起動。



kernel=C:\coLinux\coLinux_VServer\vmlinux-2.6.22.18-vs2.2.0.6-co-0.7.3
hda1=c:\coLinux\etch.ext3
hdb1=c:\coLinux\swap.img
hdc1=c:\coLinux\centos5guest.ext3
root=/dev/hda1
initrd=C:\coLinux\coLinux_VServer\initrd.img-2.6.22.18-vs2.2.0.6-co-0.7.3
mem=512
eth0=slirp
eth1=tuntap


物理ボリューム、ボリュームグループ、論理ボリューム作成



# pvcreate /dev/hdc1
Physical volume "/dev/hdc1" successfully created
# vgcreate vg0 /dev/hdc1
Volume group "vg0" successfully created
# lvcreate -L1024 -n vserver1 vg0
Logical volume "vserver1" created


ファイルシステム作成とマウント



# mke2fs -j /dev/vg0/vserver1
...
# mkdir /var/lib/vservers/vserver1
# mount -t ext3 /dev/vg0/vserver1 /var/lib/vservers/vserver1


仮想サーバー作ろうとしたらエラー。



# vserver vserver1 build -m yum --context 42 --hostname vserver1.local \
--interface eth0:192.168.1.11/24 -- -d centos5
ERROR: Can not find configuration for the distribution 'centos5';
please read http://linux-vserver.org/HowToRegisterNewDistributions
for information how to add support for your own distribution.



# dpkg -L util-vserver | lv


で確認してみると、確かにcentos5の設定は無かった(centos4ならあったけど)。検索してみるとvserver development mailing list: Re: [Vserver] CentOS 5 building guest machineで、util-vserverのバージョンを0.30.213にあげれば入っているとのこと。dpkg -l util-vserverしてみると手元のは0.30.212-1。Debian -- パッケージ検索結果 -- util-vserverを見るとtestingレポジトリにはもっと新しいのが登録されているそうだ。


tesingからutil-vserverをインストールしたときの手順は一部のパッケージだけ手動でtestingレポジトリから取得するに書きました。


というわけでもう一度やってみると今度は別のエラー発生。



# vserver vserver1 build -m yum --context 42 --hostname vserver1.local \
--interface eth0:192.168.1.11/24 -- -d centos5
mount: mount point /etc/rpm does not exist
rm: cannot remove directory `/etc/vservers/.defaults/vdirbase/vserver1': Device or resource busy


#444224 - util-vserver: please include /etc/rpm and suggest:yum - Debian Bug report logsという記事を見て



# mkdir -p /etc/vservers/vserver1/rpmetc
# vserver vserver1 build -m yum --context 42 --hostname vserver1.local \
--interface eth0:192.168.1.11/24 -- -d centos5
vserver-topdirectory '/etc/vservers/.defaults/vdirbase/vserver1' and/or configuration at '/etc/vservers/vserver1'
exist already; please try to use '--force', or remove them manually.


とやってみたらまたエラーに。


ここは素直に/etc/rpmを作るほうがよさそうと思いやってみると



# rm -r /etc/vservers/vserver1/
# mkdir /etc/rpm
# vserver vserver1 build -m yum --context 42 --hostname vserver1.local \
--interface eth0:192.168.1.11/24 -- -d centos5
You are using a version of yum which is insecure and broken in chroot
related operations; either apply the patches shipped in the 'contrib/'
directory of util-vserver, or ask the author of yum to apply them
(preferred).

In the meantime, 'vyum' will continue with dirty hacks which might not
work when the vserver is running and local DOS attacks are possible.

Execution will continue in 5 seconds...


と出て固まった。と思ったのは間違いで別の端末でps見たら起動してるようです。しばらく待っているとyumでインストールするときのリストが出てきたのでゲストOS用にパッケージをインストールしているようです。


待ってる間に別の端末でyumをtestingからインストール。かなりいろいろつられてバージョンアップするそうだが気にせずGO!



# aptitude show yum | grep Version:
Version: 2.4.0-3.1
# aptitude show yum -t testing | grep Version:
Version: 3.2.12-1.2
# aptitude install yum -t testing


長くなってきたので続きは別エントリにします。





0 件のコメント:

ブログ アーカイブ