«前の日記(Thursday 05 August, 2010 ) 最新 次の日記(Saturday 07 August, 2010 )» 編集

ここに日記はありません


Friday 06 August, 2010 [長年日記]

_ [BSD][Mac] MacOS Xをサーバーにする (1)

これまで職場でFreeBSD機を勝手鯖として立ち上げて、主にメールの送受信およびファイルサーバーを目的として使用してきた。ファイルサーバーとしてはsambaおよびnetatalkを使って、MS-WindowsおよびMacから同じようにアクセスできるようにしてきたが、職場の環境も整ってきたので個人的にファイルサーバを動かす意味が無くなってきた。メールについては、外部からの接続も考えて$HOMEにメールをMH形式でおいて、Emacs+Wnderlust+fetchmail+Procmailという環境で読むことをしてきたが、先日メールをMaildir形式に変更してIMAPサーバーを導入したのでEmacs+Wanderlustの代わりにMacOS X上でMail.appを使うことが多くなった。ということでよくよく考えてみるとメイン機のMacOS X上でIMAPサーバーを動かせられれば勝手鯖を使わずに済むということになる。

_ [BSD][Mac] lvのインストール

とりあえず手始めにFreeBSD上でlessの代わりに使ってきたlvがMacOS Xに入っていないのでインストールすることにする。このページを参考にした。

LV Homepageからlv v.4.51を取得して展開した。READMEによると

INSTALLATION:

0) Expand lv archive, using gunzip/tar.
1) Change your working directory to ``(extracted sub directory)/build''.
2) Execute ``../src/configure'' to configure compiler flags.
3) Launch ``make''.
4) Then, launch ``make install'' as root.
ということなので、
$ cd lv451/
$ cd build
$ ../src/configure 
creating cache ./config.cache
checking whether ln -s works... yes
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for a BSD compatible install... (cached) /usr/bin/install -c
checking how to run the C preprocessor... (cached) gcc -E
checking whether make sets ${MAKE}... (cached) yes
checking for perl... (cached) /usr/bin/perl
checking if --enable-purify is specified... no
checking for tgetstr in -lterminfo... (cached) no
checking for tgetstr in -ltermcap... (cached) yes
checking for ANSI C header files... (cached) yes
checking for sys/wait.h that is POSIX.1 compatible... (cached) yes
checking for fcntl.h... (cached) yes
checking for sys/ioctl.h... (cached) yes
checking for sys/time.h... (cached) yes
checking for termio.h... (cached) no
checking for unistd.h... (cached) yes
checking for termios.h... (cached) yes
checking for locale.h... (cached) yes
checking for sigvec... (cached) yes
checking for tgetnum... (cached) yes
checking for setlocale... (cached) yes
checking whether getpgrp takes no argument... (cached) yes
checking whether gcc needs -traditional... (cached) no
checking return type of signal handlers... (cached) void
checking for nl_langinfo and CODESET... (cached) yes
creating ./config.status
creating Makefile
$ make
(略)
$ sudo make uninstall
Password:
$ 
で無事に終了した。

_ [BSD][Mac] fetchmailのインストール

次にメールをメールサーバから取り込むためにfetchmailをインストールした。http://fetchmail.berlios.de/からfetchmail-6.3.17.tar.bz2を取得した。

$ bzcat fetchmail-6.3.17.tar.bz2 | tar xf -
$ cd fetchmail-6.3.17/
$ sh ./configure
$ make
$ sudo make install

_ [BSD][Mac] procmailのインストール

取り込んだメールを条件に応じて振り分けするためにprocmailをインストールした。http://www.procmail.org/から procmail-3.22.tar.gz を取得した。

$ tar zxf procmail-3.22.tar.gz 
$ cd procmail-3.22/
$ make
$ sudo make install

_ [BSD][Mac] MacOS Xをサーバーにする (2)

MacOS XにUNIX系のサービスを追加した時に自動起動にするにはどうしたらいいのか。

このへんが参考になりそう。

_ [BSD][Mac] Courier-imap on MacOS X (1)

MacOS XにIMAPサーバーをインストールする。FreeBSDで使っていたのと同じCourier-imapを使うことにして、courier-imap-4.8.0.20100628.tar.bz2を落としてきた。
$ bzcat courier-imap-4.8.0.20100628.tar.bz2 | tar xf -
$ cd courier-imap-4.8.0.20100628/
$ lv INSTALL
ということでDocumentを見ると、
Requirements

Now is the good time to read the FAQ, before you start. The FAQ is located
in the file imap/FAQ(.html?).

*?C++ compiler - A C++ compiler is required. The server is written in C,
but there are some configuration scripts that use C++ code.
*?make - The GNU make is recommended. Solaris's make is to be avoided.
xBSD already has a gmake port, install it and use it (use gmake
everywhere this document refers to make).
*?GDBM/DB - either the GDBM or the Berkeley DB library is required.
*?The GNU IDN library (http://www.gnu.org/software/libidn/).
*?Gamin (http://www.gnome.org/~veillard/gamin/) or FAM
(http://oss.sgi.com/projects/fam/) -- either one -- is optional. If
Gamin or FAM is installed, it is used for an enhanced IMAP IDLE
implementation that provides real-time folder status updates to
concurrent IMAP clients that have the same folder opened.
*?The Courier authentication library. Before installing Courier-IMAP,
download and install http://www.courier-mta.org/authlib/.
というように、Courier authentication libraryが必要だと書いているので、同じところからcourier-authlib-0.63.0.tar.bz2を取ってきた。
$ bzcat courier-authlib-0.63.0.tar.bz2 | tar xf -
$ cd courier-authlib-0.63.0/
$ sh ./configure
$ make
$ sudo make install
と定石通りにインストールした。

_ [BSD][Mac] Courier-imap on MacOS X (2)

Courier authentication library のインストールが終わったので、Courier-imapのインストールに戻る。
$ cd courier-imap-4.8.0.20100628
$ sh ./configure
$ make
とconfigureがうまくいったのでmakeしてみたが、
mv -f .deps/testlookup.Tpo .deps/testlookup.Po
/bin/sh ./libtool --tag=CC   --mode=link gcc  -g -O2 -Wall -I./.. -I.. -static  -o testlookup testlookup.o librfc1035.a ../soxwrap/libsoxwrap.a ../md5/libmd5.la ../random128/librandom128.la `cat ../soxwrap/soxlibs.dep` 
libtool: link: gcc -g -O2 -Wall -I./.. -I.. -o testlookup testlookup.o  librfc1035.a ../soxwrap/libsoxwrap.a ../md5/.libs/libmd5.a ../random128/.libs/librandom128.a
Undefined symbols:
  "_rfc1035_default_resolver", referenced from:
      _rfc1035_default_resolver$non_lazy_ptr in testlookup.o
      _rfc1035_default_resolver$non_lazy_ptr in librfc1035.a(spf.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[3]: *** [testlookup] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
というエラーになってしまった。検索してみると古いバージョンのcourier-imapを使うといいというような記述があったが、もう少し調べてみることにして今日はここまで。

ENOTECA Online(ワイン通販 エノテカ・オンライン) 29980円パソコン工房
リンクシェア アフィリエイト紹介プログラム