Postfixでメール送信 & Webでプロジェクト管理

現状ではDNSの設定が有効にできないので、mailサーバ名をwww.ez-ya.jpとして動かす事を考えよう。
で、Thunderbirdにez-ya.jp用のアカウントを作成して、POPとSMTPの設定を行った。
結果、POPは特に問題なくできたのだが、SMTPでメール送信を行うために送信ボタンをおすと、
以下のログが出力されて、エラーになる。

Jul 28 11:36:41 yukikaze postfix/master[56706]: warning: process /usr/libexec/postfix/smtpd pid 15862 exit status 1
Jul 28 11:36:41 yukikaze postfix/master[56706]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
Jul 28 11:37:41 yukikaze postfix/smtpd[16315]: warning: xsasl_cyrus_server_get_mechanism_list: no applicable SASL mechanisms
Jul 28 11:37:41 yukikaze postfix/smtpd[16315]: fatal: no SASL authentication mechanisms

”no applicable SASL mechanisms”でググってみると、何となくcyrus-sasl*が足りていない様子。

 cyrus-sasl-devel       i386          2.1.22-5.el5_4.3             base              1.4 M
 cyrus-sasl-gssapi      i386          2.1.22-5.el5_4.3             base               29 k
 cyrus-sasl-ldap        i386          2.1.22-5.el5_4.3             base               24 k
 cyrus-sasl-md5         i386          2.1.22-5.el5_4.3             base               46 k
 cyrus-sasl-ntlm        i386          2.1.22-5.el5_4.3             base               32 k
 cyrus-sasl-plain       i386          2.1.22-5.el5_4.3             base               27 k
 cyrus-sasl-sql         i386          2.1.22-5.el5_4.3             base               27 k

をインストール
で、外部への送信もできるようになった。
あとは、DNSが正しく機能して、外部からのSMTPを受けられるようになればOKか。
ものは試し、big.or.jpにログインしてtelnetでメールを送ってみたら送れるじゃん!

~$ telnet www.ez-ya.jp smtp
Trying 182.163.86.27...
Connected to www.ez-ya.jp.
Escape character is '^]'.
220 mail.ez-ya.jp ESMTP Postfix
HELO big.or.jp
250 mail.ez-ya.jp
MAIL FROM:crusherk@big.or.jp
250 2.1.0 Ok
RCPT TO:kkijiya@ez-ya.jp
250 2.1.5 Ok
DATA
354 End data with .
Subject:test from big
test mail from big on telnet.
.
250 2.0.0 Ok: queued as 0632CEB980C0

500 5.5.2 Error: bad syntax
quit
221 2.0.0 Bye
Connection closed by foreign host.

受け側のログは

Jul 28 13:36:02 yukikaze postfix/smtpd[55081]: connect from big13.big.or.jp[210.197.78.113]
Jul 28 13:36:35 yukikaze postfix/trivial-rewrite[56429]: warning: do not list domain ez-ya.jp in BOTH mydestination and virtual_alias_domains
Jul 28 13:36:35 yukikaze postfix/smtpd[55081]: 0632CEB980C0: client=big13.big.or.jp[210.197.78.113]
Jul 28 13:37:22 yukikaze postfix/cleanup[56457]: 0632CEB980C0: message-id=<20100728043635.0632CEB980C0@mail.ez-ya.jp>
Jul 28 13:37:22 yukikaze postfix/qmgr[32660]: 0632CEB980C0: from=, size=394, nrcpt=1 (queue active)
Jul 28 13:37:22 yukikaze postfix/trivial-rewrite[56429]: warning: do not list domain ez-ya.jp in BOTH mydestination and virtual_alias_domains
Jul 28 13:37:22 yukikaze postfix/local[56830]: 0632CEB980C0: to=, relay=local, delay=57, delays=57/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Jul 28 13:37:22 yukikaze postfix/qmgr[32660]: 0632CEB980C0: removed
Jul 28 13:37:41 yukikaze postfix/smtpd[55081]: disconnect from big13.big.or.jp[210.197.78.113]

なんだけどgmailから送ると、User unknownで帰って来ちゃう。

The error that the other server returned was: 550 550 5.1.1 ... User unknown (state 14).

やっぱり、サーバ名が解決できないからかなぁ。

 dig mx ez-ya.jp

; <<>> DiG 9.3.2-P1 <<>> mx ez-ya.jp
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 724
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 2

;; QUESTION SECTION:
;ez-ya.jp.                      IN      MX

;; ANSWER SECTION:
ez-ya.jp.               21600   IN      MX      100 dmail90.dti.ne.jp.

;; AUTHORITY SECTION:
ez-ya.jp.               20734   IN      NS      ns21.dti.ad.jp.
ez-ya.jp.               20734   IN      NS      ns20.dti.ad.jp.

;; ADDITIONAL SECTION:
ns20.dti.ad.jp.         2976    IN      A       202.216.224.39
ns21.dti.ad.jp.         2976    IN      A       202.216.229.39

;; Query time: 20 msec
;; SERVER: 210.197.72.20#53(210.197.72.20)
;; WHEN: Wed Jul 28 13:50:27 2010
;; MSG SIZE  rcvd: 134

ああ、これだわ。MXがdmail90.dti.ne.jp.だもの。unknownになるわけだ。
MXがこれじゃ、どんな設定してもメールサーバとしては使えないじゃん。ってVPSとしての意味なくない?
って文句いおうと思って、マニュアルに”メールサーバとして使えます!”って書かれている箇所を確認しようとしていたら、http://dream.jp/vps/manual/mnl_blueonyx.html#a_02 にMXの設定方法が書かれていました。(^0^;
==============================================================================================

Web上でプロジェクトの進捗管理とかしてみたい。というわけでググってみた結果、redMineなるソフトを試してみる事に。何たってRuby on Rialsで作られているというのがうれしい。
で、VPSrubyとgemをインストール。
rubyは普通にyum install ruby
gemはrpmが無いようなので、
wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
を展開してruby setup.rbしたら、

# ruby setup.rb
ERROR:  Expected Ruby version >= 1.8.6, is 1.8.5

というわけで、

wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.5.tgz
に変更して再挑戦。

# 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

げ、何だろうrdocが要るのか?ってんんでruby-rdocをyum installして、再々挑戦

ruby setup.rb
RubyGems 1.3.5 installed
=== 1.3.5 / 2009-07-21
Bug fixes:
*1280302955* Fix use of prerelease gems.
*1280302956* Gem.bin_path no longer escapes path with spaces. Bug #25935 and #26458.
Deprecation Notices:
*1280302957* Bulk index update is no longer supported (the code currently remains, but not
  the tests)
*1280302958* Gem::manage_gems was removed in 1.3.3.
*1280302959* Time::today was removed in 1.3.3.

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

RubyGems installed the following executables:
        /usr/bin/gem

何とか入ったのかなぁ?
でgemsでRailsのインストール

 gem install rails --include-dependencies
INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.8
Successfully installed activerecord-2.3.8
Successfully installed rack-1.1.0
Successfully installed actionpack-2.3.8
Successfully installed actionmailer-2.3.8
Successfully installed activeresource-2.3.8
Successfully installed rails-2.3.8
8 gems installed
Installing ri documentation for rake-0.8.7...
Installing ri documentation for activesupport-2.3.8...
Installing ri documentation for activerecord-2.3.8...
Installing ri documentation for rack-1.1.0...
Installing ri documentation for actionpack-2.3.8...
Installing ri documentation for actionmailer-2.3.8...
Installing ri documentation for activeresource-2.3.8...
Installing ri documentation for rails-2.3.8...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for activesupport-2.3.8...
Installing RDoc documentation for activerecord-2.3.8...
Installing RDoc documentation for rack-1.1.0...
Installing RDoc documentation for actionpack-2.3.8...
Installing RDoc documentation for actionmailer-2.3.8...
Installing RDoc documentation for activeresource-2.3.8...
Installing RDoc documentation for rails-2.3.8...

redMineをDownload
wget http://rubyforge.org/frs/download.php/71723/redmine-1.0.0.tar.gz

webminでMysqlにDBとユーザを作成して権限を付与

redMineディレクトリに移動して、
vi database.ymlでユーザ名:パスワードを設定して、dbを作成しようとrakeを実行すると

rake db:migrate RAILS_ENV="production"
(in /home/kkijiya/Downloads/redmine-1.0.0)
rake aborted!
RubyGem version error: rack(1.1.0 not ~> 1.0.1)

というエラー
http://symfoware.blog68.fc2.com/blog-entry-422.html
http://d.hatena.ne.jp/dominion525/20100201/1265041052
を参考に
vi ./vendor/rails/actionpack/lib/action_controller.rb
で1.0.1を1.1.0に変更
再挑戦

rake db:migrate RAILS_ENV="production"
(in /home/kkijiya/Downloads/redmine-1.0.0)
rake aborted!
A key is required to write a cookie containing the session data. Use config.action_controller.session = { :key => "_myapp_session", :secret => "some secret phrase" } in config/environment.rb

セッションがどうのというので、前出の
http://symfoware.blog68.fc2.com/blog-entry-422.html
を参考にセッションを作成

rake config/initializers/session_store.rb
(in /home/kkijiya/Downloads/redmine-1.0.0)

で改めてrake

# rake db:migrate RAILS_ENV="production"
(in /home/kkijiya/Downloads/redmine-1.0.0)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql

(See full trace by running task with --trace)

もう、言われるがまま、gemでmysqlをインストールすると、

[root@yukikaze config]# gem install mysql
ERROR:  Error installing mysql:
        mysql requires Ruby version >= 1.8.6

でました、バージョン地獄!! ググってみたけど、みんなRubyを1.8.5以降に変更している。えー、さっきgem入れるときは1.8.5に合わせたのにぃ。

と、言う事で振り出しに戻る。

# yum erase ruby
Loaded plugins: fastestmirror
Repository 'vz-base' is missing name in configuration, using id
Repository 'vz-updates' is missing name in configuration, using id
Setting up Remove Process
Resolving Dependencies
    • > Running transaction check
      • > Package ruby.i386 0:1.8.5-5.el5_4.8 set to be erased
    • > Processing Dependency: ruby = 1.8.5-5.el5_4.8 for package: ruby-rdoc
    • > Processing Dependency: ruby = 1.8.5-5.el5_4.8 for package: ruby-irb
    • > Running transaction check
      • > Package ruby-irb.i386 0:1.8.5-5.el5_4.8 set to be erased
      • > Package ruby-rdoc.i386 0:1.8.5-5.el5_4.8 set to be erased
    • > Finished Dependency Resolution
Dependencies Resolved ===================================================================================================================================================================================== Package Arch Version Repository Size ===================================================================================================================================================================================== Removing: ruby i386 1.8.5-5.el5_4.8 installed 788 k Removing for dependencies: ruby-irb i386 1.8.5-5.el5_4.8 installed 138 k ruby-rdoc i386 1.8.5-5.el5_4.8 installed 448 k Transaction Summary ===================================================================================================================================================================================== Remove 3 Package(s) Reinstall 0 Package(s) Downgrade 0 Package(s) Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Erasing : ruby 1/3 Erasing : ruby-rdoc 2/3 Erasing : ruby-irb 3/3 Removed: ruby.i386 0:1.8.5-5.el5_4.8 Dependency Removed: ruby-irb.i386 0:1.8.5-5.el5_4.8 ruby-rdoc.i386 0:1.8.5-5.el5_4.8 Complete! [root@yukikaze Downloads]#

で、rubyを1.8.7にしてrpmを再作成するのにcheckinstallコマンドを使うらしい。
checkinstallrpmが見あたらないので、ソースをダウンロードしてmakeしたら

]# make
for file in locale/checkinstall-*.po ; do \
                case ${file} in \
                        locale/checkinstall-template.po)  ;; \
                        *) \
                                out=`echo $file | sed -s 's/po/mo/'` ; \
                                msgfmt -o ${out} ${file} ; \
                                if [ $? != 0 ] ; then \
                                        exit 1 ; \
                                fi ; \
                        ;; \
                esac ; \
        done
/bin/sh: line 5: msgfmt: command not found
make: *** [all] エラー 1

msgfmtは何に含まれているか調べたら、gettextに含まれるらしいのでyum install gettextして再度make

 make
for file in locale/checkinstall-*.po ; do \
                case ${file} in \
                        locale/checkinstall-template.po)  ;; \
                        *) \
                                out=`echo $file | sed -s 's/po/mo/'` ; \
                                msgfmt -o ${out} ${file} ; \
                                if [ $? != 0 ] ; then \
                                        exit 1 ; \
                                fi ; \
                        ;; \
                esac ; \
        done
make -C installwatch
make[1]: ディレクトリ `/home/kkijiya/Downloads/checkinstall-1.6.2/installwatch' に入ります
./create-localdecls
Checking truncate argument type... grep: /usr/include/unistd.h: そのようなファイルやディレクトリはありません
off_t
Checking readlinkat result type... grep: /usr/include/unistd.h: そのようなファイルやディレクトリはありません
int
Checking libc version... ./create-localdecls: line 47: gcc: command not found
ldd: ./libctest: そのようなファイルやディレクトリはありません
rm: cannot remove `libctest': そのようなファイルやディレクトリはありません

gcc -Wall -c -D_GNU_SOURCE -DPIC -fPIC -D_REENTRANT -DVERSION=\"0.7.0beta7\" installwatch.c
make[1]: gcc: コマンドが見つかりませんでした
make[1]: *** [installwatch.o] エラー 127
make[1]: ディレクトリ `/home/kkijiya/Downloads/checkinstall-1.6.2/installwatch' から出ます
make: *** [all] エラー 2

おお、コンパイラが入って居ないじゃない。
yum install gccする。
で、改めてmake
今度はうまくいった?っぽいので

# checkinstall

checkinstall 1.6.2, Copyright 2009 Felipe Eduardo Sanchez Diaz Duran
           このソフトウェアはGNU GPLの下でリリースしています。

The checkinstallrc file was not found at:
/usr/local/sbin/../checkinstallrc

デフォルトの内容を使うものとします

The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs?  [y]: y

パッケージのドキュメンテーションを準備..OK

使用するパッケージ方式を選んでください。
Slackwareなら[S], RPMなら[R], Debianなら[D]を入力R


このパッケージの説明を書いてください
説明の末尾は空行かEOFにしてください。
>> ruby 1.8.7
>>

**************************************
**** RPM package creation selected ***
**************************************

このパッケージは以下の内容で構成されます:

1 -  Summary: [ ruby 1.8.7 ]
2 -  Name:    [ ruby-1.8.7 ]
3 -  Version: [ p299 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ ruby-1.8.7-p299 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ ruby-1.8.7 ]

変更するものの番号を入力してください。Enterで続行します: 3
バージョンを入力:
>> 1.8.7

このパッケージは以下の内容で構成されます:

1 -  Summary: [ ruby 1.8.7 ]
2 -  Name:    [ ruby-1.8.7 ]
3 -  Version: [ 1.8.7 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ ruby-1.8.7-p299 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ ruby-1.8.7 ]

変更するものの番号を入力してください。Enterで続行します: 11
提供するものを入力:
>> ruby

このパッケージは以下の内容で構成されます:

1 -  Summary: [ ruby 1.8.7 ]
2 -  Name:    [ ruby-1.8.7 ]
3 -  Version: [ 1.8.7 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ Applications/System ]
7 -  Architecture: [ i386 ]
8 -  Source location: [ ruby-1.8.7-p299 ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Provides: [ ruby ]

変更するものの番号を入力してください。Enterで続行します:

Installing with make install...

========================= インストールの結果 ===========================
./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./instruby.rb --make="make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc"
installing binary commands
/home/kkijiya/Downloads/ruby-1.8.7-p299/lib/fileutils.rb:846:in `utime': No such file or directory - /usr/bin/ruby (Errno::ENOENT)
        from /home/kkijiya/Downloads/ruby-1.8.7-p299/lib/fileutils.rb:846:in `install'
        from /home/kkijiya/Downloads/ruby-1.8.7-p299/lib/fileutils.rb:1397:in `fu_each_src_dest'
        from /home/kkijiya/Downloads/ruby-1.8.7-p299/lib/fileutils.rb:1411:in `fu_each_src_dest0'
        from /home/kkijiya/Downloads/ruby-1.8.7-p299/lib/fileutils.rb:1395:in `fu_each_src_dest'
        from /home/kkijiya/Downloads/ruby-1.8.7-p299/lib/fileutils.rb:841:in `install'
        from ./instruby.rb:133:in `install'
        from ./instruby.rb:230
        from ./instruby.rb:404:in `call'
        from ./instruby.rb:404
        from ./instruby.rb:401:in `each'
        from ./instruby.rb:401
        from ./instruby.rb:397:in `each'
        from ./instruby.rb:397
make: *** [do-install-nodoc] エラー 1

****  インストールは失敗しました。パッケージの作成を中断します

クリーンアップ..OK

Bye.

なんなんだぁ!!rubyでエラーがぁ!!!orz