<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>func09 &#187; centos</title>
	<atom:link href="http://www.func09.com/wordpress/archives/tag/centos/feed" rel="self" type="application/rss+xml" />
	<link>http://www.func09.com/wordpress</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 06 Feb 2012 04:25:55 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>CentOSのxinetdでGitサーバを立てる</title>
		<link>http://www.func09.com/wordpress/archives/406</link>
		<comments>http://www.func09.com/wordpress/archives/406#comments</comments>
		<pubDate>Wed, 25 Feb 2009 11:45:55 +0000</pubDate>
		<dc:creator>haga</dc:creator>
				<category><![CDATA[centos]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[git]]></category>

		<guid isPermaLink="false">http://www.func09.com/wordpress/?p=406</guid>
		<description><![CDATA[Gitのレポジトリサーバをxinetdで立てる 昨日に引き続き、git-daemonです。 マニュアルを見ているとgit daemonはinetdで起動できるみたいなので、それならxinetdで立ててみるかなという気持ち [...]]]></description>
			<content:encoded><![CDATA[<h2>Gitのレポジトリサーバをxinetdで立てる</h2>

<p><a href="http://www.func09.com/wordpress/archives/402">昨日</a>に引き続き、git-daemonです。<br />
マニュアルを見ているとgit daemonはinetdで起動できるみたいなので、それならxinetdで立ててみるかなという気持ちになってきました。</p>

<p>git-daemon(1) Manual Page<br />
<a href="http://www.kernel.org/pub/software/scm/git/docs/everyday.html
">http://www.kernel.org/pub/software/scm/git/docs/everyday.html
</a></p>

<p><span id="more-406"></span></p>

<h2>xinetdをインストール</h2>

<p>うちの環境はCentOS5.2です。デフォルトでxinetdがインストールされていなかったので、まずインストールするところからスタート。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># rpm -q xinetd<br />
パッケージ xinetd はインストールされていません。<br />
# yum install xinetd<br />
<br />
Dependencies Resolved<br />
<br />
=============================================================================<br />
&nbsp;Package &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Arch &nbsp; &nbsp; &nbsp; Version &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Repository &nbsp; &nbsp; &nbsp; &nbsp;Size<br />
=============================================================================<br />
Installing:<br />
&nbsp;xinetd &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;x86_64 &nbsp; &nbsp; 2:2.3.14-10.el5 &nbsp;base &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;125 k<br />
<br />
Transaction Summary<br />
=============================================================================<br />
Install &nbsp; &nbsp; &nbsp;1 Package(s)<br />
Update &nbsp; &nbsp; &nbsp; 0 Package(s)<br />
Remove &nbsp; &nbsp; &nbsp; 0 Package(s)<br />
<br />
Total download size: 125 k<br />
Is this ok [y/N]: y</div></div>

<p>これでxintedはインストールされましたね。<br />
続いて、xintedの起動と、次回から自動起動するようにchkconfigをonにしておく。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># chkconfig xinetd on<br />
# /etc/init.d/xinetd start<br />
xinetd を起動中: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [ &nbsp;OK &nbsp;]</div></div>

<p>xinetdが起動しました。</p>

<h2>xinetdにgitを登録</h2>

<p>さてgit-daemonがxinetd経由で、gitのポートにリクエストがあった時、適宜起動してくれるよう設定します。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># cat /etc/services | grep git<br />
....<br />
git &nbsp; &nbsp; 9418/tcp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # git pack transfer service<br />
git &nbsp; &nbsp; 9418/udp&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # git pack transfer service</div></div>

<p>gitがインストールされている場合、/etc/servicesにはすでに登録されていると思います。<br />
続いて/etc/xinetd.d/にgit用の設定ファイルを設置します。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># touch /etc/xinetd.d/git-daemon</div></div>

<p>内容は以下のように</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># default: off<br />
# description: The git server offers access to git repositories<br />
service git<br />
{<br />
&nbsp; &nbsp; &nbsp; &nbsp; disable = no<br />
&nbsp; &nbsp; &nbsp; &nbsp; type &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= UNLISTED<br />
&nbsp; &nbsp; &nbsp; &nbsp; port &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 9418<br />
&nbsp; &nbsp; &nbsp; &nbsp; socket_type &nbsp; &nbsp; = stream<br />
&nbsp; &nbsp; &nbsp; &nbsp; wait &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= no<br />
&nbsp; &nbsp; &nbsp; &nbsp; user &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= nobody<br />
&nbsp; &nbsp; &nbsp; &nbsp; server &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= /usr/bin/git-daemon<br />
&nbsp; &nbsp; &nbsp; &nbsp; server_args &nbsp; &nbsp; = --inetd --export-all --base-path=/var/git --enable=receive-pack<br />
&nbsp; &nbsp; &nbsp; &nbsp; log_on_failure &nbsp;+= USERID<br />
}</div></div>

<p>以上で完了です。</p>

<h2>レポジトリの追加</h2>

<p>レポジトリの追加についても簡単にまとめておきます。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mkdir /tmp/hoge<br />
cd /tmp/hoge<br />
git init</div></div>

<p>適当なところでローカルのgitレポジトリを作成する</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">touch hoge.txt<br />
git add .<br />
git commit -m &quot;1st commit.&quot;</div></div>

<p>そのリポジトリになんでも良いので１発コミットをしておく。</p>

<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cd /var/git<br />
git clone --bare /tmp/hoge .hoge.git<br />
touch hoge.git/git-daemon-export-ok<br />
chown -R nobody:nobody hoge.git</div></div>

<p>公開用に設定してある/var/gitに移動し、公開用リポジトリ作成。 &#8211;bareオプションを忘れずに。<br />
ディレクトリのオーナーをnobodyにしておく（/etc/xinetd/git-daemonで設定したユーザー）</p>

<p>以上です。</p>

<p>&#8211;</p>

<h2>追記</h2>

<p>参考にしたのはここ</p>

<p>Everyday GIT With 20 Commands Or So<br />
<a href="http://www.kernel.org/pub/software/scm/git/docs/everyday.html">http://www.kernel.org/pub/software/scm/git/docs/everyday.html</a></p>

<p>さらに</p>

<p>gitosis &#8211; Git リポジトリ群の管理とアクセス制御 vol.0<br />
<a href="http://openbooth.org/archives/60.html">http://openbooth.org/archives/60.html</a></p>

<p>この辺を参考にしてもっと細やかな管理方法を会得したい。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.func09.com/wordpress/archives/406/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

