<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.otsune.com/~d/styles/rss1full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.otsune.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:image="http://purl.org/rss/1.0/modules/image/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" xml:lang="ja">
	<channel rdf:about="http://www.otsune.com/bsd/index.rss">
		<title>otsune's FreeBSD memo</title>
		<link>http://www.otsune.com/bsd/</link>
		<description>FreeBSD Tips and Memo (Jail, ports, etc.) http://www.otsune.com/bsd/</description>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<admin:generatorAgent rdf:resource="http://www.blosxom.com/?v=2.0" />
		<admin:errorReportsTo rdf:resource="mailto:info@otsune.com" />
		<image rdf:resource="http://www.otsune.com/images/daemon_circle.png" />
		<items>
			<rdf:Seq>
				<rdf:li rdf:resource="http://www.otsune.com/bsd/ports/install_as_user.htm" />
				<rdf:li rdf:resource="http://www.otsune.com/bsd/tips/usercpaninstall.htm" />
				<rdf:li rdf:resource="http://www.otsune.com/bsd/jail/fulljail.htm" />
				<rdf:li rdf:resource="http://www.otsune.com/bsd/ports/bittorrent.htm" />
				<rdf:li rdf:resource="http://www.otsune.com/bsd/jail/minijail.htm" />
				<rdf:li rdf:resource="http://www.otsune.com/bsd/conf/make_conf.htm" />
				<rdf:li rdf:resource="http://www.otsune.com/bsd/tips/package_server.htm" />
				<rdf:li rdf:resource="http://www.otsune.com/bsd/tips/portindex.htm" />
				<rdf:li rdf:resource="http://www.otsune.com/bsd/ports/ccache_distcc.htm" />
			</rdf:Seq>
		</items>
	<cc:license xmlns:cc="http://web.resource.org/cc/" cc:license="http://creativecommons.org/licenses/by-nc-sa/2.0/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.otsune.com/otsune-bsd" type="application/rss+xml" /><feedburner:browserFriendly>This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site.</feedburner:browserFriendly></channel>
	<item rdf:about="http://www.otsune.com/bsd/ports/install_as_user.htm">
		<title>ユーザー領域にFreeBSD portsをインストールする方法</title>
		<link>http://www.otsune.com/bsd/ports/install_as_user.htm</link>
		
		<dc:subject>ports</dc:subject>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<dc:date>2007-11-02T09:19+09:00</dc:date>
		<content:encoded><![CDATA[last update $Date: 2007/11/02 22:00:15 $portsとは？さまざまなソフトウェアをFreeBSDで管理するためのシステムです。ソースコードのコンパイルやインストールの手順が書かれたMakefileをもとに、バージョン更新やアンインストールなどを簡単に実行する事が出来ます。ユーザー領域にインストールする理由FreeBSDのportsは、root権限を持ったサーバー管理者が扱う事を前提として設計されているようです。大抵のroot権限を持たないユーザーは、使用したいソフトウェアがあった場合はportsを使用せずにソースコードからビルドして、手作業でインストールしたり更新管理をしています。また、システム管理者にportsを使ったインストールを要求して作業してもらう事も有ります。このドキュメントではユーザーがユーザー領域（以下ローカルパス）にソフトウェアをインストールする際に、便利なportsを使ってインストールをする方法を紹介します。（ports管理ツールを使う事で更新管理も出来ると思います）ユーザー領域で使用しても無意味なソフトウェア例えばsysutilsなど実行するのにroot権限が必要なカーネルやシステムを扱うソフトウェアは、ユーザー権限では使用出来ないのでportsを使う意味が無いでしょう。ネットワークデーモンとなるサービス等は実行ユーザーの設定をする必要があるでしょう。インストール前の準備home以下の~/usr/ports/と~/usr/localを使用します。あらかじめディレクトリを用意します。% mkdir -p ~/usr/local% cd ~/usr/local% mkdir -p etc lib tmp/dist tmp/work...<br/>
<br/>
[[ This is a content summary only. Visit MyWebsite.com for full links, other content, and more! ]]]]></content:encoded>
		<trackback:ping rdf:resource="http://www.otsune.com/bsd/ports/install_as_user.trackback" />
	</item>
	<item rdf:about="http://www.otsune.com/bsd/tips/usercpaninstall.htm">
		<title>ユーザー領域にCPANをインストールする方法</title>
		<link>http://www.otsune.com/bsd/tips/usercpaninstall.htm</link>
		
		<dc:subject>tips</dc:subject>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<dc:date>2006-08-16T08:19+09:00</dc:date>
		<content:encoded><![CDATA[Last updated $Date: 2008/02/22 14:47:41 $CPANとは？CPANはComprehensive Perl Archive Networkの略で、Perlのさまざまなモジュールを簡単にインストールできるシステムです。lang/perl5.8がインストールされていればcpanコマンドで使用出来ます。またperl -MCPAN -e shellでも実行できます。ユーザー領域にインストールする理由サーバー管理者であればroot権限を持っているので、p5-から始まるportsを使用してモジュールをインストールすれば通常はOkです。ここではroot権限を持たない一般ユーザーが、自分の自由になるホームディレクトリへCPANモジュールをインストールして使う方法を解説します。Perlそのものはシステムにインストールされたものを使用することを想定しています。インストールはユーザーディレクトリの~/local以下を使うことを前提にして説明します。インストール前の準備あらかじめ~/localを作成しておきます。&#036; mkdir -p ~/localcpanの初期設定ファイルを作ります。&#036; echo no | cpan設定ファイルの~/.cpan/CPAN/MyConfig.pmの該当部分を書き換えます。（mbuildpl_argの項目は存在しないので、追記してください）'make_install_arg' =&gt; qq[SITEPREFIX=&#036;ENV{HOME}/local],'makepl_arg' =&gt; qq[INSTALLDIRS=site INSTALL_BASE=&#036;ENV{HOME}/local LIB=&#036;ENV{HOME}/local/lib/perl5...<br/>
<br/>
[[ This is a content summary only. Visit MyWebsite.com for full links, other content, and more! ]]]]></content:encoded>
		<trackback:ping rdf:resource="http://www.otsune.com/bsd/tips/usercpaninstall.trackback" />
	</item>
	<item rdf:about="http://www.otsune.com/bsd/jail/fulljail.htm">
		<title>jailの作り方</title>
		<link>http://www.otsune.com/bsd/jail/fulljail.htm</link>
		
		<dc:subject>jail</dc:subject>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<dc:date>2005-05-24T17:13+09:00</dc:date>
		<content:encoded><![CDATA[Last updated $Date: 2007/05/21 21:15:49 $この記事についてこの記事はFreeBSD Expert 2005に掲載された記事です。掲載時に修正されたのでまったく同一の内容ではありません。またこのサイトで公開するにあたってWeb用に修正しています。おかしな記述がありましたらコメント等で指摘してくれると幸いです。jailとはjailとは「仮想FreeBSDマシン」を実現する機能です。FreeBSDマシン内に、もう一つのFreeBSD環境を作ることができます。FreeBSDを含めたUNIX系OSには、古くからchrootというコマンドが存在します。chrootコマンドを使用することでルートディレクトリを変更してコマンドを実行することができます。コマンドを任意のディレクトリの下に閉じ込めてファイルシステムのアクセスに制約をかけることができます。chrootから実行されたコマンドは、指定されたルートディレクトリよりも上の階層へアクセスすることが出来ない状態で起動します。jailはchrootの機能を拡張して、ネットワーク・プロセス等も隔離できるようにしたFreeBSD特有の仕組みです。LinuxのUser Mode Linux(UML)のような仮想OSや、VMwareなどの仮想マシンに似たシステムです。ただし、それらの仮想OS技術とは違い、プロセス自体はホストマシン（以下、host環境）のカーネルによって動作しています。そのため仮想マシンとして動作するOSはFreeBSDに限定されます。この記事では仮想FreeBSDマシンのことを分かりやすくするため「jail環境」と表現しています。構築例 IPアドレス ホスト名 FQDN root directoryhost環境 192.168.1.1 host host.example.jp /jail環境...<br/>
<br/>
[[ This is a content summary only. Visit MyWebsite.com for full links, other content, and more! ]]]]></content:encoded>
		<trackback:ping rdf:resource="http://www.otsune.com/bsd/jail/fulljail.trackback" />
	</item>
	<item rdf:about="http://www.otsune.com/bsd/ports/bittorrent.htm">
		<title>BitTorrentを使ってFreeBSDのISOイメージファイルをダウンロードする</title>
		<link>http://www.otsune.com/bsd/ports/bittorrent.htm</link>
		
		<dc:subject>ports</dc:subject>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<dc:date>2004-12-03T02:37+09:00</dc:date>
		<content:encoded><![CDATA[BitTorrentとは？BitTorrentはファイルを転送するプロトコルです。ダウンロードを分散することで一つのサーバーにアクセスが集中しないように設計されています。FreeBSD 5.4RのISOイメージをBitTorrentで配布する実験が行われているようです。http://people.freebsd.org/~kensmith/5.4-torrent/FreeBSD 6.0RのISOイメージ用torrentファイルは各ftpサーバーのtorrents以下にミラーされています。ftp://ftp.jp.freebsd.org/pub/FreeBSD/torrents/外から接続できるようにport 6881を開放するBitTorrentはダウンロードをしているホストが同時に他のホストへのアップロードを行います。6881-6889までのポートのうちどれかを外部から接続できるようにしておきましょう。net/ctorrentコンソールで動作するクライアントとしてnet/ctorrentがオススメです。Home of CTorrent, the linux console torrent clientが公式サイトです。# cd /usr/ports/net/ctorrent# make install cleannet/py-bittorrent-corePythonで書かれたBitTorrentクライアントです。WITHOUT_GUIでビルドされるmeta portsなのでコンソールで動作します。# cd /usr/ports/net/py-bittorrent-core# make install...<br/>
<br/>
[[ This is a content summary only. Visit MyWebsite.com for full links, other content, and more! ]]]]></content:encoded>
		<trackback:ping rdf:resource="http://www.otsune.com/bsd/ports/bittorrent.trackback" />
	</item>
	<item rdf:about="http://www.otsune.com/bsd/jail/minijail.htm">
		<title>﻿thin jailの作り方</title>
		<link>http://www.otsune.com/bsd/jail/minijail.htm</link>
		
		<dc:subject>jail</dc:subject>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<dc:date>2004-11-30T19:45+09:00</dc:date>
		<content:encoded><![CDATA[thin jailとは？thin jailは俗にミニツリーjailとも呼ばれています。ミニツリーのjailは最低限のファイルだけを使ってApacheやBINDなど一つのソフトだけが動作するようにjail環境を構築することを指します。単機能の小型サーバーを追加したように運用できます。フルツリーの場合はmake installworldによって、システムの全てのコマンドをインストールしますが、ミニツリーの場合は必要最小限のディレクトリとコマンドだけをインストールします。例として「/usr/local/jail2」にwww/apache2が動作するミニツリーを構築する手順を説明します。textproc/expat2も依存関係で必要になります。ミニツリーの構築まずミニツリーのディレクトリを作ります。host# mkdir -p /usr/local/jail2ディレクトリの作成そしてBSD.minijail.distというmtreeファイルを作成します。そのファイルを指定してmtreeコマンドを実行してディレクトリを作成します。host# mtree -deU -f BSD.minijail.dist -p /usr/local/jail2BSD.minijail.dist/set type=dir uname=root gname=wheel mode=0755.    bin    ..    dev    ..    etc    ..    proc            mode=0555    ..    sbin    ..    tmp             mode=01777    ..    usr        bin        ..        include        ..        lib        ..       ...<br/>
<br/>
[[ This is a content summary only. Visit MyWebsite.com for full links, other content, and more! ]]]]></content:encoded>
		<trackback:ping rdf:resource="http://www.otsune.com/bsd/jail/minijail.trackback" />
	</item>
	<item rdf:about="http://www.otsune.com/bsd/conf/make_conf.htm">
		<title>/etc/make.confの設定例</title>
		<link>http://www.otsune.com/bsd/conf/make_conf.htm</link>
		
		<dc:subject>conf</dc:subject>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<dc:date>2004-11-30T03:31+09:00</dc:date>
		<content:encoded><![CDATA[Last updated $Date: 2006/04/24 16:53:49 $/etc/make.confホスト固有の設定をするために/etc/make.confで環境変数を指定しましょう。デフォルト値は/usr/share/example/etc/defaults/make.confを参考にしてください。コンパイラの最適化の設定最適化レベルは特に指定しなくても大丈夫です。CFLAGSは/usr/share/mk/sys.mkで、COPTFLAGSは/usr/src/sys/conf/kern.pre.mkで適切に設定されます。過激に細かくオプションをつけるとビルド出来なかったり、OpenSSHが接続できなかったりします。また使用しているプロセッサの種類をdmesgで確認して、/usr/share/mk/bsd.cpu.mkを参考にCPUTYPEを設定します。/etc/make.confCPUTYPE=    pentium4#CFLAGS=    -O2 -fno-strict-aliasing -pipe#COPTFLAGS= -O2 -fno-strict-aliasing -pipecvsupの設定/usr/share/examples/cvsup/以下にサンプルファイルが入っていますので、それを/usr/sup/などにコピーします。# mkdir -p /usr/sup# cp -p /usr/share/examples/cvsup/*-supfile /usr/sup/# cp -p /usr/share/examples/cvsup/refuse...<br/>
<br/>
[[ This is a content summary only. Visit MyWebsite.com for full links, other content, and more! ]]]]></content:encoded>
		<trackback:ping rdf:resource="http://www.otsune.com/bsd/conf/make_conf.trackback" />
	</item>
	<item rdf:about="http://www.otsune.com/bsd/tips/package_server.htm">
		<title>packages &amp; distfilesサーバーの構築</title>
		<link>http://www.otsune.com/bsd/tips/package_server.htm</link>
		
		<dc:subject>tips</dc:subject>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<dc:date>2004-11-30T03:13+09:00</dc:date>
		<content:encoded><![CDATA[packagesサーバーとはportsを管理するときに、いちいちソースからコンパイルをするのは時間がかかります。そこでpackagesを代表ホスト1台で作成して、他のホストはそのpackagesをインストールすることにします。packagesサーバーにはCPUやHDDの速度が速いマシンを選択するのが良いでしょう。packagesディレクトリを用意するmkdir -p /usr/ports/packages/etc/make.confDEPENDS_TARGET=package FORCE_PACKAGE=yesp5-FreeBSD-Portindexportindex参照。net/cvsup-mirrorportsツリーの同期をするために多数のホストでcvsupを使用するのであれば、packagesサーバーをcvsupミラーサーバーとして設定することで外部へのトラフィックをへらすことが出来ます。あらかじめfastest_cvsup -c jpでホストから一番速いcvsupサーバーを探しておきます。次にcvsup-mirrorをインストールします。#portinstall net/cvsup-mirrorインストールの段階で対話的に設定していくことでcvsupサーバーが稼動します。/etc/crontabに更新スクリプトが追加されるので、rootのcrontab -eに設定を移動することにします。また普段の更新はupdate.sh -sで-sオプションをつけることで負荷を減らすことが出来ます。この例では8時と20時に-s付きで更新して、週に1度だけupdate.shをするように設定しています。crontab1   8,20    *   *   0-5 /usr/local/etc/cvsup/update.sh -s \&gt; /dev/null1   20  *  ...<br/>
<br/>
[[ This is a content summary only. Visit MyWebsite.com for full links, other content, and more! ]]]]></content:encoded>
		<trackback:ping rdf:resource="http://www.otsune.com/bsd/tips/package_server.trackback" />
	</item>
	<item rdf:about="http://www.otsune.com/bsd/tips/portindex.htm">
		<title>p5-FreeBSD-Portindexを使う</title>
		<link>http://www.otsune.com/bsd/tips/portindex.htm</link>
		
		<dc:subject>tips</dc:subject>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<dc:date>2004-11-29T13:03+09:00</dc:date>
		<content:encoded><![CDATA[portindexとは？portindexはportsdb -Uの代替コマンドです。以前はcd /usr/ports &amp;&amp; make index（/usr/ports/Tools/make_indexを実行しています）やportsdb -Uが/usr/ports/INDEXを生成するコマンドでした。ファイル生成の高速化のためにportindexが開発されたようです。なぜportindexを使うのか？portsの管理のためにsysutils/portupgradeを使用している人は多いと思います。portupgradeはportsの情報を認識するため、INDEXからINDEX.dbというデータベースを生成します。/usr/ports/INDEXというテキストファイルは、そのまま検索などの用途に使用するには非効率なためです。INDEXを生成するにはportsdb -Uというコマンドを使います。しかし、コマンドを実行するたびに毎回/usr/ports以下を全てスキャンするので、かなり時間がかかります。そこでcvsupでアップデートされたportsツリーだけを指定して、高速にデータベースを更新するportindexが作られました。使わなくても何とかなる？http://www.FreeBSD.org/ports/INDEX.bz2が24時間サイクルで更新されているそうです。通常は下記のように# cd /usr/ports# make fetchindexすれば問題は無いでしょう。/etc/make.confなどにMASTER_SITE_INDEXを設定することでwww.FreeBSD.org以外のホストを指定することも可能です。インストールportsからインストールします。# cd /usr/ports/sysutils/p5-FreeBSD-Portindex#...<br/>
<br/>
[[ This is a content summary only. Visit MyWebsite.com for full links, other content, and more! ]]]]></content:encoded>
		<trackback:ping rdf:resource="http://www.otsune.com/bsd/tips/portindex.trackback" />
	</item>
	<item rdf:about="http://www.otsune.com/bsd/ports/ccache_distcc.htm">
		<title>ccacheとdistccでビルドを高速に</title>
		<link>http://www.otsune.com/bsd/ports/ccache_distcc.htm</link>
		
		<dc:subject>ports</dc:subject>
		<dc:creator>Masafumi Otsune (mailto:info@otsune.com)</dc:creator>
		<dc:date>2004-11-29T06:57+09:00</dc:date>
		<content:encoded><![CDATA[Last updated $Date: 2006/07/03 06:49:13 $ccacheとdistccカーネル再構築の時や、開発中など同じソースコードを何度もビルドする事が良くあります。ccacheを使うとコンパイラのプリプロセスした結果を保存して、再利用することができます。distccを使うとネットワーク上の複数のホストでビルドを分担することができます。ccahceと同時に使用できます。（各ホストでコンパイラのバージョンをあわせておく必要があります）インストールportupgradeを使ってインストールする。普通にportsからmake installしても良い。# portinstall devel/ccache devel/distcccacheディレクトリの設定デフォルトでは${HOME}/.ccacheにキャッシュするので、余裕のあるディレクトリを指定する。ここでは/usr/local/var/.ccacheを使用する場合を説明する。# mkdir -p /usr/local/var/.ccacheディレクトリはCCACHE_DIR環境変数で指定する。CCACHE_DIR=/usr/local/var/.ccachedistccのホストを指定DISTCC_HOSTS環境変数でビルドを割り振るホストを指定します。名前解決できるホスト名かIPアドレスを列記しましょう。割り振り先のホストではdistccdをあらかじめ起動しておく必要があります。/etc/rc.confにdistccd_enable="YES"を設定しておきます。（最近のバージョンではssh経由での動作も出来るようです）CCACHE_PREFIXでdistccを指定することでccacheと同時に使用できます。環境変数の指定/etc/make.confに記入する。.if...<br/>
<br/>
[[ This is a content summary only. Visit MyWebsite.com for full links, other content, and more! ]]]]></content:encoded>
		<trackback:ping rdf:resource="http://www.otsune.com/bsd/ports/ccache_distcc.trackback" />
	</item>
<cc:License xmlns:cc="http://web.resource.org/cc/" rdf:about="http://creativecommons.org/licenses/by-nc-sa/2.0/"><cc:permits rdf:resource="http://web.resource.org/cc/Reproduction" /><cc:permits rdf:resource="http://web.resource.org/cc/Distribution" /><cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" /><cc:requires rdf:resource="http://web.resource.org/cc/Notice" /><cc:requires rdf:resource="http://web.resource.org/cc/Attribution" /><cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike" /><cc:prohibits rdf:resource="http://web.resource.org/cc/CommercialUse" /></cc:License><image rdf:about="http://www.otsune.com/images/daemon_circle.png"><url>http://www.otsune.com/images/daemon_circle.png</url><link>http://www.otsune.com/bsd/</link><title>otsune's FreeBSD memo</title></image></rdf:RDF>
