<?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; Linux</title>
	<atom:link href="http://hiropo.co.uk/archives/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://hiropo.co.uk</link>
	<description>Web系エンジニアの適当なブログです。どうでも酔いものばかり作ってます。</description>
	<lastBuildDate>Mon, 12 Mar 2012 06:10:01 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>【Linux】findとxargsとmvで検索したファイルを任意のフォルダに移動する</title>
		<link>http://hiropo.co.uk/archives/903</link>
		<comments>http://hiropo.co.uk/archives/903#comments</comments>
		<pubDate>Mon, 12 Mar 2012 02:28:52 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[find]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[xargs]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=903</guid>
		<description><![CDATA[findで検索した結果をそのままmv使って任意のディレクトリに移動したかったのでやってみた。 例えば、とあるフォルダを検索して、&#8221;/old/images/&#8221;内に移動する場合。 $ find ./  &#8230; <a href="http://hiropo.co.uk/archives/903">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>findで検索した結果をそのままmv使って任意のディレクトリに移動したかったのでやってみた。</p>
<p>例えば、とあるフォルダを検索して、&#8221;/old/images/&#8221;内に移動する場合。</p>
<pre>
$ find ./ -name "*.gif" | xargs -i mv {} ./old/images/
</pre>
<p>これでらくらく入っちゃう！</p>
<p>【追記】<br />
とある神様よりこれでは同じファイル名の画像があったら上書きされちゃうとのご指摘があったため、神様よりスクリプトをいただきました。</p>
<p>神様手抜き版(rsyncを使っちゃう。)</p>
<pre>
find ./ -path ./old/images -prune -o -type f -name '*.gif' | rsync --files-from=- -av . ./old/images/ &#038;&#038; find ./ -path ./old/images -prune -o -type f -name '*.gif' -exec rm -v {} \;
</pre>
<p>神様手抜かない版。</p>
<pre>
find ./ -path ./old/images -prune -o -type f -name '*.gif' | egrep '\.gif$' | xargs -i ksh -c 'a=`dirname {}`;mkdir -pv ./old/images/$a;mv -v {} ./old/images/{}'
</pre>
<p>さすが神様、脱帽です！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/903/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Webサイトをクロールするためのメモ。wgetとpavuk。</title>
		<link>http://hiropo.co.uk/archives/894</link>
		<comments>http://hiropo.co.uk/archives/894#comments</comments>
		<pubDate>Wed, 29 Feb 2012 09:45:02 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[pavuk]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=894</guid>
		<description><![CDATA[久しぶりの更新です。 Web制作の現場でWebサイトをまるまるクロールすることがあると思います。例えばサイトマップをつくらなくてはならないときなど。そこでWebサイトをすべて把握するために全ページを手動で見ていっては膨大 &#8230; <a href="http://hiropo.co.uk/archives/894">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>久しぶりの更新です。</p>
<p>Web制作の現場でWebサイトをまるまるクロールすることがあると思います。例えばサイトマップをつくらなくてはならないときなど。そこでWebサイトをすべて把握するために全ページを手動で見ていっては膨大な工数がかかりますしかなり大変です。（最終的には全ページ把握しなくてはいけないので見るんですけど。）</p>
<p>それを少しでもラクにするためにWebサイト全体をクロールするのに<a href="http://www.gnu.org/software/wget/" target="_blank">wget</a>や<a href="http://www.pavuk.org/" target="_blank">pavuk</a>といったツールがとても便利です！</p>
<p>例えばwgetのxオプションが便利です。<br />
xをつけるとドメインのディレクトリをつくり強制的にディレクトリ構造を保ったままファイルを取得してくれます。<br />
さらにベーシック認証(もしくはダイジェスト認証)がかかっている場合は下記オプションをつけることで取得できます。</p>
<pre>
wget -x --http-user=[ベーシック認証ID] --http-password=[ベーシック認証パスワード] http://yahoo.com/index.html
</pre>
<p>&#8220;http://yahoo.com/index.html&#8221; からつながる下層リンク含めてすべて取得したい場合は、pavuk使ったほうが便利です。<br />
オプションが豊富なのでwgetより便利かもしれません。</p>
<pre>
pavuk -base_level 1 \
 -auth_scheme Digest \
 -auth_name [id] \
 -auth_passwd [パスワード] \
 -lmax 5 \
 -progress \
 -force_reget \
 -adomain yahoo.com \
 -noRelocate \
 -all_to_local \
 -enable_js \
 -dont_leave_dir \
 -logfile log \
 -index_name index.html \

http://yahoo.com/index.html
</pre>
<p>実際&#8221;yahoo.com&#8221;にはベーシック認証(もしくはダイジェスト認証)ないですけど、上記のように指定すればベーシック認証(もしくはダイジェスト認証)を突破しつつすべてのページをクロールしてくれます。</p>
<p>▽wgetオプション</p>
<pre>
GNU Wget 1.11.4 Red Hat modified, 非対話的ネットワーク転送ソフト
使い方: wget [オプション]... [URL]...

長いオプションで不可欠な引数は短いオプションでも不可欠です。

スタートアップ:
  -V,  --version           バージョン情報を表示して終了する
  -h,  --help              このヘルプを表示する
  -b,  --background        スタート後にバックグラウンドに移行する
  -e,  --execute=COMMAND   `.wgetrc&#039;形式のコマンドを実行する

ログと入力ファイル:
  -o,  --output-file=FILE    ログを FILE に出力する
  -a,  --append-output=FILE  メッセージを FILE に追記する
  -d,  --debug               デバッグ情報を表示する
  -q,  --quiet               何も出力しない
  -v,  --verbose             冗長な出力をする (デフォルト)
  -nv, --no-verbose          冗長ではなくする
  -i,  --input-file=FILE     FILE の中に指定された URL をダウンロードする
  -F,  --force-html          入力ファイルを HTML として扱う
  -B,  --base=URL            相対 URL(-F -i 使用時) のベース URL を指定する

ダウンロード:
  -t,  --tries=NUMBER            リトライ回数の上限を指定 (0 は無制限).
       --retry-connrefused       接続を拒否されてもリトライする
  -O,  --output-document=FILE    FILE に文書を書きこむ
  -nc, --no-clobber              存在しているファイルをダウンロードで上書きしない
  -c,  --continue                部分的にダウンロードしたファイルの続きから始める
       --progress=TYPE           進行表示ゲージの種類を TYPE に指定する
  -N,  --timestamping            ローカルにあるファイルよりも新しいファイルだけ取得する
  -S,  --server-response         サーバの応答を表示する
       --spider                  何もダウンロードしない
  -T,  --timeout=SECONDS         全てのタイムアウトを SECONDS 秒に設定する
       --dns-timeout=SECS        DNS 問い合わせのタイムアウトを SECS 秒に設定する
       --connect-timeout=SECS    接続タイムアウトを SECS 秒に設定する
       --read-timeout=SECS       読み込みタイムアウトを SECS 秒に設定する
  -w,  --wait=SECONDS            ダウンロード毎に SECONDS 秒待つ
       --waitretry=SECONDS       リトライ毎に 1〜SECONDS 秒待つ
       --random-wait             ダウンロード毎に 0〜2*WAIT 秒待つ
       --no-proxy                プロクシを使わない
  -Q,  --quota=NUMBER            ダウンロードするバイト数の上限を指定する
       --bind-address=ADDRESS    ローカルアドレスとして ADDRESS (ホスト名か IP) を使う
       --limit-rate=RATE         ダウンロード速度を RATE に制限する
       --no-dns-cache            DNS の問い合わせ結果をキャッシュしない
       --restrict-file-names=OS  OS が許しているファイル名に制限する
       --ignore-case             ファイル名/ディレクトリ名の比較で大文字小文字を無視する
  -4,  --inet4-only              IPv4 だけを使う
  -6,  --inet6-only              IPv6 だけを使う
       --prefer-family=FAMILY    指定したファミリ(IPv6, IPv4, none)で最初に接続する
       --user=USER               ftp, http のユーザ名を指定する
       --password=PASS           ftp, http のパスワードを指定する

ディレクトリ:
  -nd, --no-directories           ディレクトリを作らない
  -x,  --force-directories        ディレクトリを強制的に作る
  -nH, --no-host-directories      ホスト名のディレクトリを作らない
       --protocol-directories     プロトコル名のディレクトリを作る
  -P,  --directory-prefix=PREFIX  ファイルを PREFIX/ 以下に保存する
       --cut-dirs=NUMBER          リモートディレクトリ名の NUMBER 階層分を無視する

HTTP オプション:
       --http-user=USER        http ユーザ名として USER を使う
       --http-password=PASS    http パスワードとして PASS を使う
       --no-cache              サーバがキャッシュしたデータを許可しない
  -E,  --html-extension        HTML 文書は `.html&#039; 拡張子で保存する
       --ignore-length         `Content-Length&#039; ヘッダを無視する
       --header=STRING         送信するヘッダに STRING を追加する
       --max-redirect          ページで許可する最大転送回数
       --proxy-user=USER       プロクシユーザ名として USER を使う
       --proxy-password=PASS   プロクシパスワードとして PASS を使う
       --referer=URL           Referer を URL に設定する
       --save-headers          HTTP のヘッダをファイルに保存する
  -U,  --user-agent=AGENT      User-Agent として Wget/VERSION ではなく AGENT を使う
       --no-http-keep-alive    HTTP の keep-alive (持続的接続) 機能を使わない
       --no-cookies            クッキーを使わない
       --load-cookies FILE     load cookies from FILE before session.
       --save-cookies FILE     save cookies to FILE after session.
       --keep-session-cookies  セッションだけで用いるクッキーを保持する
       --post-data=STRING      POST メソッドを用いて STRING を送信する
       --post-file=FILE        POST メソッドを用いて FILE の中味を送信する
       --content-disposition   Content-Disposition ヘッダがあれば
                               ローカルのファイル名として用いる (実験的)
       --auth-no-challenge     サーバからのチャレンジを待たずに、
                               Basic認証の情報を送信します。

HTTPS (SSL/TLS) オプション:
       --secure-protocol=PR     セキュアプロトコルを選択する (auto, SSLv2, SSLv3, TLSv1)
       --no-check-certificate   サーバ証明書を検証しない
       --certificate=FILE       クライアント証明書として FILE を使う
       --certificate-type=TYPE  クライアント証明書の種類を TYPE (PEM, DER) に設定する
       --private-key=FILE       秘密鍵として FILE を使う
       --private-key-type=TYPE  秘密鍵の種類を TYPE (PEM, DER) に設定する
       --ca-certificate=FILE    CA 証明書として FILE を使う
       --ca-directory=DIR       CA のハッシュリストが保持されているディレクトリを指定する
       --random-file=FILE       SSL PRNG の初期化データに使うファイルを指定する
       --egd-file=FILE          EGD ソケットとして FILE を使う

FTP オプション:
       --ftp-user=USER         ftp ユーザとして USER を使う
       --ftp-password=PASS     ftp パスワードとして PASS を使う
       --no-remove-listing     `.listing&#039; ファイルを削除しない
       --no-glob               FTP ファイル名のグロブを無効にする
       --no-passive-ftp        &quot;passive&quot; 転送モードを使わない
       --retr-symlinks         再帰取得中に、シンボリックリンクでリンクされた先のファイルを取得する
       --preserve-permissions  リモートファイルのパーミッションを保存する

再帰ダウンロード:
  -r,  --recursive          再帰ダウンロードを行う
  -l,  --level=NUMBER       再帰時の階層の最大の深さを NUMBER に設定する (0 で無制限)
       --delete-after       ダウンロード終了後、ダウンロードしたファイルを削除する
  -k,  --convert-links      HTML 中のリンクをローカルを指すように変更する
  -K,  --backup-converted   リンク変換前のファイルを .orig として保存する
  -m,  --mirror             -N -r -l 0 --no-remove-listing の省略形
  -p,  --page-requisites    HTML を表示するのに必要な全ての画像等も取得する
       --strict-comments    HTML 中のコメントの処理を厳密にする

再帰ダウンロード時のフィルタ:
  -A,  --accept=LIST               ダウンロードする拡張子をコンマ区切りで指定する
  -R,  --reject=LIST               ダウンロードしない拡張子をコンマ区切りで指定する
  -D,  --domains=LIST              ダウンロードするドメインをコンマ区切りで指定する
       --exclude-domains=LIST      ダウンロードしないドメインをコンマ区切りで指定する
       --follow-ftp                HTML 文書中の FTP リンクも取得対象にする
       --follow-tags=LIST          取得対象にするタグ名をコンマ区切りで指定する
       --ignore-tags=LIST          取得対象にしないタグ名をコンマ区切りで指定する
  -H,  --span-hosts                再帰中に別のホストもダウンロード対象にする
  -L,  --relative                  相対リンクだけ取得対象にする
  -I,  --include-directories=LIST  取得対象にするディレクトリを指定する
  -X,  --exclude-directories=LIST  取得対象にしないディレクトリを指定する
  -np, --no-parent                 親ディレクトリを取得対象にしない

バグ報告や提案は&lt;bug-wget@gnu.org&gt;へ
</pre>
<p>pavukはオプションが豊富すぎてついwktkしちゃいます。</p>
<p>▽pavukオプション</p>
<pre>

Usage:  pavuk  [options]  [any number of URLS]
pavuk-0.9.35 linux-gnu
-v                 - print version number
-h                 - help
-progress/-noprogress
                   - show retrieving progress while running on terminal
-lmax $nr          - allowed depth of tree
-dmax $nr          - maximal number of downloaded documents
-sleep $nr         - sleep for $nr seconds between transfers,
                     default 0 seconds
-rsleep/-norsleep  - randomize sleeping time between transfers
                     from 0 to -sleep time
-retry $nr         - number of retries if anything failed
-nregets $nr       - max number of regets on single file, default 2
-nredirs $nr       - max number of followed HTTP redirections, default 5
-timeout $nr       - timeout for network communications (min).
                     0 == no timeout, default = 0
-rollback $nr      - number of bytes to discard (counted from end
                     of file) if regetting, default 0
-ddays $nr         - number of days since last access when document is
                     checked in sync mode
-nocache/-cache    - disallow caching of HTTP documents (on proxy cache)
-noRobots/-Robots  - care about "robots.txt" file ?
-noFTP/-FTP        - don't download FTP files
-noHTTP/-HTTP      - don't download HTTP files
-noSSL/-SSL        - don't download (HTTPS) SSL files
-noverify/-verify        - don't verify SSL certificates
-noverify/-verify        - don't verify SSL certificates
-noFTPS/-FTPS      - don't download FTPS files
-noGopher/-Gopher  - download Gopher files ?
-noCGI/-CGI        - download parametric CGI pages ?
-noEnc/-Enc        - allow transfer of encoded files ?
-noRelocate/-Relocate
                   - don't rewrite links
-FTPhtml/-noFTPhtml
                   - process HTML files downloaded over FTP
-FTPlist/-noFTPlist
                   - use wide FTP directory listing
-FTPdir/-noFTPdir  - recurse FTP directory
-store_index/-nostore_index
                   - store directory URLs as index files
-force_reget/-noforce_reget
                   - force reget of whole file when server doesn't
                     support reget
-debug             - turn on debug mode
-debug_level $l    - debug level number, see manual for $l description
-asite $list       - comma-separated list of allowed sites
-dsite $list       - comma-separated list of disallowed sites
-adomain $list     - list of allowed domains
-ddomain $list     - list of disallowed domains
-aprefix $list     - list of allowed directory/file prefixes
-dprefix $list     - list of disallowed directory/file prefixes
-asfx $list        - list of allowed suffixes
-dsfx $list        - list of disallowed suffixes
-amimet $list      - list of alloved MIME types
-dmimet $list      - list of disallowed MIME types
-alang $list       - list of preferred languages (only via HTTP)
-acharset $list    - list of preferred character sets (only via HTTP)
-scndir $dir       - directory ,where are stored your scenarios
                     (config files)
-cdir $dir         - directory for storing documents
-subdir $dir       - subdirectory of cdir to operate on
-scenario $str     - name of scenario from scenario directory to load
                     and or run
-auth_scheme 1/2/3 - HTTP authorization scheme 1-user 2-Basic 3-Digest,
                     default 2
-auth_name $str    - name for Authorization (only via HTTP)
-auth_passwd $str  - password for Authorization (only via HTTP)
-auth_reuse_nonce/-noauth_reuse_nonce
                   - reuse one HTTP digest access authorization
                     nonce for more requests
-auth_reuse_proxy_nonce/-noauth_reuse_proxy_nonce
                   - reuse one HTTP proxy digest access
                     authorization nonce for more requests
-ssl_cert_passwd $str
                   - password for SSL certification file
-ssl_cert_file $str
                   - SSL certification file
-ssl_key_file $str - SSL certification key file
-ssl_cipher_list $str
                   - list of prefered SSL ciphers in SSL communication
-egd_socket $file  - path to EGD listening socket
-from $str         - e-mail address used for user identification
-send_from/-nosend_from
                   - send From: header in HTTP request with your
                     e-mail address
-identity $str     - contents of User-agent: field in HTTP request
-pattern $list     - list of wildcard patterns for files
-rpattern $re      - RE matching pattern for files
-skip_pattern $list
                   - list of skip wildcard patterns for files
-skip_rpattern $re
                   - skip RE matching pattern for files
-url_pattern $list - list of wildcard patterns for urls
-url_rpattern $re  - RE matching pattern for urls
-skip_url_pattern $list
                   - list of wildcard patterns for urls
-skip_url_rpattern $re
                   - RE matching patterns for urls
-mode $mode        - set operation mode
                         normal - recurse throught WWW (default)
                         linkupdate - update remote links in local tree
                         sync - synchronize local tree with remote WWW
                                servers
                         singlepage - single page with inline objects
                         singlereget - reget file until not whole
                         resumeregets - reget all files which are broken
                         dontstore - transfer documents, but don't store
                         reminder - checks URLs if they are changed
                         ftpdir - list content of FTP directory
                         mirror - make exact copy of remote site
-ftp_proxy $site[:$port]
                   - ftp proxy/cache server
-http_proxy $site[:$port]
                   - http proxy/cache server
-gopher_proxy $site[:$port]
                   - gopher proxy/cache server
-ssl_proxy $site[:$port]
                   - ssl proxy server
-gopher_httpgw/-nogopher_httpgw
                   - specified gopher proxy is HTTP gateway for Gopher
-ftp_httpgw/-noftp_httpgw
                   - specified ftp proxy is HTTP gateway for FTP
-ftp_dirtyproxy/-noftp_dirtyproxy
                   - use CONNECT request to HTTP proxy for FTP
                     connections
-dumpscn $str      - save scenario in scndir with name $str
-maxsize $nr       - maximal allowed size of document in bytes
-minsize $nr       - minimal allowed size of document in bytes
-http_proxy_pass $str
                   - password for HTTP proxy authorization
-http_proxy_user $str
                   - user name for HTTP proxy authorization
-http_proxy_auth 1/2/3
                   - authorization scheme for HTTP proxy authorization
-logfile $file     - name of file where mesages are stored
-slogfile $file    - name of file where short log will be stored
-tlogfile $file    - name of file where time log will be stored
-trelative $str (object/program)
                   - what timings are relative to
-transparent_proxy $site[:$port]
                   - transparent proxy
-transparent_ssl_proxy $site[:$port]
                   - transparent SSL proxy
-sdemo_mode/-notsdemo_mode
                   - sdemo compatible output
-noencode          - do not perform rfc 2396 character encoding
-stime/-nostime    - write starting and ending time of transfer
-remove_old/-noremove_old
                   - remove improper files or directories while running
                     in sync mode
-remove_before_store/-noremove_before_store
                   - remove file before storing new content
-always_mdtm/-noalways_mdtm
                   - always use MDTM to determine modifictaion time
                     of remote file; never use values from file listing
-auth_file $file   - file where you have stored your auth infos
                     see manual for format description
-base_level $nr    - number of levels of directory tree to omit from top
-ftp_active        - select active FTP data connection
-ftp_passive       - select passive FTP data connection
-active_ftp_port_range $min:$max
                   - range of FTP data connection ports used
                     for active ftp
-quiet             - don't show output messages
-verbose           - show output messages (default)
-newer_than $time  - download only documents newer than $time
                     format of $time: YYYY.MM.DD.hh:mm
-older_than $time  - download only documents older than $time
                     format of $time: YYYY.MM.DD.hh:mm
-schedule $time    - schedule pavuk start at $time
                     format of $time: YYYY.MM.DD.hh:mm
-reschedule $nr    - number of hours between two runs
                     for cyclic scheduling
-dont_leave_site/-leave_site
                   - don't/leave site of starting URL
-dont_leave_dir/-leave_dir
                   - don't/leave directory of starting URL
-preserve_time/-nopreserve_time
                   - preserve document modification time
-preserve_perm/-nopreserve_perm
                   - preserve document permissions
-preserve_slinks/-nopreserve_slinks
                   - preserve absolute symlinks
-leave_level $nr   - how many tree levels leave from starting
                     site , (0 == don't care) default 0
-cookie_file $file - file where are stored cookie infos
-cookie_send/-nocookie_send
                   - send cookie info in HTTP request
-cookie_recv/-nocookie_recv
                   - accept cookies from HTTP response
-cookie_update/-nocookie_update
                   - update cookies in cookies file
-cookie_check/-nocookie_check
                   - check if cookies are set for source domain
-cookies_max $nr   - maximal number of cookies in cookie cache
-disabled_cookie_domains $list
                   - comma-separated list of disabled cookie domains
-disable_html_tag $TAG,[$ATTRIB][;...]
                   - disable processing of URLs from
                     attribute $ATTRIB of HTML tag $TAG
-enable_html_tag $TAG,[$ATTRIB][;...]
                   - enable proccessing of URLs from
                     attribute $ATTRIB of HTML tag $TAG
-user_condition $str
                   - user exit script used to restrict some URLs
                     for more informations see manpage
-tr_del_chr $str   - characters that will be deleted from
                     local filename
-tr_str_str $str1 $str2
                   - translate $str1 to $str2 in local filename
-tr_chr_chr $chrset1 $chrset2
                   - translate $chrset1 to $chrset2 in local filename
-index_name $str   - name of directory index instead of _._.html
-store_name $str   - filename for first downloaded document
-check_size/-nocheck_size
                   - compare received size of file with
                     that provided by remote server
-urls_file $file   - URLs should be read from file, until
                     line with single "." occurs in input
-bg/-nobg          - detach pavuk proces from terminal and
                     don't output any messages on screen
-maxrate $nr       - limit to maximal speed of transfer (kB/s)
-minrate $nr       - limit to minimal speed of transfer (kB/s)
-bufsize $nr       - size of read buffer (kB)
-file_quota $nr    - maximal size of file to transfer (kB)
-trans_quota $nr   - maximal amount of transfer per session (kB)
-fs_quota $nr      - disk free space quota (kB)
-enable_js/-disable_js
                   - enable downloading of javascript source files
-fnrules $t $m $r  - local filename construction rules
                     (for better description see manual)
-store_info/-nostore_info
                   - store document info files with each document
-all_to_local/-noall_to_local
                   - change all links inside HTML document to
                     local immediately after download
-sel_to_local/-nosel_to_local
                   - change all links inside HTML document
                     which acomplish the limits, to
                     local immediately after download
-all_to_remote/-noall_to_remote
                   - change all links inside HTML document to
                     remote immediately after download and
                     don't do any further changes to it
-remind_cmd $str   - command which sends result from reminder mode
-auto_referer/-noauto_referer
                   - in HTTP request send for each starting URL
                     Referer: field which contains its own URL
-referer/-noreferer
                   - send Referer: field in HTTP request
-url_strategy $strategy
                   - scheduling strategy for URLs
                     (this means order how URLs will be downloaded)
                     $strategy is one of :
                        level  - level order in URL tree
                        leveli - level order in URL tree,
                                 but inline objects go first
                        pre    - pre-order in URL tree
                        prei   - pre-order in URL tree,
                                 but inline objects go first
-nscache_dir $dir  - path to Netcape browser cache directory
-remove_adv/-noremove_adv
                   - enable removing of advertisement banners
                     assumes you have setup regular expresions
                     for matching adv banners with -adv_re option
-adv_re $RE        - regular expressions for matching advertisement
                     banner URLs
-check_bg/-nocheck_bg
                   - if running at background, don't write any
                     messages to screen
-send_if_range/-nosend_if_range
                   - send If-Range header in HTTP request
                     turn this of when server support reget, but
                     generates different Etags for two requests
-sched_cmd $str    - command for scheduling
-unique_log/-nounique_log
                   - when original log file locked try to find other
                     with numbering extension which is not locked
-read_css/-noread_css
                   - fetch objects mentioned in style sheets
-post_cmd $str     - postprocessing command, which will be invoked
                     after document will be successfully downloaded
-ssl_version $v    - version of SSL protocol used for communication,
                     valid values: ssl23,ssl2,ssl3,tls1
-unique_sslid/-nounique_sslid
                   - use unique SSL ID with each SSL session
-httpad $hdr       - additional HTTP header
-statfile $str     - statistical report from downloading progress
-aip_pattern $re   - pattern for allowed IP addresses of servers
-dip_pattern $re   - pattern for disallowed IP addresses of servers
-site_level $nr    - maximum allowed number of sites to leave from
                     starting site
-use_http11/-nouse_http11
                   - enable or disable using of HTTP/1.1 protocol
                     features, default is off now
-max_time $nr      - set maximal amount of time for program run
                     in minutes, default 0 == no limit
                     you can use floating point numbers, to
                     specify subminute times
-local_ip $str     - use this local ip address of network interface.
                     This option is for multihomed machines.
-request $req      - extended request informations, used to specify
                     information for GET or POST requests.
                     format of $req :
                     "URL:$url METHOD:[GET|POST] ENCODING:[m|u]
                       FIELD:$variable=$value
                       FILE:$variable=$filename
                       LNAME:$local_filename"
                     (for more informations see manual page)
-hash_size $nr     - size of internal hash tables for performance tuning
-nthreads $nr      - set number of concurent downloading threads
-immesg/-noimmesg  - write messages immediately after produced, not
                     just when safe (from MT point of view)
-formdata $data    - used to specify HTML form fields, for HTML
                     forms found during traversing document tree.
                     Only forms mentiond in this option will be
                     processed automaticaly.
                     "URL:$url
                       FIELD:$variable=$value
                       FILE:$variable=$filename"
                     (for more informations see manual page)
-dumpfd $nr        - number of filedescriptor where to output
                     document contents instead to file
-dump_urlfd $nr    - number of filedescriptor where to output
                     all URLs found in documents
-del_after/-nodel_after
                   - delete FTP document after succesfull transfer
-unique_name/-nounique_name
                   - always generate unique name for each document
-leave_site_enter_dir/-dont_leave_site_enter_dir
                   - leave directory which we first entered on site
-singlepage/-nosinglepage
                   - donwload single HTML page with all inline objects
-dump_after/-nodump_after
                   - when used with option -dumpfd, dump document after
                     successful download and processing of HTML
                     documents
-dump_response/-nodump_response
                   - when used with option -dumpfd, also responses
                     from HTTP servers will be dumped
-auth_ntlm_domain $str
                   - SMB domain name for HTTP NTLM authorization
-auth_proxy_ntlm_domain $str
                   - SMB domain name for HTTP proxy NTLM authorization
-js_pattern $re    - additional RE patterns for matching URLs in DOM
                     event attributes of HTML tags
-follow_cmd $str   - user exit script used tell if you want to follow
                     any link from current HTML document
-retrieve_symlink/-noretrieve_symlink
                   - retrieve symliks like regular files or directories
-js_transform $p $t $h $a
                   - custom JS pattern with transformation
                     $p - pattern
                     $t - transfomation
                     $h - HTML tag or * or ""
                     $a - HTML attrib
-js_transform2 $p $t $h $a
                   - custom JS pattern with transformation and
                     rewriting of URLs in first subpattern
                     $p - pattern
                     $t - transfomation
                     $h - HTML tag or * or ""
                     $a - HTML attrib
-ftp_proxy_user $str
                   - username for access authorization to FTP proxy
-ftp_proxy_pass $str
                   - password for access authorization to FTP proxy
-limit_inlines/-dont_limit_inlines
                   - apply limiting options on page inline objects?
-ftp_list_options $str
                   - additional options or parameters to FTP LIST or
                     NLST commands
-fix_wuftpd_list/-nofix_wuftpd_list
                   - do extensive checking of FTP directory presence to
                     workaround WuFTPD broken responses when trying
                     to list nonexisting directory
-post_update/-nopost_update
                   - update in parent documents only links pointing
                     to current document
-info_dir $dir     - separate directory where will stored info files
                     instead of directly into document tree
-mozcache_dir $dir - path to Mozilla browser cache directory
-aport $list       - allow downloading of documents from servers
                     siting on listed ports
-dport $list       - deny downloading of documents from servers
                     siting on listed ports
-hack_add_index/-nohack_add_index
                   - this is hack to allow adding of also directories
                     of all queued files
-default_prefix $str
                   - default URL prefix for subdirectory of
                     mirrored files
-ftp_login_handshake $host $handshake
                   - customize login handshake for FTP server
-dont_touch_url_rpattern $re
                   - RE pattern of URL which should not be touched
                     by URL rewriting engine
-dont_touch_url_pattern $list
                   - wilcard patterns of URLs which should not
                     be touched by URL rewriting engine
-dont_touch_tag_rpattern $re
                   - RE pattern of HTML tag in which URLs should
                     not be touched by URL rewriting engine
-tag_pattern $tag $attrib $url
                   - wilcard patterns for precise matching of URLs
                     inside HTML tags
-tag_rpattern $tag $attrib $url
                   - RE patterns for precise matching of URLs
                     inside HTML tags
</pre>
<p>なんだか読みづらくなってしまった…。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/894/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iMac SnowLeopard にwgetをインストールする</title>
		<link>http://hiropo.co.uk/archives/715</link>
		<comments>http://hiropo.co.uk/archives/715#comments</comments>
		<pubDate>Sat, 03 Sep 2011 07:43:17 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=715</guid>
		<description><![CDATA[MacOSX SnowLeopardちゃん、Curlちゃんは入ってるんだけど、wgetちゃんが入ってない事実…。 ということでwgetをインストールします。 GNUからwgetの最新版をダウンロードします。 wget最新 &#8230; <a href="http://hiropo.co.uk/archives/715">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>MacOSX SnowLeopardちゃん、Curlちゃんは入ってるんだけど、wgetちゃんが入ってない事実…。</p>
<p>ということでwgetをインストールします。</p>
<p>GNUからwgetの最新版をダウンロードします。<br />
<a href="ftp://ftp.gnu.org/pub/gnu/wget/" target="_blank">wget最新版はこちらからチェック</a></p>
<pre>
$ sudo su -
# curl -O ftp://ftp.gnu.org/pub/gnu/wget/wget-1.9.1.tar.gz
# tar xvfz wget-1.9.1.tar.gz
# cd wget-1.9.1
# ./configure
# make
# make install
</pre>
<p>これでwgetちゃんが使えるようになりました！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/715/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby1.9.2 をインストールする。</title>
		<link>http://hiropo.co.uk/archives/581</link>
		<comments>http://hiropo.co.uk/archives/581#comments</comments>
		<pubDate>Wed, 19 Jan 2011 05:00:36 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=581</guid>
		<description><![CDATA[いつもyumでさらっとアプリケーションをインストールしているのでたまにはちょっと手間かけて最新版をソースからコンパイルしてインストールすることにする。あと最新版のRails3.x系を使いたいということで。 Rails環境 &#8230; <a href="http://hiropo.co.uk/archives/581">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>いつもyumでさらっとアプリケーションをインストールしているのでたまにはちょっと手間かけて最新版をソースからコンパイルしてインストールすることにする。あと最新版のRails3.x系を使いたいということで。</p>
<p>Rails環境を整える準備として、RubyとRubyGemsをインストールする。</p>
<p>まずはRuby1.9.2 をインストール。<br />
<a href="http://www.ruby-lang.org/ja/downloads/" target="_blank">Ruby最新版はここで確認する。</a></p>
<pre>
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p136.tar.gz
# tar xvzf ruby-1.9.2-p136.tar.gz
# cd ruby-1.9.2-p136
# ./configure
# make &#038;&#038; make install
# make clean
</pre>
<p>Rubyがインストールできたか確認</p>
<pre>
# ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [i686-linux]
</pre>
<p>簡単なRubyスクリプトを作成して動作確認<br />
hello.rb</p>
<pre>
def main arg
    return arg
end

puts main("ahya")
</pre>
<p>実行結果</p>
<pre>
# ruby hello.rb
ahya
</pre>
<p>でた。<br />
とりあえずRubyはこれでおｋ。</p>
<p>Ruby.1.9.x系からRubyGems1.3.7が入ってるようなので、RubyGemsのインストールは不要。<br />
これでRubyとGemsが使える。</p>
<p>RubyGemsのバージョンやらをいちお確認する。</p>
<pre>
# gem -v
1.3.7

# gem list

*** LOCAL GEMS ***

minitest (1.6.0)
rake (0.8.7)
rdoc (2.5.8)
</pre>
<p>これでおｋ。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/581/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>passenger をインストールする</title>
		<link>http://hiropo.co.uk/archives/573</link>
		<comments>http://hiropo.co.uk/archives/573#comments</comments>
		<pubDate>Thu, 18 Nov 2010 09:30:54 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=573</guid>
		<description><![CDATA[そういえばpassenger をインストールしてなかったので、インストールする。 # gem install passenger # passenger-install-apache2-module Checking f &#8230; <a href="http://hiropo.co.uk/archives/573">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>そういえばpassenger をインストールしてなかったので、インストールする。</p>
<pre>
# gem install passenger
# passenger-install-apache2-module

Checking for required software...

 * GNU C++ compiler... found at /usr/bin/g++
 * Curl development headers with SSL support... not found
 * OpenSSL development headers... not found
 * Zlib development headers... found
 * Ruby development headers... found
 * OpenSSL support for Ruby... not found
 * RubyGems... found
 * Rake... found at /usr/local/bin/rake
 * rack... found
 * Apache 2... found at /usr/sbin/httpd
 * Apache 2 development headers... not found
 * Apache Portable Runtime (APR) development headers... not found
 * Apache Portable Runtime Utility (APU) development headers... not found
</pre>
<p>2つ目の質問で、いくつかモジュールが足りないと言われたので一旦Ctrl+C で抜けて、足りないモジュールをインストールする。</p>
<pre>
# yum install httpd-devel openssl openssl-devel apr-devel
Installed:
  apr-devel.i386 0:1.2.7-11.el5_5.3          apr-devel.x86_64 0:1.2.7-11.el5_5.3
  httpd-devel.i386 0:2.2.3-43.el5.centos.3   httpd-devel.x86_64 0:2.2.3-43.el5.centos.3
  openssl-devel.i386 0:0.9.8e-12.el5_4.6     openssl-devel.x86_64 0:0.9.8e-12.el5_4.6

Dependency Installed:
  apr-util-devel.x86_64 0:1.2.7-11.el5_5.1   cyrus-sasl-devel.x86_64 0:2.1.22-5.el5_4.3
  db4-devel.x86_64 0:4.3.29-10.el5_5.2       e2fsprogs-devel.x86_64 0:1.39-23.el5_5.1
  expat-devel.x86_64 0:1.95.8-8.3.el5_5.3    keyutils-libs-devel.x86_64 0:1.2-1.el5
  krb5-devel.x86_64 0:1.6.1-36.el5_5.5       libselinux-devel.x86_64 0:1.33.4-5.5.el5
  libsepol-devel.x86_64 0:1.15.2-3.el5       openldap-devel.x86_64 0:2.3.43-12.el5_5.2
</pre>
<p>もう一度インストールを試みる</p>
<pre>
# passenger-install-apache2-module
* Curl development headers with SSL support... not found
* OpenSSL support for Ruby... not found
</pre>
<p>まだエラーが二つ。<br />
&#8220;OpenSSL support for Ruby&#8221; に関しては、zlibと同様に Ruby の持つ SSL サポートモジュールをコンパイルすることで解決できるようです。</p>
<pre>
# cd ./ruby-1.8.7-p249/ext/openssl/
# ruby extconf.rb
# make
# make install
</pre>
<p>Curl-devel もインストールする。</p>
<pre>
# yum install curl-devel

Running Transaction
  Installing     : libidn                                                             1/5
  Installing     : libidn-devel                                                       2/5
  Installing     : curl                                                               3/5
  Installing     : curl-devel                                                         4/5
  Installing     : curl-devel                                                         5/5

Installed:
  curl-devel.i386 0:7.15.5-9.el5             curl-devel.x86_64 0:7.15.5-9.el5

Dependency Installed:
  curl.i386 0:7.15.5-9.el5   libidn.i386 0:0.6.5-1.1   libidn-devel.x86_64 0:0.6.5-1.1

Complete!
</pre>
<p>3度目の正直を試す。</p>
<pre>
# passenger-install-apache2-module

The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0
   PassengerRuby /usr/local/bin/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

Press ENTER to continue.
</pre>
<p>不足モジュールがすべて解決済みならインストールが継続される。<br />
すると以下のようなメッセージが表示される。下記の部分は Passenger の動作設定となるので、必ずメモを取ること。<br />
記述は動作環境によって異なります。</p>
<pre>
   LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0
   PassengerRuby /usr/local/bin/ruby
</pre>
<p>メモったらEnterキーを押す。次に、ドキュメントルールに関する設定が出るので、これもメモる。</p>
<pre>
Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

   &lt;VirtualHost *:80&gt;
      ServerName www.yourhost.com
      DocumentRoot /somewhere/public    # &lt;-- be sure to point to &#039;public&#039;!
      &lt;Directory /somewhere/public&gt;
         AllowOverride all              # &lt;-- relax Apache security settings
         Options -MultiViews            # &lt;-- MultiViews must be turned off
      &lt;/Directory&gt;
   &lt;/VirtualHost&gt;

And that&#039;s it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

  /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) <img src='http://hiropo.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> 

http://www.modrails.com/

Phusion Passenger is a trademark of Hongli Lai &amp; Ninh Bui.
</pre>
<p>passengerのインストールはこれで完了。<br />
次にさきほどのメモをapacheに反映させる。</p>
<pre>
# vi /etc/httpd/conf/httpd.conf

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.0
PassengerRuby /usr/local/bin/ruby
</pre>
<p>apacheの再起動を行う。</p>
<pre>
# /etc/rc.d/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
</pre>
<p>これで無事完了なりー。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/573/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>さくらVPSにRubyとRuby on Railsをインストールする</title>
		<link>http://hiropo.co.uk/archives/562</link>
		<comments>http://hiropo.co.uk/archives/562#comments</comments>
		<pubDate>Tue, 09 Nov 2010 03:02:50 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=562</guid>
		<description><![CDATA[さくらVPSにRubyとRuby on Railsをインストールする 先日借りたさくらVPSでRubyを使おうと思ったらデフォルトでインストールされていないようなのでRuby環境を構築することにする。ついでにRuby o &#8230; <a href="http://hiropo.co.uk/archives/562">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>さくらVPSにRubyとRuby on Railsをインストールする</p>
<p>先日借りたさくらVPSでRubyを使おうと思ったらデフォルトでインストールされていないようなのでRuby環境を構築することにする。ついでにRuby on Railsもインストールすることにする。</p>
<p>まずRubyをインストール</p>
<pre>
$ sudo su -
# yum install ruby
Installed:
  ruby.x86_64 0:1.8.5-5.el5_4.8

Dependency Installed:
  ruby-libs.x86_64 0:1.8.5-5.el5_4.8

Complete!
</pre>
<p>次にRubyGemsをインストールする。<br />
ただし、Ruby1.8.5だと、Gemsは1.3.5でないとインストールできない。1.3.6以降を使いたい場合は、Ruby1.8.6以上をインストールする。</p>
<pre>
# wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
# tar xvfz rubygems-1.3.5.tgz
# cd rubygems-1.3.5
# ruby setup.rb
RubyGems 1.3.5 installed
./lib/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- rdoc/rdoc (LoadError)
        from ./lib/rubygems/custom_require.rb:31:in `require'
        from ./lib/rubygems/commands/setup_command.rb:352:in `run_rdoc'
        from ./lib/rubygems/commands/setup_command.rb:247:in `install_rdoc'
        from ./lib/rubygems/commands/setup_command.rb:120:in `execute'
        from ./lib/rubygems/command.rb:257:in `invoke'
        from ./lib/rubygems/command_manager.rb:132:in `process_args'
        from ./lib/rubygems/command_manager.rb:102:in `run'
        from ./lib/rubygems/gem_runner.rb:58:in `run'
        from setup.rb:35
</pre>
<p>rdocがないって言われたので、rdocをインストールして、再びGemsインストールを実行</p>
<pre>
# yum install rdoc
Installed:
  ruby-rdoc.x86_64 0:1.8.5-5.el5_4.8

Dependency Installed:
  ruby-irb.x86_64 0:1.8.5-5.el5_4.8

Complete!

# ruby setup.rb
RubyGems 1.3.5 installed

=== 1.3.5 / 2009-07-21

Bug fixes:

* Fix use of prerelease gems.
* Gem.bin_path no longer escapes path with spaces. Bug #25935 and #26458.

Deprecation Notices:

* Bulk index update is no longer supported (the code currently remains, but not
  the tests)
* Gem::manage_gems was removed in 1.3.3.
* Time::today was removed in 1.3.3.

------------------------------------------------------------------------------

RubyGems installed the following executables:
        /usr/bin/gem
</pre>
<p>これでRubyとRubyGemsのインストールができた。</p>
<p>次にRuby on Rails をインストールする。</p>
<pre>
# gem install rails
ERROR:  Error installing rails:
        activesupport requires Ruby version >= 1.8.7
</pre>
<p>Ruby1.8.7 以上いれろって怒られた。<br />
さすがにめんどくさくなってきたけどもうちょっと頑張ることにする。</p>
<p>仕方がないので、Ruby1.8.7をインストールする。<br />
最新版のソースを落としてビルドする。</p>
<pre>
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p249.tar.bz2
# tar jvxf ruby-1.8.7-p249.tar.bz2
# cd ruby-1.8.7-p249
# ./configure
# make &#038;&#038; make install
# make clean
</pre>
<p>Ruby1.8.7がインストールできたので、Ruby1.8.5を削除する。</p>
<pre>
# yum remove ruby
Removed:
  ruby.x86_64 0:1.8.5-5.el5_4.8

Dependency Removed:
  ruby-irb.x86_64 0:1.8.5-5.el5_4.8            ruby-rdoc.x86_64 0:1.8.5-5.el5_4.8

Complete!
</pre>
<p>Rubyのバージョンを確認する。</p>
<pre>
# ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
</pre>
<p>gemsも最新版をインストールする。<br />
<a href="http://rubyforge.org/frs/?group_id=126" target="_blank">最新版URLはこちらで確認</a></p>
<pre>
# wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
# tar xvfz rubygems-1.3.7.tgz
# cd rubygems-1.3.7
# ruby setup.rb
# gem -v
1.3.7
</pre>
<p>これで、Ruby1.8.7、RubyGems1.3.7がインストールできた。<br />
と思いきや、リストを参照したらエラーがでた。</p>
<pre>
# gem list
ERROR:  Loading command: list (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::ListCommand
</pre>
<p>zlibないって言われた。でもzlib入ってるし。<br />
ググったら同じ問題にぶつかった人がいたので<a href="http://fujiiyuuki.blogspot.com/2010/03/centosrails.html" target="_blank">こちらを参考</a>にzlib-devel入れて再コンパイルしてみた。そしたらすんなり通りやがりましたよ。</p>
<pre>
# cd
# yum install zlib-devel
Installed:
  zlib-devel.i386 0:1.2.3-3                    zlib-devel.x86_64 0:1.2.3-3

Complete!

# cd ruby-1.8.7-p249
# cd ext/
# ruby extconf.rb --with-zlib-include=/usr/include -with-zlib-lib=/usr/lib
checking for deflateReset() in -lz... yes
checking for zlib.h... yes
checking for kind of operating system... Unix
creating Makefile

# make &#038;&#038; make install
# gem list

*** LOCAL GEMS ***
</pre>
<p>でーけたー！これでやっとRailsをインストールできるはず。</p>
<pre>
# gem install rails
Successfully installed activesupport-3.0.1
Successfully installed builder-2.1.2
Successfully installed i18n-0.4.2
Successfully installed activemodel-3.0.1
Successfully installed rack-1.2.1
Successfully installed rack-test-0.5.6
Successfully installed rack-mount-0.6.13
Successfully installed tzinfo-0.3.23
Successfully installed abstract-1.0.0
Successfully installed erubis-2.6.6
Successfully installed actionpack-3.0.1
Successfully installed arel-1.0.1
Successfully installed activerecord-3.0.1
Successfully installed activeresource-3.0.1
Successfully installed mime-types-1.16
Successfully installed polyglot-0.3.1
Successfully installed treetop-1.4.8
Successfully installed mail-2.2.9
Successfully installed actionmailer-3.0.1
Successfully installed rake-0.8.7
Successfully installed thor-0.14.4
Successfully installed railties-3.0.1
Successfully installed bundler-1.0.3
Successfully installed rails-3.0.1
24 gems installed
Installing ri documentation for activesupport-3.0.1...
Installing ri documentation for builder-2.1.2...
ERROR: &nbsp;While generating documentation for builder-2.1.2
... MESSAGE: &nbsp; Unhandled special: Special: type=17, text=&quot;&lt;!-- HI --&gt;&quot;
... RDOC args: --ri --op /usr/local/lib/ruby/gems/1.8/doc/builder-2.1.2/ri --title Builder -- Easy XML Building --main README --line-numbers --quiet lib CHANGES Rakefile README doc/releases/builder-1.2.4.rdoc doc/releases/builder-2.0.0.rdoc doc/releases/builder-2.1.1.rdoc --title builder-2.1.2 Documentation
(continuing with the rest of the installation)
Installing ri documentation for i18n-0.4.2...
Installing ri documentation for activemodel-3.0.1...
Installing ri documentation for rack-1.2.1...
Installing ri documentation for rack-test-0.5.6...
Installing ri documentation for rack-mount-0.6.13...
Installing ri documentation for tzinfo-0.3.23...
Installing ri documentation for abstract-1.0.0...
Installing ri documentation for erubis-2.6.6...
Installing ri documentation for actionpack-3.0.1...
Installing ri documentation for arel-1.0.1...
Installing ri documentation for activerecord-3.0.1...
Installing ri documentation for activeresource-3.0.1...
Installing ri documentation for mime-types-1.16...
Installing ri documentation for polyglot-0.3.1...
Installing ri documentation for treetop-1.4.8...
Installing ri documentation for mail-2.2.9...
Installing ri documentation for actionmailer-3.0.1...
Installing ri documentation for rake-0.8.7...
Installing ri documentation for thor-0.14.4...
Installing ri documentation for railties-3.0.1...
Installing ri documentation for bundler-1.0.3...
Installing ri documentation for rails-3.0.1...
File not found: lib
</pre>
<p>なんか途中エラーでた。なんじゃこりゃ。<br />
とりあえず確認してみる。</p>
<pre>
# rails -v
Rails 3.0.1
</pre>
<p>Rails3.x系になってから、createコマンドがRails2系と違うみたいで、下記ではcreateできなかった。</p>
<pre>
$ rails testapp
Usage:
  rails new APP_PATH [options]
</pre>
<p>ので、Rails3.0にのっとってcreateしてみる。</p>
<pre>
$ rails new testapp
      create
      create  README
      create  Rakefile
      create  config.ru
      create  .gitignore
      create  Gemfile
      create  app
      create  app/controllers/application_controller.rb
      create  app/helpers/application_helper.rb
      create  app/mailers
      create  app/models
      create  app/views/layouts/application.html.erb
      create  config
      create  config/routes.rb
      create  config/application.rb
      create  config/environment.rb
      create  config/environments
      create  config/environments/development.rb
      create  config/environments/production.rb
      create  config/environments/test.rb
      create  config/initializers
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/secret_token.rb
      create  config/initializers/session_store.rb
      create  config/locales
      create  config/locales/en.yml
      create  config/boot.rb
      create  config/database.yml
      create  db
      create  db/seeds.rb
      create  doc
      create  doc/README_FOR_APP
      create  lib
      create  lib/tasks
      create  lib/tasks/.gitkeep
      create  log
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log
      create  public
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/favicon.ico
      create  public/index.html
      create  public/robots.txt
      create  public/images
      create  public/images/rails.png
      create  public/stylesheets
      create  public/stylesheets/.gitkeep
      create  public/javascripts
      create  public/javascripts/application.js
      create  public/javascripts/controls.js
      create  public/javascripts/dragdrop.js
      create  public/javascripts/effects.js
      create  public/javascripts/prototype.js
      create  public/javascripts/rails.js
      create  script
      create  script/rails
      create  test
      create  test/fixtures
      create  test/functional
      create  test/integration
      create  test/performance/browsing_test.rb
      create  test/test_helper.rb
      create  test/unit
      create  tmp
      create  tmp/sessions
      create  tmp/sockets
      create  tmp/cache
      create  tmp/pids
      create  vendor/plugins
      create  vendor/plugins/.gitkeep
</pre>
<p>testappを動かしてみる</p>
<pre>
$ cd testapp/
$ rails server
Could not find gem 'sqlite3-ruby (>= 0, runtime)' in any of the gem sources.
Try running `bundle install`.
</pre>
<p>&#8220;sqlite3-ruby&#8221; が入ってないとのこと。<br />
&#8220;sqlite3-ruby&#8221; を入れる。</p>
<pre>
$ cd testapp/
$ vi Gemfile
gem 'sqlite3-ruby', :require => 'sqlite3'

$ sudo gem install sqlite3-ruby
Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
        ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... no
checking for sqlite3_initialize()... no
sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.2 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.3.2/ext/sqlite3/gem_make.out
</pre>
<p>&#8220;sqlite3-ruby only supports sqlite3 versions 3.6.16+, please upgrade!&#8221; って新しいのいれろってことかしら。</p>
<p>sqlite3のバージョン確認</p>
<pre>
$ rpm -q sqlite
sqlite-3.3.6-5
</pre>
<p>古い。そういえばsqlite-develも入っていなかったので、インストールする。</p>
<pre>
# yum install sqlite-devel
Installed:
  sqlite-devel.i386 0:3.3.6-5                sqlite-devel.x86_64 0:3.3.6-5

Complete!
</pre>
<p>sqlite3をソースからインストールする。</p>
<pre>
$ cd /usr/local/src
$ sudo wget http://www.sqlite.org/sqlite-amalgamation-3.7.3.tar.gz
$ sudo tar xvzf sqlite-3.7.3.tar.gz 
$ cd sqlite-3.7.3
$ sudo ./configure
$ sudo make
$ sudo make install
</pre>
<p>再びsqlite3-ruby をインストール</p>
<pre>
$ sudo gem install sqlite3-ruby
Building native extensions.  This could take a while...
Successfully installed sqlite3-ruby-1.3.2
1 gem installed
Installing ri documentation for sqlite3-ruby-1.3.2...

No definition for libversion

Enclosing class/module 'mSqlite3' for class Statement not known
Installing RDoc documentation for sqlite3-ruby-1.3.2...

No definition for libversion

Enclosing class/module 'mSqlite3' for class Statement not known
</pre>
<p>sqlite3-ruby を確認</p>
<pre>
$ gem list

*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.1)
actionpack (3.0.1)
activemodel (3.0.1)
activerecord (3.0.1)
activeresource (3.0.1)
activesupport (3.0.1)
arel (1.0.1)
bcrypt-ruby (2.1.2)
builder (2.1.2)
bundler (1.0.3)
erubis (2.6.6)
i18n (0.4.2)
mail (2.2.9)
mime-types (1.16)
polyglot (0.3.1)
rack (1.2.1)
rack-mount (0.6.13)
rack-test (0.5.6)
rails (3.0.1)
railties (3.0.1)
rake (0.8.7)
sqlite3-ruby (1.3.2)
thor (0.14.4)
treetop (1.4.8)
tzinfo (0.3.23)
</pre>
<p>はいったー！<br />
railsサーバーを立ち上げてみる。</p>
<pre>
$ cd
$ cd dev/rails/testapp/
$ rails server
=> Booting WEBrick
=> Rails 3.0.1 application starting in development on http://0.0.0.0:3000
</pre>
<p>http://localhost:3000/ にアクセス。<br />
<a href="http://hiropo.co.uk/wp-content/uploads/2010/11/rails.gif"><img src="http://hiropo.co.uk/wp-content/uploads/2010/11/rails-300x230.gif" alt="" title="rails" width="300" height="230" class="alignnone size-medium wp-image-563" /></a></p>
<p>やったー！うごいたー！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/562/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>まさかの4ヶ月待ち。GuruPlugが届いた！</title>
		<link>http://hiropo.co.uk/archives/491</link>
		<comments>http://hiropo.co.uk/archives/491#comments</comments>
		<pubDate>Mon, 12 Jul 2010 17:46:24 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[GuruPlug]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=491</guid>
		<description><![CDATA[ついに念願のアレが届いた。 SekenではiPhone4やらiPadやら話題になりまくってるけど、どんなApple製品よりも手に入りにくくて品薄な商品が世の中にはあるんだぜ…。 それがこちら↓ GuruPlug！電源内蔵 &#8230; <a href="http://hiropo.co.uk/archives/491">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>ついに念願のアレが届いた。<br />
SekenではiPhone4やらiPadやら話題になりまくってるけど、どんなApple製品よりも手に入りにくくて品薄な商品が世の中にはあるんだぜ…。</p>
<p>それがこちら↓<br />
<a href="http://hiropo.co.uk/wp-content/uploads/2010/07/IMG_02502.jpg"><img src="http://hiropo.co.uk/wp-content/uploads/2010/07/IMG_02502-225x300.jpg" alt="" title="IMG_0250" width="225" height="300" class="size-medium wp-image-500" /></a></p>
<p>GuruPlug！電源内蔵のプラグコンピュータとして話題になったSheevaPlugの後継機！<br />
なんと無線LANも使えちゃうんだってばよ。 </p>
<div><a href="http://hiropo.co.uk/wp-content/uploads/2010/07/IMG_02521.jpg"><img src="http://hiropo.co.uk/wp-content/uploads/2010/07/IMG_02521-225x300.jpg" alt="" title="IMG_0252" width="225" height="300" class="size-medium wp-image-497" /></a></div>
<div><a href="http://hiropo.co.uk/wp-content/uploads/2010/07/IMG_02541.jpg"><img src="http://hiropo.co.uk/wp-content/uploads/2010/07/IMG_02541-225x300.jpg" alt="" title="IMG_0254" width="225" height="300" class="size-medium wp-image-498" /></a></div>
<p>形はACアダプタと同じ形だけど重さはタバコ2箱分くらいの重さでむちゃくちゃ軽い。<br />
これがパソコンだなんて全然見えないんす。</p>
<p>これも製造元（US）に直接発注して、製造が追いつかず、発注から約4ヶ月の時を経てようやく我が家に届きました。日本には代理店なども特にないので、直接個人輸入しないと手に入らないのです。</p>
<p>これ10台繋いでグリッドコンピューティングしてみたいすな！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/491/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>hirohi</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系にインストールしてみました。 クライアント認証につまづいてなかなか壁を突破できませんでしたがググって頑張りましたよっ &#8230; <a href="http://hiropo.co.uk/archives/487">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>MySQLしか使ったことないのですが、案件でPostgresqlを使うことになりまして、CentOS5系にインストールしてみました。<br />
クライアント認証につまづいてなかなか壁を突破できませんでしたがググって頑張りましたよっと。</p>
<p>まず、yumで必要なモジュールをインストール。</p>
<pre>
[root@localhost ~]# yum install -y postgresql-tcl postgresql-server postgresql-contrib postgresql php-pgsql
</pre>
<p>今回はPHPとの連動を行うので、下記もインストール</p>
<pre>
[root@localhost ~]# yum install -y php-pgsql
</pre>
<p>ひととおりインストールが終わったらpostgresqlを起動。</p>
<pre>
[root@localhost ~]# /etc/rc.d/init.d/postgresql start
</pre>
<p>それでは初期設定を行っていく。<br />
MySQLと違って、postgresというユーザーでログインしないと設定が行えない。</p>
<pre>
[root@localhost ~]# su - postgres
-bash-3.2$ psql -l
        List of databases
   Name    |  Owner   | Encoding
-----------+----------+----------
 postgres  | postgres | UTF8
 template0 | postgres | UTF8
 template1 | postgres | UTF8
(3 rows)
</pre>
<p>ユーザー名&#8221;test&#8221;、パスワード&#8221;test&#8221; のユーザーを作成する。<br />
権限はデータベースの作成を可能にする。</p>
<pre>
-bash-3.2$ psql
Welcome to psql 8.1.21, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

postgres=# CREATE USER "test" CREATEDB PASSWORD 'test' LOGIN;
CREATE ROLE
postgres=# \q
-bash-3.2$ exit
logout

[root@localhost ~]#
</pre>
<p>これで、Linux上のユーザー&#8221;test&#8221;からPostgresqlを操作できるようになる。<br />
そしたら、&#8221;test&#8221;ユーザーが使えるデータベース&#8221;test&#8221;を作成する。<br />
文字コードは&#8221;EUC_JP&#8221;にする。</p>
<pre>
[root@localhost ~]# su - test
[test@localhost ~]# createdb test -E EUC_JP
CREATE DATABASE
[test@localhost ~]$ psql -l
        List of databases
   Name    |  Owner   | Encoding
-----------+----------+----------
 test      | test     | EUC_JP
 postgres  | postgres | UTF8
 template0 | postgres | UTF8
 template1 | postgres | UTF8
(4 rows)
[test@localhost ~]$
</pre>
<p>ちなみにただ単に &#8220;creatdb test&#8221; とした場合、文字コードはデフォルトで&#8221;utf-8&#8243;になる。<br />
データベースを削除する場合は、&#8221;drop データベース名&#8221; とすれば良い。</p>
<p>最後に、PHPなどと連携する場合は、クライアント認証ファイルを編集する必要がある。</p>
<pre>
[root@localhost ~]# vi /var/lib/pgsql/data/pg_hba.conf
#local  all         all                               ident sameuser  #コメントアウト
local   all         all                               trust

#host   all         all         127.0.0.1/32          ident sameuser  #コメントアウト
host    all         all         127.0.0.1/32          password
</pre>
<p>postgresqlとapacheを再起動する。</p>
<pre>
[root@localhost ~]# /etc/rc.d/init.d/postgresql restart
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]

[root@localhost ~]# /etc/rc.d/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
</pre>
<p>phpファイルを書いて、接続テストする。</p>
<pre>
&lt;?php

$data = &quot;host=localhost user=test dbname=test password=test&quot;;
$pg = pg_connect($data);

if(!$pg){
  echo &#039;接続できませんでした。&#039;;
}
else{
  echo &#039;接続しちゃいました&lt;br /&gt;&#039;;
}

if(!pg_close($pg)){
}
else{
  echo &#039;接続を閉じました。&#039;;
}

?&gt;
</pre>
<p>特に問題なく接続できたら下記のように表示される。</p>
<pre>
接続しちゃいました
接続を閉じました。
</pre>
<p>クライアント認証んとこは本当にわかんなくてつまづいたけど、ちゃんと繋がると感動ですね！</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/487/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spamassassin が動いてない</title>
		<link>http://hiropo.co.uk/archives/477</link>
		<comments>http://hiropo.co.uk/archives/477#comments</comments>
		<pubDate>Wed, 16 Jun 2010 16:27:11 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Spamassassin]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=477</guid>
		<description><![CDATA[スパムメールが増えたのかなんなのか、ウチのサーバのログが暴れだしたので、ちょこっと調べてみることにした。 host spamc[9130]: connect to spamd on 127.0.0.1 failed, r &#8230; <a href="http://hiropo.co.uk/archives/477">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>スパムメールが増えたのかなんなのか、ウチのサーバのログが暴れだしたので、ちょこっと調べてみることにした。</p>
<pre>
host spamc[9130]: connect to spamd on 127.0.0.1 failed, retrying (#1 of 3): Connection refused
host spamc[9130]: connect to spamd on 127.0.0.1 failed, retrying (#2 of 3): Connection refused
host spamc[9130]: connect to spamd on 127.0.0.1 failed, retrying (#3 of 3): Connection refused
</pre>
<p>このようなログがけっこう前からあった。どうも Spamassassin が動いていないようだ。<br />
リブートしてみようと思い下記のコマンドを実行</p>
<pre>
[root@host]~# /etc/init.d/spamassassin start
spamd を起動中: child process [14793] exited or timed out without signaling production of a PID file: exit 255 at /usr/bin/spamd line 2588.
</pre>
<p>なんだか調べていったら下記のページにたどり着いた。<br />
<a href="http://www.komine.biz/modules/d3forum/index.php?topic_id=34">http://www.komine.biz/modules/d3forum/index.php?topic_id=34</a><br />
<a href="http://www.komine.biz/modules/d3forum/index.php?topic_id=34">http://www.gossamer-threads.com/lists/spamassassin/users/151177?page=last</a></p>
<p>そこでは、</p>
<blockquote><p>
Hi<br />
Just found the solution: Run the command &#8216;sa-update&#8217;<br />
Note: Found the hint, after I tried to run spamd without &#8216;&#8211;daemonize&#8217;<br />
Hope this works also for others!
</p></blockquote>
<p>と書いてあるので、下記コマンドを実行後、改めてSpamassassin を起動してみた。</p>
<pre>
[root@host]~# sa-update
[root@host]~# /etc/rc.d/init.d/spamassassin start
spamd を起動中:                                            [  OK  ]
</pre>
<p>おぉ、無事に起動した！あとはこれで様子見である。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/477/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>zshでテトリス</title>
		<link>http://hiropo.co.uk/archives/473</link>
		<comments>http://hiropo.co.uk/archives/473#comments</comments>
		<pubDate>Fri, 21 May 2010 04:02:40 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=473</guid>
		<description><![CDATA[zsh autoload -U tetris zle -N tetris bindkey '^T' tetris Control-T を押せばゲーム開始。zsh最強！ しかもちょっとキー操作が難しい。]]></description>
			<content:encoded><![CDATA[<pre>
zsh
autoload -U tetris
zle -N tetris
bindkey '^T' tetris
</pre>
<p>Control-T を押せばゲーム開始。zsh最強！<br />
しかもちょっとキー操作が難しい。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/473/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

