FreeBSD 9.0Rインストール後の初期設定
9-RELEASE用。
freebsd-update
とりあえず、システムがまっさらなうちにセキュリティパッチを当てておく。
# freebsd-update fetch # freebsd-update install # rehash # reboot
でもってcronに登録。
# vi /etc/crontab @daily root freebsd-update cron
UTF-8を使う
/etc/login.confの「# Russian Users 〜」の後ろに日本語設定を追加し、cap_mkdbする。
# vi /etc/login.conf japanese|Japanese Users Accounts:\ :charset=UTF-8:\ :lang=ja_JP.UTF-8:\ :tc=default: # cap_mkdb /etc/login.conf
ユーザー追加時にjapaneseクラスを使用するようにする。
# vi /etc/adduser.conf defaultclass=japanese
既存のユーザーのクラスを変更する場合。
# vipw Decomo:password:1001:1001::0:0:User &:/home/Decomo:/bin/sh →Decomo:password:1001:1001:japanese:0:0:User &:/home/Decomo:/bin/sh
データベース更新
# cap_mkdb /etc/login.conf
Ports
/etc/make.confの編集
CPUTYPE?=k8-sse3 CFLAGS= -O2 -fno-strict-aliasing -fomit-frame-pointer -pipe CXXFLAGS+= -fconserve-space COPTFLAGS= -O -fno-strict-aliasing -fomit-frame-pointer -pipe .if ${.CURDIR:M*/usr/ports*} FORCE_MAKE_JOBS=yes MAKE_JOBS_NUMBER=5 .endif
Portsツリーの更新
portsnapを使ってPortsツリーを更新する。
- 初回のみ
# portsnap fetch extract
- 2回目以降
# portsnap fetch update
- 定期更新する場合
# vi /etc/crontab 0 3 * * 6 root /usr/sbin/portsnap cron update # 毎週土曜日の3:00に更新
portupgradeのインストール
- インストール
# cd /usr/ports/ports-mgmt/portupgrade/ # make install clean # rehash
- INDEXの更新
# portsdb -Uu
BerklyDBを4.8で統一する
- インストール
# portinstall databases/db48
- /etc/make.confに設定を追加
WITH_BDB_VER=48
- 関連portsのアップグレード
# portupgrade -fr 'db4*' -x 'databases/db4*'
- db41を削除
pkg_deinstall db41
X.Org
巨大なソフトなのでmake config-recursive; make installで一気に行きたい所だが、オプションの関係でビルドエラーになった時に原因が分かり辛いので、普通にmake installするのが吉。
$ cd /usr/ports/x11/xorg # make install
俺的必須portsのインストール
- sudo
wheelユーザーで全てのコマンドを使えるようにする# cd /usr/ports/security/sudo # make install clean # visudo ## Uncomment to allow members of group wheel to execute any command %wheel ALL=(ALL) ALL
- shells/bash
$ chsh -s /usr/local/bin/bash
各種設定
SSHの設定
rootによるログインと空パスワードを禁止する。
# vi /etc/ssh/sshd_config PermitRootLogin no PermitEmptyPasswords no