debootstrap Edit

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

  • cmd.sh
    まず、debootstrapを呼び出すcmd.shを作成
    #!/bin/sh
    
    debootstrap --arch sh4 \
    --exclude=\
    gcc-3.0-base,gcc-3.3-base,gcc-3.3,cpp-3.3,g++-3.3,\
    libstdc++3,libstdc++5,libstdc++5-3.3-dev \
    --include=\
    kernel-image-2.6.13-sh,module-init-tools,reiserfsprogs,kexec-tools,\
    gcc-3.4-base,libstdc++6,\
    dialog,libncursesw5,telnetd \
    sarge /debian26 http://eggplant.ddo.jp/www/download/debian26
    
  • debootstrap実行
    landisk:~# chmod +x cmd.sh
    landisk:~# mkdir /debian26
    landisk:~# ./cmd.sh
    I: Validating debootstrap.invalid_dists_sarge_Release
    I: Validating debootstrap.invalid_dists_sarge_main_binary-sh4_Packages
    I: Checking adduser...
    I: Checking apt...
    I: Checking apt-utils...
    ・・・省略・・・
    
    I: Base system installed successfully.
    umount: /debian26/dev/pts: not mounted
    umount: /debian26/dev/shm: not mounted
    umount: /debian26/proc/bus/usb: not found
    landisk:~# 
    
  • 動作確認
    出来上がったユーザランドはchroot下でそのまま動作させることができます。
    • debian26_start ・・・ chroot起動スクリプト
      #!/bin/sh
      root=/debian26
      
      if [ ! -e $root/proc/cpuinfo ]; then 
         /usr/sbin/chroot $root mount -t proc proc /proc
      fi
      
      /usr/sbin/chroot $root /bin/bash
      
    • chrootで起動
      landisk:~# chmod +x debian26_start
      landisk:~# ./debian26_start
      chroot:~/#
      chroot:~/# dpkg -l
      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.63           Add and remove users and groups
      ii  apt            0.5.28.1       Advanced front-end for dpkg
      ii  apt-utils      0.5.28.1       APT utility programs
      ii  aptitude       0.2.15.8-1     terminal-based apt frontend
      ii  at             3.1.8-11       Delayed job execution and batch processing
      ii  base-config    2.53.8         Debian base system configurator
      ii  base-files     3.1.2          Debian base system miscellaneous files
      ii  base-passwd    3.5.9          Debian base system master password and group
      ii  bash           2.05b-24       The GNU Bourne Again SHell
      ii  bsdmainutils   6.0.17         collection of more utilities from FreeBSD
      ii  bsdutils       2.12p-4        Basic utilities from 4.4BSD-Lite
      ii  console-common 0.7.49         Basic infrastructure for text console config
      ii  console-data   2002.12.04dbs- Keymaps, fonts, charset maps, fallback table
      ii  console-tools  0.2.3dbs-56    Linux console and font utilities
      ii  coreutils      5.2.1-2        The GNU core utilities
      ii  cpio           2.5-1.2        GNU cpio -- a program to manage archives of 
      ii  cron           3.0pl1-86      management of regular background processing
      ii  debconf        1.4.30.11      Debian configuration management system
      ii  debconf-i18n   1.4.30.11      full internationalization support for debcon
      ii  debianutils    2.8.4          Miscellaneous utilities specific to Debian
      ii  dhcp-client    2.0pl5-19.1    DHCP Client
      ii  dialog         1.0-20050306-1 Displays user-friendly dialog boxes from she
      ii  diff           2.8.1-11       File comparison utilities
      ii  dpkg           1.10.27        Package maintenance system for Debian
      ii  dselect        1.10.27        a user tool to manage Debian packages
      ii  e2fslibs       1.37-2sarge1   ext2 filesystem libraries
      ii  e2fsprogs      1.37-2sarge1   ext2 file system utilities and libraries
      ii  ed             0.2-20         The classic unix line editor
      ii  exim4          4.50-4         metapackage to ease exim MTA (v4) installati
      ii  exim4-base     4.50-4         support files for all exim MTA (v4) packages
      ii  exim4-config   4.50-4         configuration for the exim MTA (v4)
      ii  exim4-daemon-l 4.50-4         lightweight exim MTA (v4) daemon
      ii  findutils      4.1.20-5       utilities for finding files--find, xargs, an
      ii  gcc-3.4-base   3.4.3-13       The GNU Compiler Collection (base package)
      ii  gettext-base   0.14.1-7       GNU Internationalization utilities for the b
      ii  grep           2.5.1.ds1-4    GNU grep, egrep and fgrep
      ii  groff-base     1.18.1.1-7     GNU troff text-formatting system (base syste
      ii  gzip           1.3.5-9        The GNU compression utility
      ii  hostname       2.13           A utility to set/show the host name or domai
      ii  ifupdown       0.6.4-4.12     high level tools to configure network interf
      ii  info           4.7-2.2        Standalone GNU Info documentation browser
      ii  initscripts    2.86.ds1-1     Standard scripts needed for booting and shut
      ii  iptables       1.2.11-8       Linux kernel 2.4+ iptables administration to
      ii  iputils-ping   20020927-2     Tools to test the reachability of network ho
      ii  kernel-image-2 landisk.0.3    Linux kernel binary image for version 2.6.13
      ii  kexec-tools    1.99-kogiidena kexec tool
      ii  klogd          1.4.1-16       Kernel Logging Daemon
      ii  libacl1        2.2.23-1       Access control list shared library
      ii  libattr1       2.4.16-1       Extended attribute shared library
      ii  libblkid1      1.37-2sarge1   block device id library
      ii  libc6          2.3.5-6        GNU C Library: Shared libraries and Timezone
      ii  libcap1        1.10-14        support for getting/setting POSIX.1e capabil
      ii  libcomerr2     1.37-2sarge1   common error description library
      ii  libconsole     0.2.3dbs-56    Shared libraries for Linux console and font 
      ii  libdb1-compat  2.1.3-7        The Berkeley database routines [glibc 2.0/2.
      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  libgcc1        3.4.3-13       GCC support library
      ii  libgcrypt11    1.2.0-4        LGPL Crypto library - runtime library
      ii  libgdbm3       1.8.3-2        GNU dbm database routines (runtime version)
      ii  libgnutls11    1.0.16-9       GNU TLS library - runtime library
      ii  libgpg-error0  1.0-1          library for common error values and messages
      ii  liblocale-gett 1.01-17        Using libc functions for internationalizatio
      ii  liblockfile1   1.06           NFS-safe locking library, includes dotlockfi
      ii  liblzo1        1.08-1.2       A real-time data compression library
      ii  libncurses5    5.4-4          Shared libraries for terminal handling
      ii  libncursesw5   5.4-4          Shared libraries for terminal handling (wide
      ii  libnewt0.51    0.51.6-20      Not Erik's Windowing Toolkit - text mode win
      ii  libopencdk8    0.5.5-10       Open Crypto Development Kit (OpenCDK) (runti
      ii  libpam-modules 0.76-22        Pluggable Authentication Modules for PAM
      ii  libpam-runtime 0.76-22        Runtime support for the PAM library
      ii  libpam0g       0.76-22        Pluggable Authentication Modules library
      ii  libpcap0.7     0.7.2-7        System interface for user-level packet captu
      ii  libpcre3       4.5-1.1        Perl 5 Compatible Regular Expression Library
      ii  libperl5.8     5.8.4-8        Shared Perl library
      ii  libpopt0       1.7-5          lib for parsing cmdline parameters
      ii  libsigc++-1.2- 1.2.5-4        type-safe Signal Framework for C++ - runtime
      ii  libss2         1.37-2sarge1   command-line interface parsing library
      ii  libssl0.9.7    0.9.7e-2       SSL shared libraries
      ii  libstdc++6     3.4.3-13       The GNU Standard C++ Library v3
      ii  libtasn1-2     0.2.10-3       Manage ASN.1 structures (runtime)
      ii  libtext-charwi 0.04-1         get display widths of characters on the term
      ii  libtext-iconv- 1.2-3          Convert between character sets in Perl
      ii  libtext-wrapi1 0.06-1         internationalized substitute of Text::Wrap
      ii  libtextwrap1   0.1-1          text-wrapping library with i18n - runtime
      ii  libuuid1       1.37-2sarge1   universally unique id library
      ii  libwrap0       7.6.dbs-8      Wietse Venema's TCP wrappers library
      ii  login          4.0.3-31sarge1 system login tools
      ii  logrotate      3.7-2          Log rotation utility
      ii  mailx          8.1.2-0.200405 A simple mail user agent
      ii  makedev        2.3.1-77       creates device files in /dev
      ii  man-db         2.4.2-21       The on-line manual pager
      ii  manpages       1.70-1         Manual pages about using a GNU/Linux system
      ii  mawk           1.3.3-11       a pattern scanning and text processing langu
      ii  module-init-to 3.2-pre1-2     tools for managing Linux kernel modules
      ii  modutils       2.4.26-1.2     Linux module utilities
      ii  mount          2.12p-4        Tools for mounting and manipulating filesyst
      ii  nano           1.2.4-3        free Pico clone with some new features
      ii  ncurses-base   5.4-4          Descriptions of common terminal types
      ii  ncurses-bin    5.4-4          Terminal-related programs and man pages
      ii  net-tools      1.60-10        The NET-3 networking toolkit
      ii  netbase        4.20           Basic TCP/IP networking system
      ii  netkit-inetd   0.10-10        The Internet Superserver
      ii  nvi            1.79-22        4.4BSD re-implementation of vi
      ii  passwd         4.0.3-31sarge1 change and administer password and group dat
      ii  perl-base      5.8.4-8        The Pathologically Eclectic Rubbish Lister
      ii  ppp            2.4.2+20040428 Point-to-Point Protocol (PPP) daemon
      ii  pppconfig      2.3.11         A text menu based utility for configuring pp
      ii  pppoe          3.5-4          PPP over Ethernet driver
      ii  pppoeconf      1.5            configures PPPoE/ADSL connections
      ii  procps         3.2.1-2        The /proc file system utilities
      ii  reiserfsprogs  3.6.19-1       User-level tools for ReiserFS filesystems
      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-16       System Logging Daemon
      ii  sysv-rc        2.86.ds1-1     Standard boot mechanism using symlinks in /e
      ii  sysvinit       2.86.ds1-1     System-V like init
      ii  tar            1.13.93-4      GNU tar
      ii  tasksel        2.24           Tool for selecting tasks for installation on
      ii  tcpd           7.6.dbs-8      Wietse Venema's TCP wrapper utilities
      ii  telnet         0.17-26        The telnet client.
      ii  telnetd        0.17-26        The telnet server.
      ii  util-linux     2.12p-4        Miscellaneous system utilities
      ii  wget           1.9.1-8        retrieves files from the web
      ii  whiptail       0.51.6-20      Displays user-friendly dialog boxes from she
      ii  zlib1g         1.2.2-4        compression library - runtime
      

各種設定 Edit

  • タイムゾーンの設定
    • /etc/default/rcS
      UTC=no
      
  • 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 ← 追加
      #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 ← 追加
      
    • rootパスワードの設定
      # passwd
      Enter new UNIX password: landisk   ← 例です。
      Retype new UNIX password: landisk
      passwd: password updated successfully
      
    • ユーザ作成
      # adduser landisk
      …省略
      
  • その他
    • /root/.emacs
    • /root/.xsession
    • /root/.Xresources
    • /root/.twmrc
    • /boot/kernelsw.conf
    • apt-get clean
Counter: 7146, today: 1, yesterday: 0

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