FreeBSDには「ports」という神機能があります。
packageと同じようなソフトウェアの簡単インストール機能なのですが、portsはその場でコンパイルしてくれるので、コンパイルオプションの指定が可能です。
他のアプリケーションとの関連付けも自動で処理してくれますし、まさに神です。
しかもportsは常に最新に保つことができるので、新しいバージョンやセキュリティ対策版などを速やかに入れることが可能です。
これまでその更新には「CVSup」というソフトウェアを使っていたのですが、これにはいくつかの問題がありました。
最近では「portsnap」という便利なソフトウェアが標準で入ることになったようなので、これを使ってみます。
「portsnap」についてはこちらのサイトが、応用例等もありとても参考になります。
http://wiki.fdiary.net/BSDmad/?portsnap
FreeBSD 6からは標準のソフトウェアになったのですが、それまでのバージョンではインストールが必要です。
インストールにはportsを使います。
$ su
# cd /usr/ports/sysutils/portsnap
# make install
最近のportsツリーでは「/usr/ports/ports-mgmt/」に入ってたりします。
設定ファイルは、FreeBSD 6以降では「/etc/」に、それ以前のportsで入れた場合には「/usr/local/etc/」に置けばいいようです。
ファイル名は「portsnap.conf」です。portsでインストールした場合は「portsnap.conf.sample」というファイル名で入っているようです。
ただ、会社で運用している5.5では「/etc/」に入れても設定ファイルを認識したので、どちらでもいいのかもしれません。
内容はこんな感じです。
# $FreeBSD: src/etc/portsnap.conf,v 1.1.2.3 2006/01/21 09:58:12 cperciva Exp $
# Default directory where compressed snapshots are stored.
# WORKDIR=/var/db/portsnap
# Default location of the ports tree (target for "update" and "extract").
# PORTSDIR=/usr/ports
# Server or server pool from which to fetch updates. You can change
# this to point at a specific server if you want, but in most cases
# using a "nearby" server won't provide a measurable improvement in
# performance.
SERVERNAME=portsnap.FreeBSD.org
# Trusted keyprint. Changing this is a Bad Idea unless you've received
# a PGP-signed email from telling you to
# change it and explaining why.
KEYPRINT=*************************************************************
# Example of ignoring parts of the ports tree. If you know that you
# absolutely will not need certain parts of the tree, this will save
# some bandwidth and disk space. See the manual page for more details.
#
# WARNING: Working with an incomplete ports tree is not supported and
# can cause problems due to missing dependencies. If you have REFUSE
# directives and experience problems, remove them and update your tree
# before asking for help on the mailing lists.
#
# REFUSE arabic chinese french german hebrew hungarian japanese
# REFUSE korean polish portuguese russian ukrainian vietnamese
KEYPRINTの設定は念のため伏せています。
「REFUSE」の設定で、更新しないカテゴリを設定できるようですが、ports DBの更新でしくじったりするみたいなので、私は全部入れるようにしています。無駄な気もするんですけどね。
で、実際に使うには、下記のようにします。
# portsnap fetch && portsnap extract && portsnap update
すでに/usr/ports/下にファイルを置いている場合は一度クリアされてしまうので要注意です。
二回目の場合は、下記だけで大丈夫です。
# portsnap fetch && portsnap update
まあ、portsnapだけしても時間がかかるだけで何もありませんが(^^;
portupgradeなどと併せて使うと効果大です。
コメントする