<?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>ひろぽっぽれす &#187; CentOS</title>
	<atom:link href="http://hiropo.co.uk/archives/category/centos/feed" rel="self" type="application/rss+xml" />
	<link>http://hiropo.co.uk</link>
	<description>Web系エンジニアの適当なブログです。どうでも酔いものばかり作ってます。</description>
	<lastBuildDate>Sun, 25 Jul 2010 17:09:15 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>CentOS5.xにPostgresqlをyumでインストールする</title>
		<link>http://hiropo.co.uk/archives/487</link>
		<comments>http://hiropo.co.uk/archives/487#comments</comments>
		<pubDate>Tue, 06 Jul 2010 13:57:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PostgreSQL]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=487</guid>
		<description><![CDATA[MySQLしか使ったことないのですが、案件でPostgresqlを使うことになりまして、CentOS5系にインストールしてみました。 クライアント認証につまづいてなかなか壁を突破できませんでしたがググって頑張りましたよっと。 まず、yumで必要なモジュールをインストール。 PLAIN TEXT CODE: &#91;root@localhost ~&#93;# yum install -y postgresql-tcl postgresql-server postgresql-contrib postgresql php-pgsql 今回はPHPとの連動を行うので、下記もインストール PLAIN TEXT CODE: &#91;root@localhost ~&#93;# yum install -y php-pgsql ひととおりインストールが終わったらpostgresqlを起動。 PLAIN TEXT CODE: &#91;root@localhost ~&#93;# /etc/rc.d/init.d/postgresql start それでは初期設定を行っていく。 MySQLと違って、postgresというユーザーでログインしないと設定が行えない。 PLAIN TEXT CODE: &#91;root@localhost ~&#93;# su - postgres -bash-3.2$ psql -l &#160; &#160; &#160; &#160; List of databases &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>MySQLしか使ったことないのですが、案件でPostgresqlを使うことになりまして、CentOS5系にインストールしてみました。<br />
クライアント認証につまづいてなかなか壁を突破できませんでしたがググって頑張りましたよっと。</p>
<p>まず、yumで必要なモジュールをインストール。</p>
<div class="igBar"><span id="lcode-11"><a href="#" onclick="javascript:showCodeTxt('code-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-11">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># yum install -y postgresql-tcl postgresql-server postgresql-contrib postgresql php-pgsql </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>今回はPHPとの連動を行うので、下記もインストール</p>
<div class="igBar"><span id="lcode-12"><a href="#" onclick="javascript:showCodeTxt('code-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-12">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># yum install -y php-pgsql </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>ひととおりインストールが終わったらpostgresqlを起動。</p>
<div class="igBar"><span id="lcode-13"><a href="#" onclick="javascript:showCodeTxt('code-13'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-13">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># /etc/rc.<span style="">d</span>/init.<span style="">d</span>/postgresql start </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>それでは初期設定を行っていく。<br />
MySQLと違って、postgresというユーザーでログインしないと設定が行えない。</p>
<div class="igBar"><span id="lcode-14"><a href="#" onclick="javascript:showCodeTxt('code-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-14">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># su - postgres</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-bash-<span style="color:#800000;color:#800000;">3</span>.<span style="color:#800000;color:#800000;">2</span>$ psql -l</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; List of databases</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;Name&nbsp; &nbsp; |&nbsp; Owner&nbsp; &nbsp;| Encoding</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-----------+----------+----------</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;postgres&nbsp; | postgres | UTF8</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;template0 | postgres | UTF8</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;template1 | postgres | UTF8</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">3</span> rows<span style="color:#006600; font-weight:bold;">&#41;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>ユーザー名"test"、パスワード"test" のユーザーを作成する。<br />
権限はデータベースの作成を可能にする。</p>
<div class="igBar"><span id="lcode-15"><a href="#" onclick="javascript:showCodeTxt('code-15'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-15">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-bash-<span style="color:#800000;color:#800000;">3</span>.<span style="color:#800000;color:#800000;">2</span>$ psql</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Welcome to psql <span style="color:#800000;color:#800000;">8</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">21</span>, the PostgreSQL interactive terminal.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">Type</span>:&nbsp; \copyright for distribution terms</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;\h for help with SQL commands</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;\? for help with psql commands</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;\g or terminate with semicolon to execute query</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;\q to quit</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">postgres=# CREATE USER <span style="color:#CC0000;">"test"</span> CREATEDB PASSWORD <span style="color:#CC0000;">'test'</span> LOGIN;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CREATE ROLE</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">postgres=# \q</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-bash-<span style="color:#800000;color:#800000;">3</span>.<span style="color:#800000;color:#800000;">2</span>$ exit</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">logout</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>これで、Linux上のユーザー"test"からPostgresqlを操作できるようになる。<br />
そしたら、"test"ユーザーが使えるデータベース"test"を作成する。<br />
文字コードは"EUC_JP"にする。</p>
<div class="igBar"><span id="lcode-16"><a href="#" onclick="javascript:showCodeTxt('code-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-16">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># su - test</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>test@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># createdb test -E EUC_JP</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CREATE DATABASE</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>test@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span>$ psql -l</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; List of databases</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;Name&nbsp; &nbsp; |&nbsp; Owner&nbsp; &nbsp;| Encoding</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-----------+----------+----------</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;test&nbsp; &nbsp; &nbsp; | test&nbsp; &nbsp; &nbsp;| EUC_JP</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;postgres&nbsp; | postgres | UTF8</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;template0 | postgres | UTF8</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;template1 | postgres | UTF8</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">4</span> rows<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>test@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span>$ </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>ちなみにただ単に "creatdb test" とした場合、文字コードはデフォルトで"utf-8"になる。<br />
データベースを削除する場合は、"drop データベース名" とすれば良い。</p>
<p>最後に、PHPなどと連携する場合は、クライアント認証ファイルを編集する必要がある。</p>
<div class="igBar"><span id="lcode-17"><a href="#" onclick="javascript:showCodeTxt('code-17'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-17">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># vi /var/lib/pgsql/data/pg_hba.<span style="">conf</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#local&nbsp; all&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;all&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ident sameuser&nbsp; #コメントアウト</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">local&nbsp; &nbsp;all&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;all&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;trust</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#host&nbsp; &nbsp;all&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;all&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">127</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span>/<span style="color:#800000;color:#800000;">32</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ident sameuser&nbsp; #コメントアウト</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">host&nbsp; &nbsp; all&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;all&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#800000;color:#800000;">127</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">1</span>/<span style="color:#800000;color:#800000;">32</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; password </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>postgresqlとapacheを再起動する。</p>
<div class="igBar"><span id="lcode-18"><a href="#" onclick="javascript:showCodeTxt('code-18'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-18">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># /etc/rc.<span style="">d</span>/init.<span style="">d</span>/postgresql restart</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Stopping postgresql service:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#91;</span>&nbsp; OK&nbsp; <span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Starting postgresql service:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color:#006600; font-weight:bold;">&#91;</span>&nbsp; OK&nbsp; <span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@localhost ~<span style="color:#006600; font-weight:bold;">&#93;</span># /etc/rc.<span style="">d</span>/init.<span style="">d</span>/httpd restart</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Stopping httpd:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span>&nbsp; OK&nbsp; <span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Starting httpd:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#91;</span>&nbsp; OK&nbsp; <span style="color:#006600; font-weight:bold;">&#93;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>phpファイルを書いて、接続テストする。</p>
<div class="igBar"><span id="lphp-19"><a href="#" onclick="javascript:showCodeTxt('php-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-19">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$data</span> = <span style="color:#FF0000;">"host=localhost user=test dbname=test password=test"</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$pg</span> = <a href="http://www.php.net/pg_connect"><span style="color:#000066;">pg_connect</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span>!<span style="color:#0000FF;">$pg</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'接続できませんでした。'</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'接続しちゃいました&lt;br /&gt;'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span><span style="color:#006600; font-weight:bold;">&#40;</span>!<a href="http://www.php.net/pg_close"><span style="color:#000066;">pg_close</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$pg</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">else</span><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">'接続を閉じました。'</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>特に問題なく接続できたら下記のように表示される。</p>
<div class="igBar"><span id="lcode-20"><a href="#" onclick="javascript:showCodeTxt('code-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-20">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">接続しちゃいました</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">接続を閉じました。 </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>クライアント認証んとこは本当にわかんなくてつまづいたけど、ちゃんと繋がると感動ですね！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/487/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Value too large for defined data type &#8211; Tripwire</title>
		<link>http://hiropo.co.uk/archives/447</link>
		<comments>http://hiropo.co.uk/archives/447#comments</comments>
		<pubDate>Fri, 23 Apr 2010 01:55:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tripwire]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=447</guid>
		<description><![CDATA[あるサーバを管理しているのだが、Tripwire で、下記のようなエラーが出ていた。 PLAIN TEXT CODE: 1.&#160; &#160;File system error. &#160; &#160; &#160;Filename: /var/lib/xen/images/CentOS5.img &#160; &#160; &#160;Value too large for defined data type ファイルサイズがでかすぎるんだよ！って怒られた。 ググってみたら、ファイルサイズが 2G を越えているのが原因らしい。 UNIX では「2G の壁」というものが存在しているようで、これは lseek() など、ファイル内の読み出し位置を移動する関数に与えるオフセット値が伝統的に signed long であるためらしい（もうよくわからん）。 signed long では 2147483647 、要するに 2G バイトまでしか表現できないので、これを越えると単に fseek()に渡せないだけでなく、 内部の位置計算処理に多大な混乱が起こる（ということらしい）。ちなみに相対位置指定のために負の値も必要（だそうです）。 いろいろとめんどくさいのねー。もう1TBとかが当たり前の時代ですのに。 さて、解決方法である。 Tripwireのファイルチェックをスキップしてしまえばよいのである。 PLAIN TEXT CODE: #ポリシーファイル（テキスト版）の復元 &#91;root@host ~&#93;# twadmin -m p [...]]]></description>
			<content:encoded><![CDATA[<p>あるサーバを管理しているのだが、Tripwire で、下記のようなエラーが出ていた。</p>
<div class="igBar"><span id="lcode-23"><a href="#" onclick="javascript:showCodeTxt('code-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-23">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#800000;color:#800000;">1</span>.&nbsp; &nbsp;<span style="">File</span> system error.</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;<span style="">Filename</span>: /var/lib/xen/images/CentOS5.<span style="">img</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;Value too large for defined data type </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>ファイルサイズがでかすぎるんだよ！って怒られた。</p>
<p>ググってみたら、ファイルサイズが 2G を越えているのが原因らしい。 UNIX では「2G の壁」というものが存在しているようで、これは lseek() など、ファイル内の読み出し位置を移動する関数に与えるオフセット値が伝統的に signed long であるためらしい（もうよくわからん）。<br />
signed long では 2147483647 、要するに 2G バイトまでしか表現できないので、これを越えると単に fseek()に渡せないだけでなく、 内部の位置計算処理に多大な混乱が起こる（ということらしい）。ちなみに相対位置指定のために負の値も必要（だそうです）。</p>
<p>いろいろとめんどくさいのねー。もう1TBとかが当たり前の時代ですのに。</p>
<p>さて、解決方法である。<br />
Tripwireのファイルチェックをスキップしてしまえばよいのである。</p>
<div class="igBar"><span id="lcode-24"><a href="#" onclick="javascript:showCodeTxt('code-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-24">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#ポリシーファイル（テキスト版）の復元</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># twadmin -m p -c /etc/tripwire/tw.<span style="">cfg</span> -p /etc/tripwire/tw.<span style="">pol</span> -S /etc/tripwire/site.<span style="">key</span>&gt; /etc/tripwire/twpol.<span style="">txt</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># vi /etc/tripwire/twpol.<span style="">txt</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; ################################################</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ##</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">################################################ #</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # #</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; Monitor Filesystems&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# #</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ##</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">################################################</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; rulename = <span style="color:#CC0000;">"Monitor Filesystems"</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; /&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&gt; $<span style="color:#006600; font-weight:bold;">&#40;</span>ReadOnly<span style="color:#006600; font-weight:bold;">&#41;</span> ;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; /home&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-&gt; $<span style="color:#006600; font-weight:bold;">&#40;</span>ReadOnly<span style="color:#006600; font-weight:bold;">&#41;</span> ;&nbsp; # Modify as needed</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; /usr&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt; $<span style="color:#006600; font-weight:bold;">&#40;</span>ReadOnly<span style="color:#006600; font-weight:bold;">&#41;</span> ;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; /var&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt; $<span style="color:#006600; font-weight:bold;">&#40;</span>ReadOnly<span style="color:#006600; font-weight:bold;">&#41;</span> ;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; !/var/lib/xen/images;&nbsp; &nbsp;#&lt;- 追加</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#ポリシーファイル（暗号署名版）を作成</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># twadmin -m P -c /etc/tripwire/tw.<span style="">cfg</span> -p /etc/tripwire/tw.<span style="">pol</span> -S /etc/tripwire/site.<span style="">key</span> /etc/tripwire/twpol.<span style="">txt</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Please enter your site passphrase:&nbsp; &nbsp; &nbsp;#&lt;- サイトパスフレーズ応答</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#ポリシーファイル（テキスト版）削除</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># rm -f /etc/tripwire/twpol.<span style="">txt</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#データベース初期化</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># tripwire -m i -s -c /etc/tripwire/tw.<span style="">cfg</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">Please enter your local passphrase:&nbsp; &nbsp; &nbsp;#&lt;- ローカルパスフレーズ応答 </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>他にも動画ファイルを保存していたりなどで2GB超えてしまうファイル群を格納しているディレクトリがあったら、そこを登録しておいても良いと思う。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/447/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>メールaliases</title>
		<link>http://hiropo.co.uk/archives/159</link>
		<comments>http://hiropo.co.uk/archives/159#comments</comments>
		<pubDate>Sun, 21 Jun 2009 10:11:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[FedoraCore]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[aliases]]></category>
		<category><![CDATA[sendmail]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=159</guid>
		<description><![CDATA[ひとつのメールアドレスにくるメールをふたつのメールアドレスに転送することでバックアップ的なことをしたいと思う。 どうやらaliasesで簡単にできるようです。 aaa@localhost にくるメールを aaa@localhost と、bbb@etc.com に転送する。 PLAIN TEXT CODE: #vi /etc/aliases aaa: aaa,bbb@etc.com これだけでOKなのです。 aliasesって便利！]]></description>
			<content:encoded><![CDATA[<p>ひとつのメールアドレスにくるメールをふたつのメールアドレスに転送することでバックアップ的なことをしたいと思う。<br />
どうやらaliasesで簡単にできるようです。</p>
<p>aaa@localhost にくるメールを aaa@localhost と、bbb@etc.com に転送する。</p>
<div class="igBar"><span id="lcode-26"><a href="#" onclick="javascript:showCodeTxt('code-26'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-26">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#vi /etc/aliases</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">aaa: aaa,bbb@etc.<span style="">com</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>これだけでOKなのです。<br />
aliasesって便利！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/159/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ntfsをmountする &#8211; CentOS</title>
		<link>http://hiropo.co.uk/archives/144</link>
		<comments>http://hiropo.co.uk/archives/144#comments</comments>
		<pubDate>Tue, 19 May 2009 15:27:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mount]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/archives/144</guid>
		<description><![CDATA[最近まったくブログを更新していなかったので、まめに更新してメモやライブラリを残していこうと思う今日この頃。 メモるくせをつけないとすぐ忘れちゃうからちゃんとメモらないとまずいよね。 さて、CentOSでntfsをmountする手順をまとめておく。 ウチにあまっていた2.5インチHDDたちを稼動してる自宅のサーバに接続してファイルサーバにしてしまおうと思ったからだ。 今まではUSB接続でwindowsマシンにつなげていたが、USBポートがいくらあっても足らんし、サーバ機に繋げてしまえば、いつでもどこでも（家の中なら）アクセスできるし便利だろうと。 まず、下記コマンドを打ってみる。 PLAIN TEXT CODE: &#91;root@host ~&#93;# mount -t ntfs /dev/sdb1 /mnt/sdb1 mount: マウントポイント /mnt/sdb1 が存在しません そこで、マウントポイントを作成して、マウントを再試行する。 PLAIN TEXT CODE: &#91;root@host ~&#93;# mkdir /mnt/o &#91;root@host ~&#93;# mount /dev/sdb1 /mnt/o/ mount: unknown filesystem type 'ntfs' 'ntfs'なんぞ知らんとのこと。 調べてみたら、'mount -t ntfs-3g' というコマンドでマウントするらしい。 そこで、ntfs-3gをインストールする。 PLAIN TEXT CODE: &#91;root@host ~&#93;# yum install ntfs-3g インストールが終わったところ、再マウント。 PLAIN TEXT [...]]]></description>
			<content:encoded><![CDATA[<p>最近まったくブログを更新していなかったので、まめに更新してメモやライブラリを残していこうと思う今日この頃。<br />
メモるくせをつけないとすぐ忘れちゃうからちゃんとメモらないとまずいよね。</p>
<p>さて、CentOSでntfsをmountする手順をまとめておく。<br />
ウチにあまっていた2.5インチHDDたちを稼動してる自宅のサーバに接続してファイルサーバにしてしまおうと思ったからだ。<br />
今まではUSB接続でwindowsマシンにつなげていたが、USBポートがいくらあっても足らんし、サーバ機に繋げてしまえば、いつでもどこでも（家の中なら）アクセスできるし便利だろうと。</p>
<p>まず、下記コマンドを打ってみる。</p>
<div class="igBar"><span id="lcode-35"><a href="#" onclick="javascript:showCodeTxt('code-35'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-35">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># mount -t ntfs /dev/sdb1 /mnt/sdb1</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mount: マウントポイント /mnt/sdb1 が存在しません </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>そこで、マウントポイントを作成して、マウントを再試行する。</p>
<div class="igBar"><span id="lcode-36"><a href="#" onclick="javascript:showCodeTxt('code-36'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-36">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># mkdir /mnt/o</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># mount /dev/sdb1 /mnt/o/</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">mount: unknown filesystem type <span style="color:#CC0000;">'ntfs'</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>'ntfs'なんぞ知らんとのこと。<br />
調べてみたら、'mount -t ntfs-3g' というコマンドでマウントするらしい。<br />
そこで、ntfs-3gをインストールする。</p>
<div class="igBar"><span id="lcode-37"><a href="#" onclick="javascript:showCodeTxt('code-37'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-37">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># yum install ntfs-3g </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>インストールが終わったところ、再マウント。</p>
<div class="igBar"><span id="lcode-38"><a href="#" onclick="javascript:showCodeTxt('code-38'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-38">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># mount -t ntfs-3g /dev/sdb1 /mnt/o</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FATAL: Module fuse not found.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">ntfs</span>-3g-mount: fuse device is missing, try <span style="color:#CC0000;">'modprobe fuse'</span> as root </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>'modprobe fuse'を試せとのことで、試してみる。</p>
<div class="igBar"><span id="lcode-39"><a href="#" onclick="javascript:showCodeTxt('code-39'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-39">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># modprobe fuse</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">FATAL: Module fuse not found. </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>'not found' って・・・。<br />
さらに調べると、'dkms-fuse'ってのをインストールしなくてはならないよう。</p>
<div class="igBar"><span id="lcode-40"><a href="#" onclick="javascript:showCodeTxt('code-40'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-40">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># yum --enablerepo=rpmforge install dkms-fuse </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>そして、'modprobe fuse' を実行して、マウントに再挑戦</p>
<div class="igBar"><span id="lcode-41"><a href="#" onclick="javascript:showCodeTxt('code-41'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-41">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># modprobe fuse</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># mount -t ntfs-3g /dev/sdb1 /mnt/o/ </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>エラーが返ってこないので成功か？確認してみる。</p>
<div class="igBar"><span id="lcode-42"><a href="#" onclick="javascript:showCodeTxt('code-42'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-42">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># ls /mnt/o/</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">System Volume Information&nbsp; evangelion&nbsp; music </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>マウントに成功！'evangelion' ってナニ？とか聞かないのっ。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/144/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS eth0 のネットワーク設定</title>
		<link>http://hiropo.co.uk/archives/122</link>
		<comments>http://hiropo.co.uk/archives/122#comments</comments>
		<pubDate>Sun, 28 Dec 2008 09:19:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=122</guid>
		<description><![CDATA[自部用メモ PLAIN TEXT CODE: &#91;root@host ~&#93;# cd /etc/sysconfig/network-scripts/ &#91;root@host network-scripts&#93;# vi ifcfg-eth0 DEVICE=eth0 BOOTPROTO=static BROADCAST=192.168.x.255 HWADDR=xx:xx:xx:xx:xx:xx #MACアドレス IPADDR=192.168.x.xxx #現在のホストのIPアドレスを指定 NETMASK=255.255.255.0 #IPアドレスに対応するサブネットマスク NETWORK=192.168.1.0 ONBOOT=yes]]></description>
			<content:encoded><![CDATA[<p>自部用メモ</p>
<div class="igBar"><span id="lcode-44"><a href="#" onclick="javascript:showCodeTxt('code-44'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-44">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host ~<span style="color:#006600; font-weight:bold;">&#93;</span># cd /etc/sysconfig/network-scripts/</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@host network-scripts<span style="color:#006600; font-weight:bold;">&#93;</span># vi ifcfg-eth0</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">DEVICE=eth0</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BOOTPROTO=static</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">BROADCAST=<span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="">x</span>.<span style="color:#800000;color:#800000;">255</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">HWADDR=xx:xx:xx:xx:xx:xx #MACアドレス</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">IPADDR=<span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="">x</span>.<span style="">xxx</span> #現在のホストのIPアドレスを指定</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">NETMASK=<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">255</span>.<span style="color:#800000;color:#800000;">0</span> #IPアドレスに対応するサブネットマスク</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">NETWORK=<span style="color:#800000;color:#800000;">192</span>.<span style="color:#800000;color:#800000;">168</span>.<span style="color:#800000;color:#800000;">1</span>.<span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ONBOOT=yes </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/122/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
