OpenBSDのインストール
OpenBSDというのは、FreeBSDやNetBSDと並ぶ、BSD系のunix類の1つです。いちばんの特徴としては、セキュリティを重視しているということが挙げられる。
FreeBSDの日本語ドキュメント類はあるのですが、OpenBSDはなかなか無いので、i386アーキテクチャのプラットフォームマシン(一般のPC)にインストールした際のメモ書き。
OpenBSDのインストールは、テキストベースのインストーラにより行う。i386プラットフォームでは、Floppy,CD-ROM,network からブートが可能。また、インストールするデータは、CD-ROM,FTP,HTTP,ローカルHDパーティション,NFS等からデータを取得する。
4.2からISOイメージが公式で配布されるようになったので、CDから起動して、インストールするのが、スタンドアローンで出来るし楽で良いかと…。
- OpenBSD FAQ: 4 - OpenBSD Installation Guide
インストールの開始
インストールを始めるまで。
1.インストーラの起動
マシンの電源を入れて、CDをセットします。ブートメッセージやシステム情報がずらずらと表示されてきますので起動し終わるまで待つ。最近のマシンならCD BOOTは対応してると思う、起動できない場合は、BIOSの設定を確認する。FD等からのブートにする。
インストールするか、アップデートするかを聞かれるので、インストールを選択する。
root on rd0a swap on rd0b dump on rd0b
erase ^?, werase ^W, kill ^U, intr ^C, status ^T
(I)nstall, (U)pgrade or (S)hell? i{Enter}
2.ようこそ
インストールを選ぶと以下のようなメッセージが表示される。
Welcome to the OpenBSD/i386 4.3 install program. This program will help you install OpenBSD. At any prompt except password prompts you can escape to a shell by typing '!'. Default answers are shown in []'s and are selected by pressing RETURN. At any time you can exit this program by pressing Control-C, but exiting during an install can leave your system in an inconsistent state.
3.ターミナルタイプの設定
端末の種類を聞かれる。デフォルトで良いのでそのまま次に進める。
Terminal type: [vt220] {Enter}
4.キーボードの設定
キーボードマッピングを設定する。L で指定できるマッピングのリストが表示される。日本語キーボードなので jp を指定する。
kbd(8) mapping? ('L' for list) [none] L {Enter}
Major tables: be br cf de dk es fr hu it jp la lt nl no pl pt ru sf sg si sv
tr ua uk us
kbd(8) mapping? ('L' for list) [none] jp {Enter}
kbd: keyboard mapping set to jp
5.確認
データをパックアップしたか?本当にインストールして良いか聞かれるので、よければ YES を入力する。
IS YOUR DATA BACKED UP? As with anything that modifies disk contents, this
program can cause SIGNIFICANT data loss.
It is often helpful to have the installation notes handy. For complex disk
configurations, relevant disk hardware manuals and a calculator are useful.
Proceed with install? [no] yes {Enter}
ディスクの設定
ハードディスクのパーティション設定、フォーマット、マウント設定
1.ディスクの選択
インストール先のディスクを選ぶ。IEDの1番目ならwd0、SCSIの1番目ならsd0にする。2番目以降は、wd1,wd2…のようになる。
Cool! Let's get to it...
You will now initialize the disk(s) that OpenBSD will use. To enable all
available security features you should configure the disk(s) to allow the
creation of separate filesystems for /, /tmp, /var, /usr, and /home.
Available disks are: wd0.
Which one is the root disk? (or done) [wd0] {Enter}
2.ディスクの利用方法
ディスク全体をOpenBSDで使用するかを聞かれる。全体を使用するので、YESを入力する。
Do you want to use *all* of wd0 for OpenBSD? [no] yes {Enter}
3a.パーティションの作成
上記でディスク全体を使用するようにした場合は、OpenBSD 用のパーティションが一つ作成される。
Putting all of wd0 into an active OpenBSD MBR Partition (type 'A6')...done.
3b.パーティションの作成
インストール先のディスクのパーティションを作成/設定する。fdisk(8) が立ち上がるので必要に応じて切り分ける。
4.ラベルエディタ
ラベルエディタが起動するので、BSD流のパーティションを切ります。
You will now create an OpenBSD disklabel inside the OpenBSD MBR
partition. The disklabel defines how OpenBSD splits up the MBR partition
into OpenBSD partitions in which filesystems and swap space are created.
The offsets used in the disklabel are ABSOLUTE, i.e. relative to the
start of the disk, NOT the start of the OpenBSD MBR partition.
# Inside MBR partition 3: type A6 start 63 size 16771797
Treating sectors 63-16771860 as the OpenBSD portion of the disk.
You can use the 'b' command to change this.
Initial label editor (enter '?' for help at any prompt)
> ? {Enter}
Available commands:
? [cmnd] - this message or command specific help.
a [part] - add new partition.
b - set OpenBSD disk boundaries.
c [part] - change partition size.
D - set label to default.
d [part] - delete partition.
e - edit drive parameters.
g [b|d|u] - use [b]ios, [d]isk or [u]ser geometry.
M - show entire OpenBSD man page for disklabel.
m [part] - modify existing partition.
n [part] - set the mount point for a partition.
p [unit] - print label.
q - quit and save changes.
r - recalculate free space.
s [path] - save label to file.
u - undo last change.
w - write label to disk.
X - toggle expert mode.
x - exit without saving changes.
z - zero out partition table.
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).
'%' for percent of total disk size, '&' for percent of free space.
Non-sector units will be rounded to the nearest cylinder.
Entering '?' at most prompts will give you (simple) context sensitive help.
>
とりあえず、現状を表示して、'c'(全体)以外のパーティションが存在する場合は、「d」でクリアする。そのまま利用する場合は、「n」でマウント場所を設定する。
Initial label editor (enter '?' for help at any prompt)
> p {Enter}
device: /dev/rwd0c
type: ESDI
disk: ESDI/IDE disk
label: Virtual HD
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 1044
total sectors: 16777152
free sectors: 16771797
rpm: 3600
16 partitions:
# size offset fstype [fsize bsize cpg]
c: 16777152 0 unused 0 0
>
※「p」コマンドで表示する単位を指定できる(らしい)。MB単位なら「p m」、GB単位なら「p g」とする。
パーティションの内訳はこんな感じ…。深く考えていないので適当。/usr配下のサイズは目安。
| 名前 | マウント | サイズ | 備考 |
|---|---|---|---|
| wd0a | / | 512M | 普通はもっと少なくて良いらしい… |
| wd0b | (swap) | 512M | 昔はメモリの2-3倍だったけど… |
| /tmp | 今回はRAMをディスクに割り当て | ||
| wd0d | /usr | 2.0G | インストール直後は400M (Xあり+150M?) |
| /usr/src/sys | カーネルコンパイル後で100M | ||
| /usr/src | バイナリソースコンパイル後で600M | ||
| /usr/obj | バイナリオブジェコンパイル後で800M | ||
| /usr/ports | portsソースソース展開後で130M | ||
| /usr/XF4 | XF4ソースソース展開後で340M | ||
| wd0e | /var | 2.0G | インストール直後は10M未満 |
| wd0f | /home | 3.0G | 残り全部 |
| wd0 | (合計) | 約8G |
※Installation Guide を見ると、スワップをRAMの2倍にするのは、古い経験則でナンセンスらしい。通常十分なRAMを持たせてスワップさせないようにするのが望ましい。
※webサーバを chroot して /var/www で動かす場合は、/home/*/public_html 出来ないので /var/www/users などを利用する。その分を考慮して /var を割り当てる。
各パーティションを割り当てる。「a」でパーティション名を指定しなければ、最初に聞かれる(らしい)。
> a a {Enter}
offset: [63] {Enter}
size: [16771797] 512M {Enter}
Rounding to nearest cylinder: 1060227
FS type: [4.2BSD] {Enter}
mount point: [none] / {Enter}
> a b {Enter}
offset: [1060290] {Enter}
size: [15711570] 512M {Enter}
Rounding to nearest cylinder: 1060290 {Enter}
FS type: [swap] {Enter}
> a d {Enter}
offset: [2120580] {Enter}
size: [14651280] 2G {Enter}
Rounding to nearest cylinder: 4209030
FS type: [4.2BSD] {Enter}
mount point: [none] /usr {Enter}
> a e {Enter}
offset: [6329610] {Enter}
size: [10442250] 2G {Enter}
Rounding to nearest cylinder: 4209030
FS type: [4.2BSD] {Enter}
mount point: [none] /var {Enter}
> a f {Enter}
offset: [10538640] {Enter}
size: [6233220] {Enter}
FS type: [4.2BSD] {Enter}
mount point: [none] /home {Enter}
>
割り当てた内容を表示して、「q」で終了する。と書き込むか聞かれるので、編集した内容を書き込む。
> p {Enter}
device: /dev/rwd0c
type: ESDI
disk: ESDI/IDE disk
label: Virtual HD
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 1044
total sectors: 16777152
free sectors: 0
rpm: 3600
16 partitions:
# size offset fstype [fsize bsize cpg]
a: 1060227 63 4.2BSD 2048 16384 1 # /
b: 1060290 1060290 swap
c: 16777152 0 unused 0 0
d: 4209030 2120580 4.2BSD 2048 16384 1 # /usr
e: 4209030 6329610 4.2BSD 2048 16384 1 # /var
f: 6233220 10538640 4.2BSD 2048 16384 1 # /home
> q {Enter}
Write new label?: [y] {Enter}
ラベルエディタを終了したらマウントポイントの確認が出るので一通り確認してdoneを入力し終了。
Mount point for wd0d (size=2104515k)? (or 'none' or 'done') [/usr] {Enter}
Mount point for wd0e (size=2104515k)? (or 'none' or 'done') [/var] {Enter}
Mount point for wd0f (size=3116610k)? (or 'none' or 'done') [/home] {Enter}
Mount point for wd0d (size=2104515k)? (or 'none' or 'done') [/usr] done {Enter}
5.フォーマット
フォーマットしてよいか聞かれるので、YESを入力し、フォーマットを行う。
No more disks to initialize.
OpenBSD filesystems:
wd0a /
wd0d /usr
wd0e /var
wd0f /home
The next step *DESTROYS* all existing data on these partitions!
Are you really sure that you're ready to proceed? [no] y {Enter}
/dev/rwd0a: 517.7MB in 1060224 sectors of 512 bytes 4 cylinder groups of 129.42MB, 8283 blocks, 16640 inodes each /dev/rwd0d: 2055.2MB in 4209028 sectors of 512 bytes 11 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/rwd0e: 2055.2MB in 4209028 sectors of 512 bytes 11 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/rwd0f: 3043.6MB in 6233220 sectors of 512 bytes 16 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each /dev/wd0a on /mnt type ffs (rw, asynchronous, local, ctime=Wed Sep 17 22:59:34 2 008) /dev/wd0f on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid, ctime=W ed Sep 17 22:59:34 2008) /dev/wd0e on /mnt/var type ffs (rw, asynchronous, local, nodev, ctime=Wed Sep 17 22:59:34 2008) /dev/wd0d on /mnt/usr type ffs (rw, asynchronous, local, nodev, nosuid, ctime=We d Sep 17 22:59:34 2008)
ホスト設定 その1
1.ホスト名の設定
マシンのホスト名を設定する。
System hostname? (short form, e.g. 'foo') myhost {Enter}
2.ネットワークの設定
ネットワークの設定を行うか聞かれるので、YESを入力する。
Configure the network? [yes] {Enter}
ネットワークカードの選択
Available interfaces are: de0.
Which one do you wish to initialize? (or 'done') [de0] {Enter}
Symbolic (host) name for de0? [myhost] {Enter}
The media options for de0 are currently
media: Ethernet autoselect (100baseTX)
Do you want to change the media options? [no] {Enter}
IPv4のネットワークアドレスを設定する。
IPv4 address for de0? (or 'none' or 'dhcp') 192.168.0.254 {Enter}
IPv4のネットワークマスクを設定する。
Netmask? [255.255.255.0] {Enter}
IPv6のネットワークアドレスを設定する。
IPv6 address for de0? (or 'rtsol' or 'none') [none] {Enter}
No more interfaces to initialize.
ドメイン名を設定する。
DNS domain name? (e.g. 'bar.com') [my.domain] example.com {Enter}
ネームサーバ(DNS)のアドレスを設定する。
DNS nameserver? (IP address or 'none') [none] 192.168.0.1 {Enter}
インストールでネームサーバ(DNS)を使用するか聞かれるので、YESを入力する。
Use the nameserver now? [yes] {Enter}
IPv4のデフォルトゲートウエイを指定する。
Default IPv4 route? (IPv4 address, 'dhcp' or 'none') 192.168.0.1 {Enter}
add net default: gateway 192.168.0.1
hostsファイルは編集しないので'no'で。
Edit hosts with ed? [no] {Enter}
マニュアル設定はしないので、'no'で。
Do you want to do any manual network configuration? [no] {Enter}
3.管理者パスワードの設定
rootのパスワードを設定します。入力した文字は実際は表示されません。
Password for root account? (will not echo) *** {Enter}
Password for root account? (again) *** {Enter}
インストール
インストール開始
1.インストールメディアの選択
インストールメディアの選択する。CDから起動してCDを利用するので、基本はそのままエンター。
Let's install the sets!
Location of sets? (cd disk ftp http or 'done') [cd] {Enter}
Available CD-ROMs are: cd0.
Which one contains the install media? (or 'done') [cd0] {Enter}
Pathname to the sets? (or 'done') [4.3/i386] {Enter}
2.ファイル・セットの選択
インストールするファイルセットを選ぶ。Xは使わないのでそのまま。gameも使わないので「-game43.tgz」で外してもよい。
Select sets by entering a set name, a file name pattern or 'all'. De-select
sets by prepending a '-' to the set name, file name pattern or 'all'. Selected
sets are labelled '[X]'.
[X] bsd
[X] bsd.rd
[ ] bsd.mp
[X] base43.tgz
[X] etc43.tgz
[X] misc43.tgz
[X] comp43.tgz
[X] man43.tgz
[X] game43.tgz
[ ] xbase43.tgz
[ ] xetc43.tgz
[ ] xshare43.tgz
[ ] xfont43.tgz
[ ] xserv43.tgz
Set name? (or 'done') [bsd.mp] done {Enter}
3.ファイル・セットのインストール
ファイルセットをインストールする。
Ready to install sets? [yes] {Enter}
Getting bsd ...
100% |**************************************************| 6356 KB 00:02
Getting bsd.rd ...
100% |**************************************************| 5003 KB 00:01
Getting base43.tgz ...
100% |**************************************************| 42854 KB 00:46
Getting etc43.tgz ...
100% |**************************************************| 1190 KB 00:01
Getting misc43.tgz ...
100% |**************************************************| 2252 KB 00:02
Getting comp43.tgz ...
100% |**************************************************| 77563 KB 01:17
Getting man43.tgz ...
100% |**************************************************| 7530 KB 00:08
Getting game43.tgz ...
100% |**************************************************| 2547 KB 00:02
Location of sets? (cd disk ftp http or 'done') [done] {Enter}
ホスト設定 その2
1.SSHデーモンの設定
sshを使うので、yesのままで。
Start sshd(8) by default? [yes] {Enter}
2.NTPデーモンの設定
マシンの時刻を合わせるために OpenNTPD を起動するようにする。デフォルトでは pool.ntp.org が使われる。
NTP server? (host, 'none' or 'default') [none] default {Enter}
3.X Window Systemの設定
Xは使わないので、no で。
Do you expect to run the X Window System? [no] no {Enter}
4.シリアルコンソールの設定
特に設定しないのでそのまま。
Change the default console to com0? [no] {Enter}
5.設定の保存
デーモンと端末の設定が保存される。
Saving configuration files...done. Generating initial host.random file...done.
6.タイムゾーンの設定
タイムゾーンをJapanに設定する。
What timezone are you in? ('?' for list) [Canada/Mountain] ?
Africa/ Chile/ GB-Eire Israel NZ-CHAT UCT
America/ Cuba GMT Jamaica Navajo US/
Antarctica/ EET GMT+0 Japan PRC UTC
Arctic/ EST GMT-0 Kwajalein PST8PDT Universal
Asia/ EST5EDT GMT0 Libya Pacific/ W-SU
Atlantic/ Egypt Greenwich MET Poland WET
Australia/ Eire HST MST Portugal Zulu
Brazil/ Etc/ Hongkong MST7MDT ROC posix/
CET Europe/ Iceland Mexico/ ROK posixrules
CST6CDT Factory Indian/ Mideast/ Singapore right/
Canada/ GB Iran NZ Turkey zone.tab
Canada/ GB Iran NZ Turkey zone.tab
What timezone are you in? ('?' for list) [Canada/Mountain] Japan {Enter}
7.ディバイスの作成
設定したタイムゾーンの設定とディバイスファイルの作成が行われる。
Setting local timezone to 'Japan'...done. Making all device nodes...done. Installing boot block... boot: /mnt/boot proto: /usr/mdec/biosboot device: /dev/rwd0c /usr/mdec/biosboot: entry point 0 proto bootblock size 512 /mnt/boot is 3 blocks x 16384 bytes fs block shift 2; part offset 63; inode block 24, offset 1576 using MBR partition 3: type 166 (0xa6) offset 63 (0x3f) done.
8.完了
CONGRATULATIONS! Your OpenBSD install has been successfully completed! To boot the new system, enter halt at the command prompt. Once the system has halted, reset the machine and boot from the disk. #
再起動して必要に応じた端末やサーバの設定(確認)を行う。
- 端末関係:OpenBSD/Terminal / サーバ関係:OpenBSD/Server
- 最新のソースを利用してビルドし直す場合は、OpenBSD/Rebuild?
- 追加でソフトウエアを追加する場合は、OpenBSD/Software?
最終更新時間:2019年10月21日 16時06分44秒 指摘や意見などあればSandBoxのBBSへ。