<?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, 06 Feb 2012 05:45:41 +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>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>
		<item>
		<title>fedora13 がもうすぐリリース！</title>
		<link>http://hiropo.co.uk/archives/461</link>
		<comments>http://hiropo.co.uk/archives/461#comments</comments>
		<pubDate>Mon, 10 May 2010 02:11:55 +0000</pubDate>
		<dc:creator>hirohi</dc:creator>
				<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://hiropo.co.uk/?p=461</guid>
		<description><![CDATA[公式サイトに行ったら上のタグがあったので貼ってみた。]]></description>
			<content:encoded><![CDATA[<p><script id="fedora-banner" type="text/javascript" src="http://fedoraproject.org/static/js/release-counter-ext.js?lang=ja"></script></p>
<p>公式サイトに行ったら上のタグがあったので貼ってみた。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/461/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>hirohi</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 で、下記のようなエラーが出ていた。 1. File system error. Filename: /var/lib/xen/images/CentOS5.img Val &#8230; <a href="http://hiropo.co.uk/archives/447">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>あるサーバを管理しているのだが、Tripwire で、下記のようなエラーが出ていた。</p>
<pre>
1.   File system error.
     Filename: /var/lib/xen/images/CentOS5.img
     Value too large for defined data type
</pre>
<p>ファイルサイズがでかすぎるんだよ！って怒られた。</p>
<p>ググってみたら、ファイルサイズが 2G を越えているのが原因らしい。 UNIX では「2G の壁」というものが存在しているようで、これは lseek() など、ファイル内の読み出し位置を移動する関数に与えるオフセット値が伝統的に signed long であるためらしい（もうよくわからん）。<br />
signed long では 2147483647 、要するに 2G バイトまでしか表現できないので、これを越えると単に fseek()に渡せないだけでなく、 内部の位置計算処理に多大な混乱が起こる（ということらしい）。ちなみに相対位置指定のために負の値も必要（だそうです）。</p>
<p>いろいろとめんどくさいのねー。もう1TBとかが当たり前の時代ですのに。</p>
<p>さて、解決方法である。<br />
Tripwireのファイルチェックをスキップしてしまえばよいのである。</p>
<pre>
#ポリシーファイル（テキスト版）の復元
[root@host ~]# twadmin -m p -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key &gt; /etc/tripwire/twpol.txt
[root@host ~]# vi /etc/tripwire/twpol.txt
  ################################################
 #                                              ##
################################################ #
#                                              # #
#  Monitor Filesystems                         # #
#                                              ##
################################################
(
  rulename = &quot;Monitor Filesystems&quot;,
)
{
  /                             -&gt; $(ReadOnly) ;
  /home                         -&gt; $(ReadOnly) ;  # Modify as needed
  /usr                          -&gt; $(ReadOnly) ;
  /var                          -&gt; $(ReadOnly) ;
  !/var/lib/xen/images;   #&lt;- 追加
}

#ポリシーファイル（暗号署名版）を作成
[root@host ~]# twadmin -m P -c /etc/tripwire/tw.cfg -p /etc/tripwire/tw.pol -S /etc/tripwire/site.key /etc/tripwire/twpol.txt
Please enter your site passphrase:     #&lt;- サイトパスフレーズ応答

#ポリシーファイル（テキスト版）削除
[root@host ~]# rm -f /etc/tripwire/twpol.txt

#データベース初期化
[root@host ~]# tripwire -m i -s -c /etc/tripwire/tw.cfg
Please enter your local passphrase:     #&lt;- ローカルパスフレーズ応答
</pre>
<p>他にも動画ファイルを保存していたりなどで2GB超えてしまうファイル群を格納しているディレクトリがあったら、そこを登録しておいても良いと思う。</p>
]]></content:encoded>
			<wfw:commentRss>http://hiropo.co.uk/archives/447/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

