ソフトウェア玄箱

debootstrapイメージからの設定

下記で作ったdebootstrapのイメージを独立してブートできるように基本的な設定をします。
id:ksaito11:20070427

chroot

debootstrapイメージにchrootします。

~ # chroot /mnt/disk1/kurodev/mnt/debinst
sh-2.05b#

fstabの設定

ハードディスクブートしたときにマウントされるようにfstabを修正します。

sh-2.05b# cat /etc/fstab
# UNCONFIGURED FSTAB FOR BASE SYSTEM
proc            /proc           proc    defaults        0       0
sysfs           /sys            sysfs   defaults        0       0
devpts          /dev/pts        devpts  gid=5,mode=622  0       0
/dev/sda2       /               xfs     defaults        1       1
/dev/sda3       swap            swap    defaults        0       0
sh-2.05b#

ネットワークの設定

hostnameを設定します。

sh-2.05b# echo debian > /etc/hostname
sh-2.05b# /etc/init.d/hostname.sh
sh-2.05b# hostname
debian
sh-2.05b# cat /etc/hosts
127.0.0.1       debian localhost
sh-2.05b#

resolv.confを設定してネームサーバが引けるようにします。

sh-2.05b# cat /etc/resolv.conf
nameserver 192.168.1.1
sh-2.05b#

aptの設定

aptを設定してetchにアップグレードします。

sh-2.05b# cat /etc/apt/sources.list
deb http://ftp.jp.debian.org/debian etch main contrib non-free
deb http://security.debian.org etch/updates main contrib non-free
sh-2.05b# aptitude update
Reading Package Lists... Done
Building Dependency Tree
Initializing package states... Done
Reading task descriptions... Done
Get:1 http://ftp.jp.debian.org etch/main Packages [5464kB]
Get:2 http://security.debian.org etch/updates/main Packages [38.7kB]
Get:3 http://security.debian.org etch/updates/main Release [96B]
Get:4 http://security.debian.org etch/updates/contrib Packages [20B]
Get:5 http://security.debian.org etch/updates/contrib Release [99B]
Get:6 http://security.debian.org etch/updates/non-free Packages [20B]
Get:7 http://security.debian.org etch/updates/non-free Release [100B]
Get:8 http://ftp.jp.debian.org etch/main Release [94B]
Get:9 http://ftp.jp.debian.org etch/contrib Packages [53.8kB]
Get:10 http://ftp.jp.debian.org etch/contrib Release [97B]
Get:11 http://ftp.jp.debian.org etch/non-free Packages [71.2kB]
Get:12 http://ftp.jp.debian.org etch/non-free Release [98B]
Fetched 5628kB in 13s (418kB/s)
Reading Package Lists... Done
Building Dependency Tree
Initializing package states... Done
Reading task descriptions... Done
sh-2.05b# aptitude upgrade
Reading Package Lists... Done
Building Dependency Tree
Initializing package states... Done
Reading task descriptions... Done
The following packages have been kept back:
adduser apt apt-utils aptitude at base-passwd bash bsdmainutils bsdutils
console-common console-tools coreutils cpio cron debianutils dhcp-client
dpkg dselect e2fslibs e2fsprogs exim4 exim4-base exim4-config
exim4-daemon-light fdutils findutils gettext-base grep groff-base gzip
hostname ifupdown info initscripts iptables iputils-ping klogd libacl1
libattr1 libblkid1 libc6 libcomerr2 libconsole libdb1-compat libdb3
libdb4.2 libgcc1 libgcrypt11 libgdbm3 libgpg-error0 libgpmg1
liblocale-gettext-perl liblockfile1 liblzo1 libncurses5 libopencdk8
libpam-modules libpam0g libpcre3 libperl5.8 libpopt0 libssl0.9.7
libstdc++5 libtext-charwidth-perl libtext-iconv-perl libtextwrap1
libuuid1 libwrap0 login logrotate man-db modutils mount nano ncurses-base
ncurses-bin net-tools netbase nvi passwd perl-base ppp pppoe pppoeconf
procps sed sysklogd sysvinit tar tasksel tcpd telnet util-linux wget
whiptail zlib1g
The following packages will be upgraded:
base-files console-data debconf debconf-i18n gcc-3.3-base libpam-runtime
libss2 libtext-wrapi18n-perl mailx makedev manpages pppconfig sysv-rc
The following packages are RECOMMENDED but will NOT be installed:
lsb-base
13 packages upgraded, 0 newly installed, 0 to remove and 96 not upgraded.
Need to get 2587kB of archives. After unpacking 633kB will be freed.
Do you want to continue? [Y/n/?]
...省略...
Reading Package Lists... Done
Building Dependency Tree
Initializing package states... Done
Reading task descriptions... Done
sh-2.05b# aptitude dist-upgrade
Reading Package Lists... Done
Building Dependency Tree
Initializing package states... Done
Reading task descriptions... Done
The following NEW packages will be automatically installed:
debian-archive-keyring gcc-4.1-base gnupg gpgv laptop-detect libbz2-1.0
libdb4.3 libdb4.4 libdevmapper1.02 libfribidi0 libgnutls13 libldap2
libncursesw5 libnewt0.52 libpcap0.8 libreadline5 libsasl2-2
libsasl2-modules libselinux1 libsepol1 libsigc++-2.0-0c2a libslang2
libssl0.9.8 libstdc++6 libtasn1-3 libusb-0.1-4 lsb-base mktemp modconf
openbsd-inetd readline-common sysvinit-utils tasksel-data tzdata
update-inetd
The following packages will be automatically REMOVED:
libnewt0.51 netkit-inetd
The following NEW packages will be installed:
debian-archive-keyring gcc-4.1-base gnupg gpgv laptop-detect libbz2-1.0
libdb4.3 libdb4.4 libdevmapper1.02 libfribidi0 libgnutls13 libldap2
libncursesw5 libnewt0.52 libpcap0.8 libreadline5 libsasl2-2
libsasl2-modules libselinux1 libsepol1 libsigc++-2.0-0c2a libslang2
libssl0.9.8 libstdc++6 libtasn1-3 libusb-0.1-4 lsb-base mktemp modconf
openbsd-inetd readline-common sysvinit-utils tasksel-data tzdata
update-inetd
The following packages will be REMOVED:
libnewt0.51 netkit-inetd
The following packages will be upgraded:
adduser apt apt-utils aptitude at base-passwd bash bsdmainutils bsdutils
console-common console-tools coreutils cpio cron debianutils dhcp-client
dpkg dselect e2fslibs e2fsprogs exim4 exim4-base exim4-config
exim4-daemon-light fdutils findutils gettext-base grep groff-base gzip
hostname ifupdown info initscripts iptables iputils-ping klogd libacl1
libattr1 libblkid1 libc6 libcomerr2 libconsole libdb1-compat libdb3
libdb4.2 libgcc1 libgcrypt11 libgdbm3 libgpg-error0 libgpmg1
liblocale-gettext-perl liblockfile1 liblzo1 libncurses5 libopencdk8
libpam-modules libpam0g libpcre3 libperl5.8 libpopt0 libssl0.9.7
libstdc++5 libtext-charwidth-perl libtext-iconv-perl libtextwrap1
libuuid1 libwrap0 login logrotate man-db modutils mount nano ncurses-base
ncurses-bin net-tools netbase nvi passwd perl-base ppp pppoe pppoeconf
procps sed sysklogd sysvinit tar tasksel tcpd telnet util-linux wget
whiptail zlib1g
The following packages are RECOMMENDED but will NOT be installed:
aptitude-doc-en libparse-debianchangelog-perl libtasn1-3-bin locales
mtools psmisc
96 packages upgraded, 35 newly installed, 2 to remove and 0 not upgraded.
Need to get 41.0MB of archives. After unpacking 32.2MB will be used.
Do you want to continue? [Y/n/?]
...省略...
Reading Package Lists... Done
Building Dependency Tree
Reading extended state information
Initializing package states... Done
Reading task descriptions... Done
sh-2.05b# 

chrootし直すとプロンプトが変わります。
デフォルトのプロンプトは、bashのバージョンなのですね。

sh-2.05b# exit
~ # chroot /mnt/disk1/kurodev/mnt/debinst
sh-3.1# 

パッケージのインストール

必要なパッケージのインストールと不要なパッケージのパージをします。
結果は、下記の通り

sh-3.1# dpkg --get-selections
adduser                                         install
apt                                             install
apt-utils                                       install
aptitude                                        install
at                                              install
base-config                                     install
base-files                                      install
base-passwd                                     install
bash                                            install
bsdmainutils                                    install
bsdutils                                        install
bzip2                                           install
console-common                                  install
console-data                                    install
console-tools                                   install
coreutils                                       install
cpio                                            install
cron                                            install
debconf                                         install
debconf-i18n                                    install
debian-archive-keyring                          install
debianutils                                     install
deborphan                                       install
dhcp3-client                                    install
dhcp3-common                                    install
dialog                                          install
diff                                            install
dpkg                                            install
dselect                                         install
e2fslibs                                        install
e2fsprogs                                       install
ed                                              install
exim4                                           install
exim4-base                                      install
exim4-config                                    install
exim4-daemon-light                              install
facter                                          install
fdutils                                         install
findutils                                       install
gcc-3.3-base                                    install
gcc-4.1-base                                    install
gettext-base                                    install
gnupg                                           install
gpgv                                            install
grep                                            install
groff-base                                      install
gzip                                            install
hostname                                        install
ifupdown                                        install
info                                            install
initscripts                                     install
ipchains                                        install
iptables                                        install
iputils-ping                                    install
irb1.8                                          install
klogd                                           install
laptop-detect                                   install
libacl1                                         install
libattr1                                        install
libblkid1                                       install
libbz2-1.0                                      install
libc6                                           install
libcap1                                         install
libcomerr2                                      install
libconsole                                      install
libdb4.2                                        install
libdb4.3                                        install
libdb4.4                                        install
libdevmapper1.02                                install
libedit2                                        install
libfribidi0                                     install
libgcc1                                         install
libgcrypt11                                     install
libgdbm3                                        install
libgnutls13                                     install
libgpg-error0                                   install
libgpmg1                                        install
libkrb53                                        install
libldap2                                        install
liblocale-gettext-perl                          install
liblockfile1                                    install
liblzo1                                         install
libncurses5                                     install
libncursesw5                                    install
libnewt0.52                                     install
libopencdk8                                     install
libopenssl-ruby                                 install
libopenssl-ruby1.8                              install
libpam-modules                                  install
libpam-runtime                                  install
libpam0g                                        install
libpcre3                                        install
libpopt0                                        install
libreadline-ruby1.8                             install
libreadline5                                    install
libruby1.8                                      install
libsasl2-2                                      install
libsasl2-modules                                install
libselinux1                                     install
libsepol1                                       install
libsigc++-2.0-0c2a                              install
libslang2                                       install
libss2                                          install
libssl0.9.8                                     install
libstdc++6                                      install
libtasn1-3                                      install
libtext-charwidth-perl                          install
libtext-iconv-perl                              install
libtext-wrapi18n-perl                           install
libusb-0.1-4                                    install
libuuid1                                        install
libwrap0                                        install
libxmlrpc-ruby                                  install
login                                           install
logrotate                                       install
lsb-base                                        install
lv                                              install
mailx                                           install
makedev                                         install
man-db                                          install
manpages                                        install
mawk                                            install
mktemp                                          install
modutils                                        install
mount                                           install
nano                                            install
ncurses-base                                    install
ncurses-bin                                     install
net-tools                                       install
netbase                                         install
netcat                                          install
nvi                                             install
openbsd-inetd                                   install
openssh-client                                  install
openssh-server                                  install
passwd                                          install
perl-base                                       install
procps                                          install
puppet                                          install
rdoc                                            install
rdoc1.8                                         install
readline-common                                 install
ruby                                            install
ruby1.8                                         install
sed                                             install
slang1a-utf8                                    install
ssh                                             install
sudo                                            install
sysklogd                                        install
sysv-rc                                         install
sysvinit                                        install
sysvinit-utils                                  install
tar                                             install
tasksel                                         install
tasksel-data                                    install
tcpd                                            install
telnet                                          install
traceroute                                      install
tree                                            install
tzdata                                          install
update-inetd                                    install
util-linux                                      install
wget                                            install
whiptail                                        install
zlib1g                                          install
sh-3.1#

この設定でパッケージをインストールするには、下記の通り

sh-3.1# dpkg --set-selections < /mnt/dpkg.txt
sh-3.1# apt-get dselect-upgrade
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
dhcp-client
The following NEW packages will be installed:
bzip2 deborphan dhcp3-client dhcp3-common dialog facter irb1.8 libedit2 libkrb53
libopenssl-ruby libopenssl-ruby1.8 libreadline-ruby1.8 libruby1.8 libxmlrpc-ruby lv
netcat openssh-client openssh-server puppet rdoc rdoc1.8 ruby ruby1.8 ssh sudo
traceroute tree
0 upgraded, 27 newly installed, 1 to remove and 0 not upgraded.
Need to get 6132kB of archives.
After unpacking 17.2MB of additional disk space will be used.
Do you want to continue [Y/n]?
...省略...
Setting up tree (1.5.0-2) ...
Setting up ssh (4.3p2-9) ...
sh-3.1#

ネットワークの設定

ネットワークの設定を忘れてました。

sh-3.1# cat /etc/network/interfaces
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
sh-3.1#

これで、etchへのバージョンアップと基本的な設定は、完了… かな?

タイトルとURLをコピーしました