[[FreeBSD]]

ようやく安定版 FreeBSD 5 として 5.3-RELEASE が出たので、この機に移行。
手順は FreeBSD 4.x の時とほぼ同じ。
若干メッセージがまともになった。

5.x でディレクトリ構造などが変わっているので、
4.x から 5.x への移行は結構大変ではないかと思う。

* インストーラを起動する。 [#p908434e]

-公式サイト http://www.jp.freebsd.org に行く。
-「配布」の「日本の FreeBSD 関連サーバー(ftp, www, cvsup, ...)」で「本家公式配布物」の適当なミラーサイトに行く。
-ISO-IMAGES-i386/5.3/ の中の 5.3-RELEASE-i386-disc1.iso をダウンロードする。
-ISOイメージで CD-R に焼く。
-PC を起動する。
-BIOS の設定で、CD-ROM から起動するようにする。
-FreeBSD 5.3R の CD-ROM を PC に入れて起動する。

起動メニューが出る。

 1. Boot FreeBSD [default]
 2. ...

ここは特に選ばなくても次に進む。急ぐなら [Enter] を押す。

メインメニューが出る。

                            sysinstall Main Menu
 Welcome to the FreeBSD installation and configuration tool.  Please
 select one of the options below by using the arrow keys or typing the
 first character of the option name you're interested in.  Invoke an
 option with [SPACE] or [ENTER].  To exit, use [TAB] to move to Exit.
 
    Usage       Quick start - How to use this menu system
   Standard     Begin a standard installation (recommended)
   Express      Begin a quick installation (for exparts)
    Custom      Begin a custom installation (for exparts)
   Configure    Do post-install configuration of FreeBSD
   Doc          Installation instructions, README, etc.
   Keymap       Select keyboard type
   Options      View/Set various installation options
   Fixit        Repair mode with CDROM/DVD/floppy or start shell
   Upgrade      Upgrade an existing system
   Load Config  Load default install configuration
   Index        Glossary of functions
 
                         [ Select ]    X Exit install

Standard を選ぶ。

-カーソルキーで項目移動。
-メニュー項目の先頭の文字(たとえば Standard なら "S")を押すと項目移動。
-[TAB] キーで別項目一覧への移動。

* パーティションを作成する。 [#o4aff209]

使い方についての説明が出るので、読んで [Enter] を押す。

ディスクが複数ある場合は、ここでどのディスクのパーティションを設定するのか問われる。

-ad0 が IDE1 のマスター。
-ad1 が IDE1 のスレーブ。
-ad2 が IDE2 のプライマリ。
-ad3 が IDE2 のスレーブ。

 Disk name:      ad0                                     FDISK Partition Editor
 DISK Geometry:  6296 cyls/16 heads/63 sectors = 6346368 sectors (3098MB)
 
 Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags
          0    6346368    6346367        -     12     unused        0
 
 
 The following commands are supported (in upper or lower case):
 
 A = Use Entire Disk   G = set Drive Geometry   C = Create Slice   F = 'DD' mode
 D = Delete Slice      Z = Toggle Size Units    S = Set Bootable   | = Wizard m.
 T = Change Type       U = Undo All Changes     Q = Finish
 
 Use F1 or ? to get more help, arrow keys to select.

通常は "A" を押して、ディスク全体を使えばよい。

 Offset       Size(ST)        End     Name  PType       Desc  Subtype    Flags
          0         63         62        -     12     unused        0
         63    6346305    6346367    ad0s1      8    freebsd      165

"Q" で設定終了。

以下、"C" でパーティションを作る場合

** パーティションの大きさの設定 [#mc23110f]

 Please specify the size for new FreeBSD slice in blocks
 or append a trailing 'M' for megabytes (e.g. 20M)

パーティションに使われるブロック数(セクター数)を聞かれる。
メガバイト(MB)単位にしたいなら、'M' をつける。

** パーティションの種別の設定 [#xb53cc63]

 Enter type of partition to create:
 
 Pressing Enter will choose the default, a native FreeBSD
 slice (type 165). Other popular values are 6 for a
 DOS FAT partition, 131 for a Linux ext2fs partiton, or
 130 for a Linux swap partition.
 
 Note:  If you choose a non-FreeBSD partition type, it will not
 be formatted or otherwise prepared, it will simply reserve space
 for you to use another tool, such as DOS format, to later format
 and actually use the partition.

FreeBSD の場合、165 を設定する。
最初から入力されているので、そのまま [Enter] でよい。

** ブートマネージャーの設定 [#caf2a917]

 FreeBSD comes with a boot sector that allows you to easily
 select between FreeBSD and any other operating systems on your machine
 at boot time.  If you have more than one drive and want to boot
 from the second one, the boot selector will also make it possible
 to do so (limitations in the PC BIOS usually prevent this otherwise).
 If you do not want a boot selector, or wish to replace an existing
 one, select "standard".  If you would perfer your Master Boot
 Record to remain untouched then select "None".
 
   NOTE:  PC-DOS users will almost certainly require "None"!
 
           BootMgr   Install the FreeBSD Boot Manager
           Standard  Install a standard MBR (no boot manager)
           None      Leave the Master Boot Record untouched

-複数の OS をブートする場合は BootMgr を使う。
-FreeBSD 1つのみブートする場合は Standard を使う。
-すでにブートマネージャーがインストールされている場合など、変更したくない場合は None を選ぶ。

** BSD パーティションの設定 [#dc21cbc0]

パーティションを分けておくことで、万が一ディスクの一部が破損した場合でも復帰できる可能性が高くなる。

 Now you need to create BSD partitions inside of the fdisk partition(s)
 just created.  If you have a reasonable amount of disk space (200MB or more)
 and don't have any special requirements, simple use the (A)uto command to
 allocate space automatically. If you have more specific needs or just don't
 care for the layout chosen by (A)uto, press F1 for more information on
 manual layout.

[Enter] を押すと次の画面になる。

 Disk: ad0       Partition name: ad0s1   Free: 6346305 blocks (3098MB)
 
 Part      Mount          Size Newfs   Part      Mount          Size Newfs
 ----      -----          ---- -----   ----      -----          ---- -----
 
 
 The following commands are valid here (upper or lower case):
 C = Create        D = Delete   M = Mount pt.
 N = Newfs Opts    Q = Finish   S = Toggle SoftUpdates   Z = Custom Newfs
 T = Toggle Newfs  U = Undo     A = Auto Defaults        R = Delete+Merge
 
 Use F1 or ? to get more help, arrow keys to select.

"A" を押すと、標準設定となる。基本的にはこれでかまわない。

 Part      Mount          Size Newfs
 ----      -----          ---- -----
 ad0s1a    /             256MB UFS2   Y
 ad0s1b    swap          486MB SWAP
 ad0s1d    /var          256MB UFS2+S Y
 ad0s1e    /tmp          256MB UFS2+S Y
 ad0s1f    /usr         1843MB UFS2+S Y

"Q" で終了する。

"C" を押すと、自分でパーティションを設定できる。
自分でパーティションを分ける場合も、基本は "A" の構成にするのがよい。

 Please specify the partition size in blocks or append a trailing G for
 gigabytes, M for megabytes, or C for cylinders.
 6346305 blocks (3098MB) are free.

サイズを設定する。

 If you want to use this partition for swap space, select Swap. 
 If you want to put a filesystem on it, choose FS.
 
                    FS    A file system
                    Swap  A swap partition.

スワップパーティションなら Swap を選ぶ。
ファイルシステムなら FS を選ぶ。

 Please specify a mount point for the partition

パーティションのマウント位置を入力する。("/var", "/tmp" など)

** インストール元の設定 [#ddff063e]

 FreeBSD can be installed from a variety of different installation
 media, ranging from floppies to an Internet FTP server.  If you're
 installing FreeBSD from a supported CD/DVD drive than this is generally
 the best media to use if you have no overriding reason for using other
 media.
 
     1 CD/DVD       Install from a FreeBSD CD/DVD
     2 FTP          Install from an FTP server
     3 FTP Passive  Install from an FTP server through a firewall
     4 HTTP         Install from an FTP server through a http proxy
     5 DOS          Install from a DOS partition
     6 NFS          Install over NFS
     7 File System  Install from an existing filesystem
     8 Floppy       Install from a floppy disk set
     9 Tape         Install from SCSI or QUIC tape
     X Options      Go to the Options screen

CD からインストールしているので、CD/DVD を選ぶ。

 Last Chance!  Are you SURE you want continue the installation?
 
 If you're running this on a disk with data you wish to save
 than WE STRONGLY ENCOURAGE YOU TO MAKE PROPER BACKUPS before
 proceeding!
 
 We can take no responsibility for lost disk contents!

インストールを進めてよいか最終確認をする。
Yes を選ぶとインストール開始。

 Congratulations!  You now have FreeBSD installed on your system.
 
 We will now more on to the final configuration questions.
 For any option you do not wish to configure, simply select
 No.
 
 If you wish to re-enter this utility after the system is up, you
 may do so by typing: /usr/sbin/sysintall.

インストール完了。ただし、ここはまだ基本部分のみ。さらにオプションを設定する。

** ネットワークの設定 [#x655bfb0]

 Would you like to configure any Ethernet or SLIP/PPP network devices?

Ethernet か SLIP/PPP ネットワークデバイスの設定をしますか?

Yes を選ぶとネットワークデバイスの設定に移る。

 If you are using PPP over a serial device, as opposed to a direct
 ethernet connection, then you may first need to dial your Internet
 Service Provider using the ppp utility we provide for that purpose.
 If you're using SLIP over a serial device then the expectation is
 that you have a HARDWIRED connection.
 
 You can also install over a parallel port using a special "laplink"
 cable to another machine running FreeBSD.

  rl0    RealTek 8129/8139 PCI ethernet card
  plip0  <unknown network interface type> 
  sl0    SLIP interface on device /dev/cuaa0 (COM1)
  ppp0   PPP interface on device /dev/cuaa0 (COM1)
  sl1    SLIP interface on device /dev/cuaa1 (COM2)
  ppp1   PPP interface on device /dev/cuaa1 (COM2)

Ethenet カードとして RealTek を使用しているので rl0 が表示されている。
rl0 を選ぶと設定に移る。

 Do you want to try IPv6 configuration of the interface?

IPv6 を設定するか?
No を選ぶ。(Yes を選択するならそれなりの知識をつけてから。)

 Do you want to try DHCP configuration of the interface?

LAN で DHCP サーバーがあるなら Yes。そうでなければ NO。

 Host:                            Domain:
 
 
 IPv4 Gateway:                    Name server:
 
 
             Configuration for Interface rl0
         IPv4 Address:            Netmask:
 
 
         Extra options to ifconfig (usually empty):
 

このあたりはネットワークの知識が必要。
-Host にホスト名を設定する。(たとえば sample)
-Domain にドメイン名を設定する。(たとえば myhome.local)
-IPv4 Gateway にゲートウェイサーバーの IP アドレスを指定する。
-Name server に DNS サーバーの IP アドレスを指定する。
-IPv4 Address にこのネットワークカードの IP アドレスを指定する。
-Netmask にこのネットワークカードの IP アドレスのネットマスクを指定する。

 Would you like to bring the rl0 interface up right now?

今すぐ rl0 インターフェイスを有効にしますか?

Yes を選ぶ。

 Do you want this machine to function as a network gateway?

このマシンをネットワークゲートウェイにしますか?
(2つのネットワーク間でこのマシンを通してパケットを通過させるか?)

通常は No。

 Do you want to configure inetd and the network services that it provides?

inetd とそれが提供するネットワークサービスを設定しますか?

telnet, ftp を有効にするなら Yes を選ぶ。

 The Internet Super Server (inetd) allows a number of simple Internet
 services to be enabled, including finger, ftp, and telnetd.  Enabling
 these services may increase risk of security problems by increasing
 the exposure of your system.
 
 With this in mind, do you wish to enable inetd?

インターネットスーパーサーバー(inetd) は、finger, ftp, telnetd を含む、いくつかの単純なインターネットサービスを有効にすることを許可します。
これらのサービスを有効にすることは、あなたのシステムの露出を増やし、セキュリティ問題のリスクを増やします。

これを念頭において、inetd を有効にしますか?

Yes を選ぶ。

 inetd(8) relies on its configuration file, /etc/inetd.conf, to determine
 which of its Internet services will be available.  The default FreeBSD
 inetd.conf(5) leaves all services disabled by default, so they must be
 specifically enabled in the configuration file before they will
 function, even once inetd(8) is enabled.  Note that services for
 IPv6 must be separately enabled from IPv4 services.
 
 Select [Yes] now to invoke an editor on /etc/inetd.conf, or [No] to
 use the current settings.

Yes を選ぶと、/etc/inetd.conf の編集に入る。

サービスはすべてコメントになっているので

 #ftp    stream tcp ...

以下のようにコメントをはずす。

 ftp     stream tcp ...

[ESC] キーでメニューが出る。

a) leave editor でエディタを終了する。

a) save changes でファイルを保存する。

 Would you like to enable SSH login?

SSH ログインを有効にしますか?

Yes を選ぶ。

 Do you want to have anonymous FTP access to this machine?

このマシンで匿名 FTP アクセスをさせますか?

No を選ぶ。

 Do you want to configure this machine as an NFS server?

このマシンを NFS サーバーとして設定しますか?

No を選ぶ。

 Do you want to configure this machine as an NFS client?

このマシンを NFS クライアントとして設定しますか?

No を選ぶ。

** コンソールの設定 [#xcef430e]

 Would you like to customize your system console settings?

コンソール設定をカスタマイズしますか?

Yes を選ぶ。

 The default system console driver for FreeBSD (syscons) has a
 number of configuration options which may be set according to
 your preference.
 
 When you are done setting configuration options, select Cancel.
 
  X Exit       Exit this menu (returning to previous)
  2 Font       Choose an alternate screen font
  3 Keymap     Choose an alternate keyboard map
  4 Repeat     Set the rate at which keys repeat
  5 Saver      Configure the screen saver
  6 Screenmap  Choose an alternete screenmap
  7 Ttys       Choose console terminal type

3 の Keymap を選ぶ。Japanese 106 を選ぶ。

5 の Saver を選ぶ。サーバーなら Green を選んでおけばよい。(モニタの電源を落としてくれるので省電力となる。)

** 日時の設定 [#u6943aa9]

Would you like to set this machine's time zone 2004-12-05 (日) 08:44:16

Is this machine's CMOS clock set to UTC?  If it is set to local time,
or you don't know, please choose NO here!

このマシンの CMOS クロックは UTC (GMT)に設定されていますか?
もし、ローカル時間に設定されているか、わからない場合は NO を選んでください。

 Select a region
 
 1  Africa
 ...
 5  Asia

5 Asia を選択する。

 Select a country or region

 1   Afganistan
 ...
 18  Japan

18 Japan を選択する。

 Does the abbreviation 'JST' look reasonable?

略称 'JST' は適していますか?

Yes を選択する。

** Linux エミュレーションの設定 [#mf071050]

 Would you like to enable Linux binary compatibility?

Linux バイナリ互換を有効にしますか?

No を選択する。必要であれば後から ports で最新版をインストールする。

** マウスの設定 [#t3a696d6]

 Does this system have a PS/2, serial, or bus mouse?

このシステムには PS/2, シリアルかバスマウスがありますか?

マウスがついているなら Yes。(USBマウスの場合は No)

 You can cut ant paste text in the text console by running the mouse
 daemon.  Specify a port and a protocol type of your mouse and enable
 the mouse daemon.  If you don't want this feature, select 6 to disable
 the daemon.
 Once you've enabled the mouse daemon, you can specify "/dev/sysmouse"
 as your mouse device and "SysMouse" or "MouseSystems" as mouse
 protocol when running the X configuration utility (see Configuration
 menu).

  X Exit     Exit this menu (returning to previous)
  2 Enable   Test and run the mouse daemon
  3 Type     Select mouse protocol type
  4 Port     Select mouse port
  5 Flags    Set additional flags
  6 Disable  Disable the mouse daemon

PS/2 マウスならいきなり 2 を選んでよい。

 Now move the mouse and see if it works.
 (Note that buttons don't have any effect for now.)

  Is the mouse cursor moving?

マウスを動かして、マウスが動作していることを確認してください。
(いまボタンは何も効果がないことに注意。)

マウスカーソルは動いていますか?

マウスカーソルが動いていれば Yes。
そうでなければ No を選んで、Type, Port を変更する。(通常は不要)

** パッケージのインストール [#f93e732a]

本来はここでパッケージをインストールするのだが、CD に欲しいパッケージが入っていないのでスキップする。

** ユーザー/グループの設定 [#a43e9073]

 Would you like to add any initial user accounts to the system?
 Adding at least one account for yourself at this stage is suggested
 since working as the "root" user is dangerous (it is easy to do
 things which adversely affect the entire system).

初期ユーザーアカウントをシステムに追加しますか?
"root"ユーザーで操作することは危険なので、
少なくとも1つあなた自身のアカウントをここで追加することを薦めます。
(root ユーザーで操作するとシステム全体に悪影響を与えてしまいやすいです。)

Yes を選ぶ。

 The submenus here allow to manipulate user groups and
 login accounts.
 
  X Exit  Exit this menu (returning to previous)
  User    Add a new user to the system.
  Group   Add a new user group to the system.

先に自分用のグループを作っておく。"G" を押して [Enter]。

              Add a new group
 Group name:                GID:
 
 Group member:
 

-Group name に名前を入力する。(例えば tanaka)
-GID はそのまま。(最初は 1001)
-Group members は空でよい。
[OK] を選択して

自分のアカウントを作る。"U" を押して [Enter]。

               Add a new user
 Login ID:    UID:      Group:   Password:
 
 Full name:                      Member groups:
 
 Home directory:    Login shell:
 

-Login ID に名前を入力する。(例えば tanaka)
-UID はそのまま。(最初は 1001)
-Group にさっき作ったグループを指定する。(例えば tanaka)
-Password にパスワードを指定する。
-Full name にフルネームを指定する。
-Member groups に wheel を指定する。(これにより su コマンドで root になれる。)
-Home directory はそのままでよい。(自動的に /home/ログインID となる。)
-Login shell はそのままでよい。(/bin/sh となる。後で bash などをインストールして変える。)

Exit で終了する。

** root パスワードの設定 [#h68d3a41]

 Now you must set the system manager's password.
 This is the password you'll use to log in as "root".

 New Password:
 Retype New Password:

パスワードを入力する。
文字を入力してもカーソルは進まないので注意。

** 最終確認 [#b4f3cb23]

 Visit the general configuration menu for a chance to set
 any last options?

 最後のオプション設定のために全般設定メニューに行きますか?

まだ設定しなおしたいなら Yes。
設定が終わったら No。

X Exit Install を選んでインストール終了。

 Are you sure you wish to exit?  The system will reboot
 (be sure to remove any floppies/CDs/DVDs from the drives)

本当に終了しますか? システムは再起動します。
(フロッピー/CD/DVD をドライブから取り出してください。)

Yes を選ぶ。

** 暗号鍵生成用ランダム文字列の入力 [#q45991a0]

 Type a full screenful of random junk to unblock
 it and remember to finish with <enter>. This will
 timeout in 300 seconds, but waiting for
 the timeout without typing junk may make the
 entropy source deliver predictable output.
 
 Just hit <enter> for fast+insecure startup.

途切れないように画面いっぱいにランダムに文字をタイプしてください。
その後、[enter]を押して終了してください。
これは300秒でタイムアウトします。
タイプしないでタイムアウトした場合、
予期できる出力を作るエントロピー供給源を作ります。
(要するに、すぐばれる暗号ができるようになる。)
高速で非安全な起動をしたいなら、単に<enter>を押してください。

適当にタイプして [Enter] を押す。

** ログイン [#qffd3b52]

 FreeBSD/i386 (sample.myhome.local) (ttyv0)
 
 login:

あなたのログインID でログインします。

 login: tanaka
 Password: (パスワード)


 FreeBSD 5.3-RELEASE (GENERIC) #0: ...
 
 Welcome to FreeBSD!
 ...
 $

無事起動しました。

** root になる [#t106abb7]
** ログアウトする。 [#l42b7589]

logout コマンドを実行する。

 $ logout
 
 FreeBSD/i386 (sample.myhome.local) (ttyv0)
 
 login:

(exit コマンドでもよい。exit コマンドと logout コマンドの違いは、exit コマンドの場合、常にシェルを終了させるが、logout コマンドはネストしたシェルは終了させない点。)

** ユーザーから root になる [#t106abb7]

su (switch user)コマンドを実行する。"su" とタイプして [Enter] を押す。

 $ su
 Password: (root のパスワード)
 sample#

root になると、プロンプトが "$" から "#" に変わる。

** 電源の切り方 [#g0589298]

 # fasthalt -p

root になって、fasthalt コマンドで切れる。
~-p オプションで自動的に電源が切れるが、マシンによっては切れない場合もある。

** crypt の暗号化方法を設定する。 [#qfcbcc31]

パスワードの標準暗号化方法は MD5 だが、crypt 関数は DES になってしまっている。

crypt 関数の暗号生成方法を MD5 にするには /etc/auth.conf に以下の設定を追加する。

 crypt_default   =       md5

詳しくは http://www.jp.freebsd.org/QandA/HTML/1944.html

*** 確認 [#k9f5f79d]

Perl スクリプトで以下を実行してみる。

 #!/usr/bin/perl
 print crypt("Hello", "salt"), "\n";

DES の場合、以下のように出力される。

 saNWRqREgiiUI 

MD5 の場合、以下のように出力される。

 $1$salt$GA2yy3uwTYggzLwQulR7k0

* インストールするアプリケーション [#ubf56db0]

|[[CVSup>FreeBSD/CVSup]]|CVS によるファイル更新を行う。|
|[[portupgrade>FreeBSD/portupgrade]]|更新が必要な ports を見つけて更新する。|
|[[OpenSSH>FreeBSD/OpenSSH]]|安全な Shell (Secure SHell)|
|[[OpenSSL>FreeBSD/OpenSSL]]|SSLプロトコル実装|
|[[daemontools>FreeBSD/daemontools]]|サービスの起動/停止/監視処理|
|[[ucspi-tcp>FreeBSD/ucspi-tcp]]|TCP関連コマンド群。|
|[[clockspeed>FreeBSD/clockspeed]]|時刻合わせ|
|[[djbdns>FreeBSD/djbdns]]|DNS サーバー/DNS キャッシュ|
|[[qmail>FreeBSD/qmail]]|メイルサーバー|
|[[PostgreSQL>FreeBSD/PostgreSQL]]|データベース|
|[[Apache2>FreeBSD/Apache2]]|Web サーバ|
|[[PHP>FreeBSD/PHP]]|PHP|
|[[suPHP>FreeBSD/suPHP]]|Apache + PHP でのユーザー権限切り替えモジュール|
|[[JDK>FreeBSD/Java]]|Java 開発キット|
|[[Tomcat>FreeBSD/Tomcat]]|JSP/Servlet コンテナ|
|[[mod_jk2>FreeBSD/mod_jk2]]|Apache2 と Tomcat の連携|

*** 日本語化 [#n0f698ff]

|[[kon>FreeBSD/kon]]||
|[[ja-man-doc>FreeBSD]]||
|[[jless>FreeBSD/jless]]||
|[[jman>FreeBSD/jman]]||

*** ルータ化 [#dca2d99e]

|[[mpd>FreeBSD/mpd]]||
|[[ipfilter>FreeBSD/ipfilter]]||

**[[PostgreSQL]] [#z37ccb45]

 # cd /usr/ports/database/postgresql7
 # make
 # make install

外部から TCP/IP 接続を認めるため、
/usr/local/pgsql/data/pg_hba.conf を編集する。

 host    all         all         192.168.11.126    255.255.255.0     md5

TCP/IP 接続を有効にするため、
/usr/local/pgsql/data/postmaster.conf を編集する。

以下の行があるので

 #tcpip_socket = false

以下のように変更する。

 tcpip_socket = true

SSL で接続できるようにする場合

保留

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS