CD-ROM からインストールする

OpenBSD を CD-ROM から i386 アーキテクチャのマシン(一般のPC)にインストールした際のメモです。 OpenBSD のインストールは、テキストベースのインストーラにより行います。 とてもシンプルな作りなので、操作は簡単です。

参考: OpenBSD FAQ: Installation Guide

このメモは、2.9 版に基づいています。 3.0 および 3.1 版の CD-ROM の添付文書によると、 3.0, 3.1 版になっても、ここに書いた範囲は、ほとんど変わっていないようです。

CD-ROMから起動する

  1. BIOS が CD-ROM からのブート機能をサポートしている場合には、CD#1 を使ってブートします。 CD-ROM からのブート機能をサポートしていない場合や、CD-ROM からのブートに失敗した場合には、 他のマシンを使ってブート用の FD を作り、それでブートする必要があります。 ブート用の FD を作るためのデータは、CD#1 にありますが、 サポートするデバイスの種類により複数種類あるので、 /2.9/i386/install.i386 の説明に従って、適切なものを選ぶ必要があります。
  2. ブートに成功すると、以下の質問で止まるので、i を入力してインストールを進めます。
    erase ^?, werase ^W, kill ^U, intr ^C, status ^T
    (I)nstall, (U)pgrade or (S)hell? i〈Enter〉
    
  3. ターミナルタイプを聞かれますが、デフォルトのままで良いので、 〈Enter〉のみを入力します。
    Specify terminal type [vt220]: 〈Enter〉
    

ディスクの環境を整える

  1. どのディスクにインストールするかの選択があるので、適切なものを入力します。 最初の IDE ディスクなら wd0、最初の SCSI ディスクなら sd0 にします。 デフォルト( [ ] の中の値)で良ければ、〈Enter〉のみを入力します(以下同様)。
      ・・・  Available disks are:
    
    wd0
    
    Which disk is the root disk? [wd0] 〈Enter〉
    
  2. ディスク全体を OpenBSD で使うか聞かれるので、yes を入力します。
    Do you want to use the *entire* disk for OpenBSD? [no] yes〈Enter〉
    
    Windows等と共存させる場合には、ここで、no を入力します。 その場合、 fdiskコマンドが起動して、DOS レベルのパーティションを編集することができます。 ただし、OpenBSD に付属する fdisk ツールは 8GB までのディスクにしか対応していないので、 最近のディスクだと大き過ぎて正常に処理できないと思われます。 なお、ディスクの先頭から 8GB を越える位置にパーティションを確保した場合、 "Only LBA values are valid in ending cylinder for partition #n." といったメッセージが出て、syl の表示が上限の 1023 になってしまいます。 これは、CHSモードの仕様上の制限であり、LBAモードの値( [ ] の中)が正しければOKです。 例えば、15GBのディスク全体を使った場合には、以下のようになります。
    Disk: wd0       geometry: 1836/255/63 [29495340 sectors]
    Offset: 0       Signatures: 0xAA55,0x0
             Starting       Ending
     #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
    ------------------------------------------------------------------------
     0: 00    0   0   0 -    0   0   0 [         0 -          0] unused
     1: 00    0   0   0 -    0   0   0 [         0 -          0] unused
     2: 00    0   0   0 -    0   0   0 [         0 -          0] unused
    *3: A6    0   1   1 - 1023 254  63 [        63 -   29495277] OpenBSD
    
  3. label editor が起動するので、BSD 流のパーティションを切ります。 プロンプト ">" に対して、? を入力すると、コマンドのヘルプが表示されるので、 それを参考にして、パーティションを追加します。
    Initial label editor (enter '?' for help at any prompt)
    > ?〈Enter〉
    
    Available commands:
            p [unit]  - print label.
            M         - show entire OpenBSD man page for disklabel.
            e         - edit drive parameters.
            a [part]  - add new partition.
            b         - set OpenBSD disk boundaries.
            c [part]  - change partition size.
            d [part]  - delete partition.
            g [d|b]   - Use [d]isk or [b]ios geometry.
            m [part]  - modify existing partition.
            n [part]  - set the mount point for a partition.
            r         - recalculate free space.
            u         - undo last change.
            s [path]  - save label to file.
            w         - write label to disk.
            q         - quit and save changes.
            x         - exit without saving changes.
            X         - toggle expert mode.
            ? [cmnd]  - this message or command specific help.
    Numeric parameters may use suffixes to indicate units:
            'b' for bytes, 'c' for cylinders, 'k' for kilobytes, 'm' for megabytes,
            'g' for gigabytes or no suffix for sectors (usually 512 bytes).
            Non-sector units will be rounded to the nearest cylinder.
    
    Entering '?' at most prompts will give you (simple) context sensitive help.
    > d a〈Enter〉
    > a a〈Enter〉
    offset: [63] 〈Enter〉
    size: [29498049] 256m〈Enter〉
    Rounding to nearest cylinder: 524097
    FS type: [4.2BSD] 〈Enter〉
    mount point: [none] /〈Enter〉
    > a b〈Enter〉
    offset: [524160] 〈Enter〉
    size: [28973952] 256m〈Enter〉
    Rounding to nearest cylinder: 524160
    FS type: [swap] 〈Enter〉
    > a c〈Enter〉
      ・・・
    > w〈Enter〉
    > q〈Enter〉
    
    パーティションの面子と大きさは、 マシンの利用目的により適切に決める必要がありますが、以下に、その例を示します。 最近のディスクは十分に余裕があるので、あまり深く考えずに決めてあります。
    a: /
    256MB ・・・ 普通は、この 1/4 でも良いでしょう
    b: swap
    256MB
    e: /tmp
    512MB
    f: /var
    3GB ・・・ 各種 Spool と HTTP キャッシュに十分な大きさ
    g: /usr
    4GB ・・・ OS とアプリをコンパイルするのに十分な大きさ
    h: /home
    6GB ・・・ 残りの全て
  4. マウントポイントの確認があるので、一通りの確認をします。 〈Enter〉を入力しながら確認し、 全て確認が終わったら done を入力します。
    You will now have the opportunity to enter filesystem information for wd0.
    You will be prompted for the mount point (full path, including the prepending
    '/' character) for each BSD partition on wd0.  Enter "none" to skip a
    partition or "done" when you are finished.
    
    The following partitions will be used for the root filesystem and swap:
            wd0a    /
            wd0b    swap
    
    Mount point for wd0e (size=524160k) [/tmp, RET, none, or done]? 〈Enter〉
    Mount point for wd0f (size=3144960k) [/var, RET, none, or done]? 〈Enter〉
    Mount point for wd0g (size=4193280k) [/usr, RET, none, or done]? 〈Enter〉
    Mount point for wd0h (size=6362496k) [/home, RET, none, or done]? 〈Enter〉
    Mount point for wd0e (size=524160k) [/tmp, RET, none, or done]? done〈Enter〉
    
  5. 他のディスクも初期化するか聞かれるので、他に無ければ、done を入力します。
    Now you can select another disk to initialize.  (Do not re-select a disk
    you have already entered information for).  Available disks are:
    
    wd0
    
    Which one? [done]〈Enter〉
    
  6. ファイルシステム作成(newfs)の確認があるので、良ければ、y を入力します。 この処理には少し時間が掛かります。
    The next step will overwrite any existing data on:
            wd0a wd0e wd0f wd0g wd0h
    
    Are you really sure that you're ready to proceed? [n] y〈Enter〉
    Creating filesystems...
      ・・・
    

ネットワークを設定する

  1. ネットワークを設定するか聞かれるので、y を入力します。
    Configure the network [y] 〈Enter〉
    
  2. ホスト名とドメイン名を入力します。
    Enter system hostname (short form): [] myserver〈Enter〉
    Enter DNS domain name: [] my.domain〈Enter〉
    
  3. 設定するネットワーク・インターフェースを聞かれるので、 表示される一覧から選んで、名前を入力します。 ネットワーク・インターフェースの名前の意味は、 OpenBSD/i386 の、 Ethernet Adapters の項目で調べることができます。
    You may configure the following network interfaces (the interfaces
    marked with [X] have been successfully configured):
    
            [ ] fxp0
            [ ] fxp1
    
    Configure which interface? (or, enter 'done') [fxp0] 〈Enter〉
    
  4. 選択したネットワーク・インターフェースに対応する、 IPアドレス、ホスト名、ネットマスク等を入力します。
    IP address (or 'dhcp') ? [] 192.168.1.10〈Enter〉
    Symbolic (host) name? [myserver] 〈Enter〉
    Netmask ? [255.255.255.0] 〈Enter〉
    Your use of the network interface may require non-default
    media directives.  The default media is:
            media: Ethernet autoselect (100baseTX full-duplex)
    This is a list of supported media:
            media autoselect
            media 100baseTX mediaopt full-duplex
            media 100baseTX
            media 10baseT mediaopt full-duplex
            media 10baseT
    If the default is not satisfactory, and you wish to use another
    media, copy that line from above (e.g. "media 100baseTX")
    Media directives? [] 〈Enter〉
    
  5. 再び、ネットワーク・インターフェースの選択になるので、 他にも設定するインターフェースがあるのなら、最初と同様に選択して設定を行います。 全ての設定が終わったら、done を入力して終了します。
  6. デフォルトルーターとネームサーバの設定をします(IP アドレスを入力する)。 CD-ROM からのインストールであれば、これらを後で設定しても良いので、 ここで設定しくてもOKです(none を入力する)。
    Enter IP address of default route: [none] 192.168.1.1〈Enter〉
    Enter IP address of primary nameserver: [none] 〈Enter〉
    

ディスクへコピーする

  1. シェルに抜けて何か作業をするか聞かれるので、n を入力します。
    You will now be given the opportunity to escape to the command shell to do
    any additional network configuration you may need.  This may include adding
    additional routes, if needed.  In addition, you might take this opportunity
    to redo the default route in the event that it failed above.
    Escape to shell? [n] 〈Enter〉
    
  2. rootの初期パスワードを設定します。 同じものを2度入力します。
    Please enter the initial password that the root account will have.
    Password (will not echo): パスワード〈Enter〉
    Password (again): パスワード〈Enter〉
    
  3. X window を使うか聞かれるので、y または n で答えます。
    Do you expect to run the X Window System? [y] n〈Enter〉
    
  4. インストール元のメディアを選択します。 CD-ROM の場合には c を入力します。
    Install from (f)tp, (h)ttp, (t)ape, (C)D-ROM, (N)FS or local (d)isk? c〈Enter〉
    
  5. CD-ROM のデバイス名と CD-ROM 内のディレクトリを指定します。 ディレクトリはバージョンとアーキテクチャにより異なりますが、 通常はデフォルトのままでOKです。
    The following CD-ROM devices are installed on your system; please make
    sure the CD is in the CD-ROM drive and select the device containing
    the CD with the installation sets:
    
    cd0
    
    Which CD-ROM contains the installation media? [cd0] 〈Enter〉
    
    Enter the directory relative to the mount point that
    contains the file. [/2.9/i386] 〈Enter〉
    
  6. インストールするパッケージを選択します。 希望するファイル名を入力すれば対象に追加され、 マイナスとファイル名を入力すれば対象から削除されます。 選択が終わったら、done を入力します。
    The following sets are available for extraction.
    Enter filename, `list', `all', or `done'.
    You may de-select a set by prepending a '-' to its name.
    
            [X] base29.tgz
            [X] etc29.tgz
            [ ] misc29.tgz
            [ ] comp29.tgz
            [X] man29.tgz
            [ ] game29.tgz
            [ ] xbase29.tgz
            [ ] xshare29.tgz
            [ ] xfont29.tgz
            [ ] xserv29.tgz
            [X] bsd
    File name? [] misc29〈Enter〉
      ・・・
    File name? [] comp29〈Enter〉
    
    The following sets are available for extraction.
    Enter filename, `list', `all', or `done'.
    You may de-select a set by prepending a '-' to its name.
    
            [X] base29.tgz
            [X] etc29.tgz
            [X] misc29.tgz
            [X] comp29.tgz
            [X] man29.tgz
            [ ] game29.tgz
            [ ] xbase29.tgz
            [ ] xshare29.tgz
            [ ] xfont29.tgz
            [ ] xserv29.tgz
            [X] bsd
    File name? [] done〈Enter〉
    
  7. ディスク上に書き込んで良いかの確認があるので、y を入力します。 この後、選択したパッケージがディスク上にコピーされるので、少し時間が掛かります。
    Reday to extract selected file sets? [y] 〈Enter〉
    
  8. インストールが終わると、 さらに追加インストールするか聞かれるので、n を入力します。
    Extract more sets? [n] 〈Enter〉
    

コピー後の設定をする

  1. タイムゾーンの設定をします。 日本時間ならば、Japan を入力します。
    To get a listing of what's available in /usr/share/zoneinfo, enter "?"
    at the prompts below.
    
    What timezone are you in? [`?' for list] [GMT] ?〈Enter〉
    Africa/      Chile/       GB-Eire      Israel       NZ-CHAT      Turkey
    America/     Cuba         GMT          Jamaica      Navajo       UCT
    Antarctica/  EET          GMT+0        Japan        PRC          US/
    Arctic/      EST          GMT-0        Kwajalein    PST8PDT      UTC
    Asia/        EST5EDT      GMT0         Libya        Pacific/     Universal
    Atlantic/    Egypt        Greenwich    MET          Poland       W-SU
    Australia/   Eire         HST          MST          Portugal     WET
    Brazil/      Etc/         Hongkong     MST7MDT      ROC          Zulu
    CET          Europe/      Iceland      Mexico/      ROK          posixrules
    CST6CDT      Factory      Indian/      Mideast/     Singapore
    Canada/      GB           Iran         NZ           SystemV/
    What timezone are you in? [`?' for list] [GMT] Japan〈Enter〉
    
    備考: OpenBSD の デフォルトでは、RTC の時間は UTC(GMT) と規定されています。 そのため、RTC が日本時間になっていると、OpenBSD 上では時間がずれてしまいます。 RTC を UTC に合わせるか、カーネルのコンフィギュレーションを変更する必要があります。
  2. インストールが完了すると、コマンドプロンプトになるので、 reboot コマンドを入力します。
    CONGRATULATIONS!  You have successfully installed OpenBSD!  To boot the
    installed system, enter halt at the command prompt. Once the system has
    halted, reset the machine and boot from the disk.
    
    # reboot〈Enter〉
    
  3. リブートが成功したら root でログインし、動作を確認します。 以上で、インストールは終了ですが、実際に使えるマシンにするには、 各種の設定やアプリケーションのインストールを行う必要があります。 まずは、 man afterboot を実行して、 その内容を一読することから始めるのが良いでしょう。