■Squeeze上のsid chrootにjessieのchroot環境を構築
Wheezyが安定版となったことにより、2013/05/03にjessieテスト版 (testing)が出ました。
■wheezy の次の Debian のメジャーリリースのコードネームは、「jessie」です。
Debian「jessie」リリース情報
http://www.debian.org/releases/testing/
■Debian Lenny/squeeze/Wheezy/sid、CentOS4/5/6、SL5/6のchroot環境を
Squeezeに構築する方法は下記。
プロキシ経由のdebootstrap、Lenny、Squeezeのchroot環境構築
http://d.hatena.ne.jp/labunix/20130312
squeeze上にwheezyのchroot環境を構築
http://d.hatena.ne.jp/labunix/20130311
SqueezeのchrootにCentOS4.9を導入
http://d.hatena.ne.jp/labunix/20130322
chroot環境のsidで、rinseを使ってCentOS5/6のchroot環境を構築
http://d.hatena.ne.jp/labunix/20130313
chroot環境のsidでSL5/6を導入、ホストのSqueezeに移動する
http://d.hatena.ne.jp/labunix/20130328
chroot環境のバックアップ
http://d.hatena.ne.jp/labunix/20130314
chroot環境のdebianに「/dev/pts」をマウント、bindマウント
http://d.hatena.ne.jp/labunix/20130326
■Squeezeの以下の環境でsidのchroot環境にログイン
$ grep -A 3 "^\[sid\-" /etc/schroot/schroot.conf
[sid-root]
description=Debian sid
directory=/home/labunix/cifs/sid
users=root
$ sudo schroot -c sid-root -p
■まだ、パッケージをインストールしていなければ下記を。
■プロキシを使用している場合はwgetrcに記載。
$ grep proxy /etc/wgetrc
https_proxy = http://192.168.1.1:8080/
http_proxy = http://192.168.1.1:8080/
ftp_proxy = http://192.168.1.1:8080/
■jessieのchroot環境の導入
■sidのchroot環境(「/var/local/sid」)からSqueezeに移動
$ sudo mv /var/local/sid/var/local/jessie/ /var/local
■procと/dev/ptsのマウント
/tmpや/homeのマウントはお好みで。
$ INSTALL=/var/local/jessie
$ echo "proc $INSTALL/proc proc defaults 0 0
/dev/pts $INSTALL/dev/pts none bind 0 0" | sudo tee -a /etc/fstab > /dev/null && sudo mount -a
$ for opt in update "upgrade -y" autoremove autoclean;do
sudo chroot $INSTALL apt-get $opt; \
done
■不要なパッケージの削除と必要なパッケージのインストール
「locales」は下記2種類を選択。デフォルトは2番目とする。
ja_JP.EUC-JP EUC-JP
ja_JP.UTF-8 UTF-8
$ sudo chroot $INSTALL apt-get purge -y isc-dhcp* nano
$ sudo chroot $INSTALL apt-get install -y vim chkconfig locales less && sudo chroot $INSTALL dpkg-reconfigure locales
■ユーザの作成
$ USER=labunix
$ sudo chroot $INSTALL useradd $USER && sudo chroot $INSTALL passwd $USER
新しいUNIXパスワードを入力してください:
新しいUNIX パスワードを再入力してください:
passwd: パスワードは正しく更新されました
$ sudo mkdir $INSTALL/home/$USER && sudo chown $USER:$USER $INSTALL/home/$USER
$ echo "[jessie]
description=debian jessie
directory=$INSTALL
users=$USER
[jessie-root]
description=debian jessie
directory=$INSTALL
users=root
" | sudo tee -a /etc/schroot/schroot.conf > /dev/null
$ echo "chroot-jessie" | sudo tee -a $INSTALL/etc/debian_chroot > /dev/null
$ schroot -c jessie -p
(chroot-jessie)labunix@dummy-host:~$ exit
$ sudo schroot -c jessie-root -p
(chroot-jessie)root@dummy-host:/home/labunix# exit
■プロキシ環境のコピーと
Webクライアント環境のインストール、
導入環境を最新の状態にして、「jessie」を再確認。
$ INSTALL=/var/local/jessie
$ ls /etc/profile.d/proxy.sh
/etc/profile.d/proxy.sh
$ cat /etc/apt/apt.conf
Acquire::http::Proxy "http://192.168.1.1:8080/";
$ sudo cp /etc/profile.d/proxy.sh $INSTALL/etc/profile.d/proxy.sh
$ sudo cp -b /etc/wgetrc $INSTALL/etc/profile.d/wgetrc
$ sudo cp -b /etc/apt/apt.conf /home/labunix/cifs/jessie/etc/apt/apt.conf
$ sudo chroot $INSTALL apt-get install -y wget curl w3m apt-file
$ sudo chroot $INSTALL apt-file update
$ for opt in update "upgrade -y" autoremove autoclean;do
sudo chroot $INSTALL apt-get $opt; \
done
$ grep ^deb $INSTALL/etc/apt/sources.list
deb http://ftp.debian.or.jp/debian jessie main
■後片付け。
変数のクリアかログアウト。
$ unset INSTALL
$ exit
■余談
バージョン7.0が3つもあるのは変ですが、
sources.listではきちんと開発コードが設定されています。
$ INSTALL_HOME=/var/local
$ grep . $INSTALL_HOME/[sjlw]*/etc/debian_version | sort -t \: -k 2 -n | sed s%/home/labunix%[INSTALL_HOME]%g
[INSTALL_HOME]/lenny/etc/debian_version:5.0.10
[INSTALL_HOME]/squeeze/etc/debian_version:6.0.7
[INSTALL_HOME]/jessie/etc/debian_version:7.0
[INSTALL_HOME]/sid/etc/debian_version:7.0
[INSTALL_HOME]/wheezy/etc/debian_version:7.0
$ grep ^deb $INSTALL_HOME/[sjlw]*/etc/apt/sources.list
[INSTALL_HOME]/jessie/etc/apt/sources.list:deb http://ftp.debian.or.jp/debian jessie main
[INSTALL_HOME]/lenny/etc/apt/sources.list:deb http://archive.debian.org/debian lenny main
[INSTALL_HOME]/sid/etc/apt/sources.list:deb http://ftp.debian.or.jp/debian sid main
[INSTALL_HOME]/squeeze/etc/apt/sources.list:deb http://ftp.debian.or.jp/debian squeeze main
[INSTALL_HOME]/wheezy/etc/apt/sources.list:deb http://ftp.debian.or.jp/debian wheezy main
■apt-fileで確認。
$ for list in $INSTALL_HOME/[sjlw]*;do \
echo -en "$list\t" | sed s%.*/%%g ; \
sudo chroot "$list" dpkg -l apt-file | grep ^ii | awk '{print $3}'; \
done | sort -t. -k 2 -k1
lenny 2.1.5
squeeze 2.4.0
jessie 2.5.1
wheezy 2.5.1
sid 2.5.2
■curlで確認
古い順に並びました。
$ for list in $INSTALL_HOME/[sjlw]*;do \
echo -en "$list\t" | sed s%.*/%%g ; \
sudo chroot "$list" dpkg -l curl | grep ^ii | awk '{print $3}'; \
done | sort -t. -k2 -n
lenny 7.18.2-8lenny6
squeeze 7.21.0-2.1+squeeze2
wheezy 7.26.0-1+wheezy2
jessie 7.30.0-1
sid 7.30.0-1
■これでchroot環境は10種類になりました。
$ ls $INSTALL_HOME | wc -l
10
■メモリ1GBしかないのに、よくがんばっていると思いますw。
$ df -i | awk '($5>30){print}'
Filesystem Inodes IUsed IFree IUse% マウント位置
/dev/sda1 610800 187829 422971 31% /
$ df -h | awk '($5>30){print}'
Filesystem Size Used Avail Use% マウント位置
/dev/sda1 9.2G 7.0G 1.8G 80% /
$ free
total used free shared buffers cached
Mem: 1021720 477036 544684 0 5028 99368
-/+ buffers/cache: 372640 649080
Swap: 1994744 0 1994744