debootstrap Edit

debootstrapを使用して、debianのユーザランドを構築する例を示します。

  • debootstrap
    landisk:~# debootstrap --arch sh4 \
    --include=kernel-image-2.6.16-sh,kexec-tools,reiserfsprogs,psmisc,hotplug,telnetd,dhcp-client,\
    gnupg,readline-common,libreadline5 \
    etch /debian26 http://192.168.1.81/www/download/debian26
    
    …省略…
    I: Base system installed successfully.
    
  • landisk-toolsの適用
    landisk0:~# tar vxzpf /share/www/download/debian26/base/landisk-tools-20051110.tgz -C /debian26
    ./boot/boot.b-selk
    ./etc/lilo.conf
    ./etc/init.d/
    ./etc/init.d/btnctrl
    ./sbin/lilo
    ./usr/local/lib/landisk-tools/btn_action.conf
    ./usr/local/src/landisk-tools/btnctrl.back
    ./usr/local/src/landisk-tools/gio2.c
    ./usr/local/src/landisk-tools/sh-lilo-selk.tgz
    ./usr/local/src/landisk-tools/btnctrl.c
    ./usr/local/src/landisk-tools/ledctrl.c
    ./usr/local/sbin/gio2
    ./usr/local/sbin/gio2_unload
    ./usr/local/sbin/ledctrl
    ./usr/local/sbin/landisk-tools.setup
    ./usr/local/sbin/gio2_load
    
  • 初期設定ファイルの適用
    landisk:~# tar vxzpf /share/www/download/debian26/base/base26-sh4-appended.tgz  -C /debian26
    ./boot/kernelsw.conf
    ./dev/sisusbvga0
    ./dev/sisusbvga1
    ./dev/sisusbvga2
    ./dev/sisusbvga3
    ./dev/sisusbvga4
    ./dev/sisusbvga5
    ./dev/sisusbvga6
    ./dev/sisusbvga7
    ./etc/X11/xorg.conf
    ./etc/apt/sources.list
    ./etc/apt/preferences
    ./etc/apt/apt.conf
    ./etc/console/boottime.kmap.gz
    ./etc/default/hotplug
    ./etc/securetty
    ./etc/fstab
    ./etc/hosts
    ./etc/hosts.allow
    ./etc/network/interfaces
    ./etc/modprobe.d/sisusbvga
    ./etc/hostname
    ./etc/localtime
    ./etc/hotplug/usb/pl2303
    ./etc/hotplug/usb/ftdi_sio
    ./etc/hosts.deny
    ./etc/inittab
    ./etc/resolv.conf
    ./root/.Xresources
    ./root/.emacs
    ./root/.twmrc
    ./root/.xsession
    
  • chrootでdebootstrap環境へ入る
    landisk:~# chroot /debian26
    chroot:/# mount -t proc proc proc
    
  • /devの作成
    chroot:/# cd /dev
    chroot:/dev# ./MAKEDEV generic-sh initrd usb video input md
    chroot:/dev# cd /
    
  • rootパスワード&ユーザ設定
    chroot:/# passwd
    Enter new UNIX password: landisk 
    Retype new UNIX password: landisk 
    passwd: password updated successfully
    
    chroot:/# adduser landisk
    Adding user `landisk'...
    Adding new group `landisk' (1000).
    Adding new user `landisk' (1000) with group `landisk'.
    Creating home directory `/home/landisk'.
    Copying files from `/etc/skel'
    Enter new UNIX password: landisk 
    Retype new UNIX password: landisk 
    passwd: password updated successfully
    Changing the user information for landisk
    Enter the new value, or press ENTER for the default
            Full Name []: 
            Room Number []: 
            Work Phone []: 
            Home Phone []: 
            Other []: 
    Is the information correct? [y/N] y
    
  • landisk-toolsのセットアップ
    chroot:/# /usr/local/sbin/landisk-tools.setup 
     Removing any system startup links for /etc/init.d/landiskpoff ...
     Removing any system startup links for /etc/init.d/btnctrl ...
     Adding system startup for /etc/init.d/btnctrl ...
       /etc/rc0.d/K00btnctrl -> ../init.d/btnctrl
       /etc/rc1.d/K00btnctrl -> ../init.d/btnctrl
       /etc/rc6.d/K00btnctrl -> ../init.d/btnctrl
       /etc/rc2.d/S99btnctrl -> ../init.d/btnctrl
       /etc/rc3.d/S99btnctrl -> ../init.d/btnctrl
       /etc/rc4.d/S99btnctrl -> ../init.d/btnctrl
       /etc/rc5.d/S99btnctrl -> ../init.d/btnctrl
    Starting btnctrl/dev/btnctrl open error...
    .
    
  • 後始末&chroot環境を抜ける
    chroot:/# dpkg --purge debootstrap-udeb
    chroot:/# apt-get clean
    chroot:/# rm /var/lib/apt/lists/192.168.1.81*
    
    chroot:/# umount /proc
    chroot:/# exit
    exit
    landisk:~# 
    
  • 圧縮
    landisk:~# tar --numeric-owner -cvzpf base26-sh4-20051121-etch.tgz debian26
    
    


初期設定ファイルの詳細 Edit

ネットワーク/システム関係 Edit

  • ファイルシステム
    • /etc/fstab
      起動時fsckをスキップさせるため、6カラム目を0にする。
      シリアルコンソールがない場合、手のほどこししようがなくなるのを防止するための暫定処置
      # UNCONFIGURED FSTAB FOR BASE SYSTEM
      /dev/hda3     /            ext2    defaults        0 0
      #proc          /proc        proc    defaults        0 0
      /dev/hda2     swap         swap    defaults        0 0
      
      ブート時「Mounting local filesystems...failed!」と出力されるため(実害ないもよう)、procを削除。

  • タイムゾーンの設定
    • Asia/Tokyoを設定
      # tzconfig
      Your current time zone is set to UTC
      Do you want to change that? [n]: y
      …省略
      Your default time zone is set to 'Asia/Tokyo'.
      Local time is now:      Sat Apr  9 18:01:07 JST 2005.
      Universal Time is now:  Sat Apr  9 09:01:07 UTC 2005.
      
  • ネットワーク設定
    • /etc/hosts
      127.0.0.1    localhost
      192.168.1.81 landisk
      
    • /etc/hostname
      landisk
  • /etc/resolv.conf
    nameserver 192.168.1.1
  • /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 static
    address 192.168.1.81
    netmask 255.255.255.0
    gateway 192.168.1.1
    
  • login/セキュリティ関係
    • /etc/securetty
      # /etc/securetty: list of terminals on which root is allowed to login.
      # See securetty(5) and login(1).
      console
      ttySC1     ←追加
      
    • /etc/inittab
      # Note that on most Debian systems tty7 is used by the X Window System,
      # so if you want to add more getty's go ahead but skip tty7 if you run X.
      #
      1:2345:respawn:/sbin/getty 9600 ttySC1 ← 追加
      2:23:respawn:/sbin/getty 38400 tty1 ← 追加(サインはVGAのコンソール用)
      #1:2345:respawn:/sbin/getty 38400 tty1  ← 以下コメント
      #2:23:respawn:/sbin/getty 38400 tty2
      #3:23:respawn:/sbin/getty 38400 tty3
      #4:23:respawn:/sbin/getty 38400 tty4
      #5:23:respawn:/sbin/getty 38400 tty5
      #6:23:respawn:/sbin/getty 38400 tty6
      
      
    • /etc/hosts.allow
      ALL : 127.0.0.1 192.168.1. 192.168.0.  ← 追加
      
    • /etc/hosts.deny
      ALL : ALL ← 追加
      
  • apt-getの設定
    • /etc/apt/sources.list
      deb http://eggplant.ddo.jp/www/download/debian26 etch nain
      deb-src http://ftp.debian.or.jp/debian/ etch main non-free contrib
      
    • /etc/apt/apt.conf
      APT::GET::AllowUnauthenticated 1;
      
    • /etc/apt/preferences
      ホールド指定(現状ノンアクティブ)とxfree86パッケージを除去する。
      Package: *
      Pin: release l=debian26-hold
      Pin-Priority: 1001
      
      … 省略 …
      Package: xserver-xfree86
      Pin: version 4.*
      Pin-Priority: -1
      
      … 省略 …
      

USBデバイス、X11、アプリの初期設定 Edit

  • USBシリアルケーブルで接続できるように設定しておく
    • /etc/hotplug/usb/ftdi_sio
    • /etc/hotplug/usb/pl2303
      #!/bin/sh
      
      /sbin/getty -L ttyUSB0 9600 vt100 &
      #/sbin/getty -L ttyUSB0 38400 vt100 &
      exit 0
      
  • サインはVGA関係のコンソール設定だけしておく
    • /etc/default/hotplug
      下記箇所を変更
      IGNORE_PCI_CLASS_DISPLAY=false
      
    • etc/inittab
      1:2345:respawn:/sbin/getty 9600 ttySC1
      2:23:respawn:/sbin/getty 38400 tty1
      
    • /etc/modprobe.d/sisusbvga
      options sisusbvga first=1 last=1
      
    • /dev/sisusbvgaドライバの用意
      landisk:~# mknod /dev/sisusbvga0 c 180 133
      landisk:~# mknod /dev/sisusbvga1 c 180 134
      landisk:~# mknod /dev/sisusbvga2 c 180 135
      landisk:~# mknod /dev/sisusbvga3 c 180 136
      landisk:~# mknod /dev/sisusbvga4 c 180 137
      landisk:~# mknod /dev/sisusbvga5 c 180 138
      landisk:~# mknod /dev/sisusbvga6 c 180 139
      landisk:~# mknod /dev/sisusbvga7 c 180 140
      landisk:~# chmod 660 /dev/sisusbvga
      
    • コンソールのキーボード配列指定
      # ln -s /usr/share/keymaps/i386/qwerty/jp106.kmap.gz /mnt/hda3/etc/console/boottime.kma
      
  • X11関係
    • /etc/X11/xorg.conf
    • /root/.xsession
    • /root/.Xresources
    • /root/.twmrc
  • その他
    • /root/.emacs
    • /boot/kernelsw.conf

初期パッケージ Edit

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name                   Version               Description
+++-======================-=====================-============================================
ii  adduser                3.77                  Add and remove users and groups
ii  apt                    0.6.42.1              Advanced front-end for dpkg
ii  apt-utils              0.6.42.1              APT utility programs
ii  aptitude               0.2.15.9-7            terminal-based apt frontend
ii  at                     3.1.9                 Delayed job execution and batch processing
ii  base-config            2.73                  Debian base system configurator
ii  base-files             3.1.9                 Debian base system miscellaneous files
ii  base-passwd            3.5.10                Debian base system master password and group
ii  bash                   3.0-17                The GNU Bourne Again SHell
ii  bsdmainutils           6.1.2                 collection of more utilities from FreeBSD
ii  bsdutils               2.12p-8               Basic utilities from 4.4BSD-Lite
ii  console-common         0.7.54                Basic infrastructure for text console config
ii  console-data           2002.12.04dbs-49      Keymaps, fonts, charset maps, fallback table
ii  console-tools          0.2.3dbs-57           Linux console and font utilities
ii  coreutils              5.2.1-2.1             The GNU core utilities
ii  cpio                   2.6-9                 GNU cpio -- a program to manage archives of 
ii  cron                   3.0pl1-91             management of regular background processing
ii  debconf                1.4.58                Debian configuration management system
ii  debconf-i18n           1.4.58                full internationalization support for debcon
ii  debianutils            2.15                  Miscellaneous utilities specific to Debian
ii  dhcp-client            2.0pl5-19.1           DHCP Client
ii  diff                   2.8.1-11              File comparison utilities
ii  dpkg                   1.13.11               package maintenance system for Debian
ii  dselect                1.13.11               user tool to manage Debian packages
ii  e2fslibs               1.38-2                ext2 filesystem libraries
ii  e2fsprogs              1.38-2                ext2 file system utilities and libraries
ii  ed                     0.2-20                The classic unix line editor
ii  exim4                  4.54-1                metapackage to ease exim MTA (v4) installati
ii  exim4-base             4.54-1                support files for all exim MTA (v4) packages
ii  exim4-config           4.54-1                configuration for the exim MTA (v4)
ii  exim4-daemon-light     4.54-1                lightweight exim MTA (v4) daemon
ii  findutils              4.2.25-1              utilities for finding files--find, xargs, an
ii  gcc-4.0-base           4.0.2-2               The GNU Compiler Collection (base package)
ii  gettext-base           0.14.5-2              GNU Internationalization utilities for the b
ii  gpgv-udeb              1.4.1-1               minimal signature verification tool
ii  grep                   2.5.1.ds2-2           GNU grep, egrep and fgrep
ii  groff-base             1.18.1.1-10           GNU troff text-formatting system (base syste
ii  gzip                   1.3.5-12              The GNU compression utility
ii  hostname               2.91                  utility to set/show the host name or domain 
ii  hotplug                0.0.20040329-25       Linux Hotplug Scripts
ii  ifupdown               0.6.7                 high level tools to configure network interf
ii  info                   4.8-1                 Standalone GNU Info documentation browser
ii  initscripts            2.86.ds1-4            Standard scripts needed for booting and shut
ii  iptables               1.3.3-2               Linux kernel 2.4+ iptables administration to
ii  iputils-ping           20020927-3            Tools to test the reachability of network ho
ii  kernel-image-2.6.14-sh landisk.0.1           Linux kernel binary image for version 2.6.14
ii  kexec-tools            1.101-2sh             kexec tool
ii  klogd                  1.4.1-17              Kernel Logging Daemon
ii  laptop-detect          0.12.1                attempt to detect a laptop
ii  libacl1                2.2.32-1              Access control list shared library
ii  libattr1               2.4.25-1              Extended attribute shared library
ii  libblkid1              1.38-2                block device id library
ii  libbz2-1.0             1.0.2-10              high-quality block-sorting file compressor l
ii  libc6                  2.3.5-8               GNU C Library: Shared libraries and Timezone
ii  libcap1                1.10-14               support for getting/setting POSIX.1e capabil
ii  libcomerr2             1.38-2                common error description library
ii  libconsole             0.2.3dbs-57           Shared libraries for Linux console and font 
ii  libdb2                 2.7.7.0-10            The Berkeley database routines (run-time fil
ii  libdb3                 3.2.9-22              Berkeley v3 Database Libraries [runtime]
ii  libdb4.2               4.2.52-18             Berkeley v4.2 Database Libraries [runtime]
ii  libdb4.3               4.3.28-2              Berkeley v4.3 Database Libraries [runtime]
ii  libgcc1                4.0.2-2               GCC support library
ii  libgcrypt11            1.2.2-1               LGPL Crypto library - runtime library
ii  libgdbm3               1.8.3-2               GNU dbm database routines (runtime version)
ii  libgnutls11            1.0.16-14             GNU TLS library - runtime library
ii  libgpg-error0          1.1-4                 library for common error values and messages
ii  libident               0.22-3                simple RFC1413 client library - runtime
ii  libkrb53               1.3.6-5               MIT Kerberos runtime libraries
ii  libldap2               2.1.30-12             OpenLDAP libraries
ii  liblocale-gettext-perl 1.05-1                Using libc functions for internationalizatio
ii  liblockfile1           1.06                  NFS-safe locking library, includes dotlockfi
ii  liblzo1                1.08-2                data compression library
ii  libncurses5            5.4-9                 Shared libraries for terminal handling
ii  libncursesw5           5.4-9                 Shared libraries for terminal handling (wide
ii  libnewt0.51            0.51.6-31             Not Erik's Windowing Toolkit - text mode win
ii  libopencdk8            0.5.7-2               Open Crypto Development Kit (OpenCDK) (runti
ii  libpam-modules         0.79-3                Pluggable Authentication Modules for PAM
ii  libpam-runtime         0.79-3                Runtime support for the PAM library
ii  libpam0g               0.79-3                Pluggable Authentication Modules library
ii  libpcre3               6.4-1                 Perl 5 Compatible Regular Expression Library
ii  libpopt0               1.7-5                 lib for parsing cmdline parameters
ii  libsasl2               2.1.19-1.7            Authentication abstraction library
ii  libsasl2-modules       2.1.19-1.7            Pluggable Authentication Modules for SASL
ii  libselinux1            1.26-1                SELinux shared libraries
ii  libsepol1              1.8-1                 Security Enhanced Linux policy library for c
ii  libsigc++-1.2-5c2      1.2.5-5               type-safe Signal Framework for C++ - runtime
ii  libslang2              2.0.4-7               The S-Lang programming library - runtime ver
ii  libss2                 1.38-2                command-line interface parsing library
ii  libssl0.9.7            0.9.7g-5              SSL shared libraries
ii  libssl0.9.8            0.9.8a-3              SSL shared libraries
ii  libstdc++6             4.0.2-2               The GNU Standard C++ Library v3
ii  libtasn1-2             0.2.13-1              Manage ASN.1 structures (runtime)
ii  libtext-charwidth-perl 0.04-3                get display widths of characters on the term
ii  libtext-iconv-perl     1.4-2                 converts between character sets in Perl
ii  libtext-wrapi18n-perl  0.06-4                internationalized substitute of Text::Wrap
ii  libtextwrap1           0.1-3                 text-wrapping library with i18n - runtime
ii  libusb-0.1-4           0.1.10a-21            userspace USB programming library
ii  libuuid1               1.38-2                universally unique id library
ii  libwrap0               7.6.dbs-8             Wietse Venema's TCP wrappers library
ii  login                  4.0.13-1              system login tools
ii  logrotate              3.7.1-2               Log rotation utility
ii  lsb-base               3.0-11                Linux Standard Base 3.0 init script function
ii  mailx                  8.1.2-0.20050715cvs-1 A simple mail user agent
ii  makedev                2.3.1-78              creates device files in /dev
ii  man-db                 2.4.3-3               The on-line manual pager
ii  manpages               2.02-2                Manual pages about using a GNU/Linux system
ii  mawk                   1.3.3-11              a pattern scanning and text processing langu
ii  module-init-tools      3.2-pre9-2            tools for managing Linux kernel modules
ii  modutils               2.4.27.0-3            Linux module utilities
ii  mount                  2.12p-8               Tools for mounting and manipulating filesyst
ii  nano                   1.3.8-2               free Pico clone with some new features
ii  ncurses-base           5.4-9                 Descriptions of common terminal types
ii  ncurses-bin            5.4-9                 Terminal-related programs and man pages
ii  net-tools              1.60-16               The NET-3 networking toolkit
ii  netbase                4.23                  Basic TCP/IP networking system
ii  netkit-inetd           0.10-10.2             The Internet Superserver
ii  nvi                    1.79-22               4.4BSD re-implementation of vi
ii  passwd                 4.0.13-1              change and administer password and group dat
ii  perl-base              5.8.7-7               The Pathologically Eclectic Rubbish Lister
ii  procps                 3.2.5-1               /proc file system utilities
ii  psmisc                 21.6-1                Utilities that use the proc filesystem
ii  reiserfsprogs          3.6.19-1              User-level tools for ReiserFS filesystems
ii  sasl2-bin              2.1.19-1.7            Programs for manipulating the SASL users dat
ii  sed                    4.1.2-8               The GNU sed stream editor
ii  slang1a-utf8           1.4.9dbs-8            The S-Lang programming library with utf8 sup
ii  sysklogd               1.4.1-17              System Logging Daemon
ii  sysv-rc                2.86.ds1-4            Standard boot mechanism using symlinks in /e
ii  sysvinit               2.86.ds1-4            System-V like init
ii  tar                    1.15.1-2              GNU tar
ii  tasksel                2.32                  Tool for selecting tasks for installation on
ii  tcpd                   7.6.dbs-8             Wietse Venema's TCP wrapper utilities
ii  telnetd                0.17-32               The telnet server
ii  util-linux             2.12p-8               Miscellaneous system utilities
ii  wget                   1.10.2-1              retrieves files from the web
ii  whiptail               0.51.6-31             Displays user-friendly dialog boxes from she
ii  zlib1g                 1.2.3-4               compression library - runtime

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2006-06-13 (火) 20:02:27 (6530d)