ploneのインストール(の前にzopeのインストール)に挫ける

自宅サーバのWebスペースに以前Xoopsを置いてなんのかんのとやっていたのだが、
しばらく弄っていない間にApacheのバージョンアップやらMySQLサーバの移動やらで
xoopsの構成がことごとく崩れ去ってしまったため、この際なのでxoops以外のCMSを使ってみることにした。


そこで目をつけたのがploneだ。Zopeを使ってCMSを構成しているらしく、
以前xoopsを使っていた時期と比べて情報も整ってきた感が強いので好都合だと言えるだろう。
portsにも載ってるし。*1


というわけで早速ploneのインストールを行った。portsからインストールすればよいので
インストール作業は至って簡単。

# cd /usr/ports/www/plone3
# make install

以上である。これでzope-2.10.5もまとめてインストールされる。ports万歳である。
だがしかし!ココからが大変である。例えばzopeをインストールした後の初期設定を行わなければならない。
zopeをインストールした際に出力されたメッセージによると……

Zope Successfull installed.

To create an instance of Zope please run
make instance

You can set the following Variables in /etc/make.conf

ZOPEINSTANCEBASE        Directory where Zope instance should go
                        (default: /usr/local/www/Zope210)
ZOPEINSTANCENAME        Default name for a new Zope instance
                        (default: none)

If you want have multiple Zope you should run
make instance INSTANCENAME=<somename>

The Instancefiles created by make instance will not be remove when the
port is deinstalled. You'll have to delete them yourself.

 ** ZEO Instances ** (Optional)
 ** Please refere to http://zope.org/Products/ZEO/ZEOFactSheet

To create a ZEO instance please run
make zeo [INSTANCENAME=<somename>]

とのことなので、

# cd /usr/ports/www/zope210
# make instance

とやって初期設定を行い、/etc/rc.confに

zope210_enable="YES"
zope210_instances="/usr/local/www/Zope210/"

上記を追記すれば自動起動化完了だ。ついでに起動も行ってしまおう。

# /usr/local/etc/rc.d/zope210 start

あとはブラウザからサーバの8080ポートに向かって接続を試みて、zopeの初期設定画面が出てくればOKだ。
ここからさらにApache2との連携を経てploneの調整を行うわけだけど……
ここで精神的に力尽きたので続きは明日。

*1:これが一番強い。xoopsがportsに載っかってくれていればまたxoopsを使ったかも

日本語ファイル名をHTTPで転送する手法を調査してみた

趣味で作成しているCGIでサーバ上に一時的に置いたファイルを
日本語名でDL出来るようにする必要があったため、色々と調べてみた。


結果、どうやらHTTPヘッダに

Content-type: application/octet-stream
Content-Disposition: inline; filename="日本語名(sjisエンコードしておく)"
Content-length: 転送するファイルサイズ

と記述してファイルを送り出してやればよいらしい。
……とはいえ、ブラウザによって文字コードによるファイル名の解釈にずれがあるようなので
一概にSJIS一本でよいというわけではないようだ。
例えばfirefoxではUTF-8の方がよいという情報も目にした……とりあえず当方の環境では
IEとfirefoxで動作が確認できたが、やっぱりUAを取得してきて
最適とされている文字コードエンコードした方がよいのかな?

メールサーバを小リニューアル

メールサーバの機能を部分的に更新した。
これまでMailbox形式だった物をMaildir形式のものに変え、
POP3だったものをIMAP4にした程度だが。
……あ、qpopperをやめてdovecotにしたなそういえば。


というわけで、1ヶ月ぶりの更新はここから始めようと思う。
うーん、記事を書く時間を割く努力をもっとしなければ。
さて、まずはMaildir形式への移行方法から。
……と言っても、postfixを導入している当サーバでは非常に簡単だ。/usr/local/etc/postfix/main.cfの……

home_mailbox = Mailbox

home_mailbox = Maildir/

に変えて終了。あとはpostfixをreloadすれば、新しくメールが配送された際に
宛先のホームディレクトリ直下にMaildirが作成される。


次。dovecotの導入……だが、別段vpopmailに対応させなければならないわけでなし、
暗号化にナーバスになるでもないのでこちらも作業は至って簡単だ。

# cd /usr/ports/mail/dovecot
# make config

(IPv6とLDAを使用しないように指定)

# make install clean
# cp -p /usr/local/etc/dovecot-example.conf /usr/local/etc/dovecot.conf

インストールを行い、設定ファイルをデフォルトからコピーした上で書き換える。

--- /usr/local/etc/dovecot.conf Fri Mar 21 15:05:22 2008
+++ /usr/local/etc/dovecot-example.conf Fri Mar 21 14:55:16 2008
@@ -47,7 +47,6 @@
 # matches the local IP (ie. you're connecting from the same computer), the
 # connection is considered secure and plaintext authentication is allowed.
 #disable_plaintext_auth = yes
-disable_plaintext_auth = no

 # Should all IMAP and POP3 processes be killed when Dovecot master process
 # shuts down. Setting this to "no" means that Dovecot can be upgraded without
@@ -76,7 +75,7 @@
 # Syslog facility to use if you're logging to syslog. Usually if you don't
 # want to use "mail", you'll use local0..local7. Also other standard
 # facilities are supported.
-syslog_facility = local0
+#syslog_facility = mail

 ##
 ## SSL settings
@@ -88,7 +87,6 @@

 # Disable SSL/TLS support.
 #ssl_disable = no
-ssl_disable = yes

 # PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
 # dropping root privileges, so keep the key file unreadable by anyone but
@@ -142,7 +140,6 @@
 # only it has access, it's used to control access for authentication process.
 # Note that this user is NOT used to access mails. <doc/wiki/UserIds.txt>
 #login_user = dovecot
-login_user = dovecot

 # Set max. process size in megabytes. If you don't use
 # login_process_per_connection you might need to grow this.
@@ -174,7 +171,6 @@

 # Greeting message for clients.
 #login_greeting = Dovecot ready.
-login_greeting = POP-Server Ready.

 # Space-separated list of elements we want to log. The elements which have
 # a non-empty variable value are joined together to form a comma-separated
@@ -215,8 +211,7 @@
 # <doc/wiki/MailLocation.txt>
 #
 #mail_location =
-#mail_location = mbox:~/mail/:INBOX=/var/mail/%u
-mail_location = maildir:~/Maildir
+mail_location = mbox:~/mail/:INBOX=/var/mail/%u

 # If you need to set multiple mailbox locations or want to change default
 # namespace settings, you can do it by defining namespace sections.
@@ -336,18 +331,14 @@
 # be done even if first_valid_uid is set to 0.
 #first_valid_uid = 500
 #last_valid_uid = 0
-first_valid_uid = 1001
-last_valid_uid = 2000

 # Valid GID range for users, defaults to non-root/wheel. Users having
 # non-valid GID as primary group ID aren't allowed to log in. If user
 # belongs to supplementary groups with non-valid GIDs, those groups are
 # not set.
 #first_valid_gid = 1
-#first_valid_gid = 0
+first_valid_gid = 0
 #last_valid_gid = 0
-first_valid_gid = 1001
-last_valid_gid = 2000

 # Maximum number of running mail processes. When this limit is reached,
 # new users aren't allowed to log in.
@@ -596,21 +587,17 @@
   # mostly intended to reduce disk I/O. With maildir it doesn't move files
   # from new/ to cur/, with mbox it doesn't write Status-header.
   #pop3_no_flag_updates = no
-  pop3_no_flag_updates = no

   # Support LAST command which exists in old POP3 specs, but has been removed
   # from new ones. Some clients still wish to use this though. Enabling this
   # makes RSET command clear all \Seen flags from messages.
   #pop3_enable_last = no
-  pop3_enable_last = no

   # If mail has X-UIDL header, use it as the mail's UIDL.
   #pop3_reuse_xuidl = no
-  pop3_reuse_xuidl = no

   # Keep the mailbox locked for the entire POP3 session.
   #pop3_lock_session = no
-  pop3_lock_session = no

   # POP3 UIDL (unique mail identifier) format to use. You can use following
   # variables:
@@ -651,14 +638,11 @@
   #  %m - number of messages (before deletion)
   #  %s - mailbox size in bytes (before deletion)
   #pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s
-  pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s

   # Workarounds for various client bugs:
   #   outlook-no-nuls:
@@ -676,26 +660,26 @@
 ## LDA specific settings
 ##

-#protocol lda {
-#  # Address to use when sending rejection mails.
-#  postmaster_address = postmaster@example.com
-#
-#  # Hostname to use in various parts of sent mails, eg. in Message-Id.
-#  # Default is the system's real hostname.
-#  #hostname =
-#
-#  # Support for dynamically loadable plugins. mail_plugins is a space separated
-#  # list of plugins to load.
-#  #mail_plugins =
-#  #mail_plugin_dir = /usr/local/lib/dovecot/lda
-#
-#  # Binary to use for sending mails.
-#  #sendmail_path = /usr/lib/sendmail
-#  sendmail_path = /usr/sbin/sendmail
-#
-#  # UNIX socket path to master authentication server to find users.
-#  #auth_socket_path = /var/run/dovecot/auth-master
-#}
+protocol lda {
+  # Address to use when sending rejection mails.
+  postmaster_address = postmaster@example.com
+
+  # Hostname to use in various parts of sent mails, eg. in Message-Id.
+  # Default is the system's real hostname.
+  #hostname =
+
+  # Support for dynamically loadable plugins. mail_plugins is a space separated
+  # list of plugins to load.
+  #mail_plugins =
+  #mail_plugin_dir = /usr/local/lib/dovecot/lda
+
+  # Binary to use for sending mails.
+  #sendmail_path = /usr/lib/sendmail
+  sendmail_path = /usr/sbin/sendmail
+
+  # UNIX socket path to master authentication server to find users.
+  #auth_socket_path = /var/run/dovecot/auth-master
+}

 # Username formatting before it's looked up from databases. You can use
 # the standard variables here, eg. %Lu would lowercase the username, %n would
@@ -858,10 +840,10 @@
   # System users (NSS, /etc/passwd, or similiar)
   # In many systems nowadays this uses Name Service Switch, which is
   # configured in /etc/nsswitch.conf. <doc/wiki/AuthDatabase.Passwd.txt>
-  passdb passwd {
+  #passdb passwd {
     # [blocking=yes] - See userdb passwd for explanation
     #args =
-  }
+  #}

   # Shadow passwords for system users (NSS, /etc/shadow or similiar).
   # Deprecated by PAM nowadays.

こんな感じ。長くなり過ぎたかな?あとは自動起動の設定を施して終了。

ngをインストールするときにやっておくと良いであろう3つの事柄

ports経由でngをインストールするときにやっておいた方が良いであろう事柄。

・/usr/ports/japanese/ng/Makefileの編集

post-patch:
        @(cd ${WRKSRC}; ${LN} -sf sys/bsd/Makefile . )
                                                  ^^^

・一旦makeしたあとで以下のファイルを編集
 /usr/ports/japanese/ng/work/ng-1.4.4/Makefile

CFLAGS  = -O2 $(CDEFS) $(CANNAINC) -fstack-protector
                                                       ^^^^^^^^^^^^^^^^^
(ProPolice/SSPパッチを適用している場合のみ)

 /usr/ports/japanese/ng/work/ng-1.4.4/config.h

#define NO_BACKUP       /* Disable backup files when writing.   */
 ^^^^^^
#define NEXTLINE 0      /* next-line-add-newlines (by S.Yoshida) */
                        ^

・/usr/ports/japanese/ng/work/ng-1.4.4/で

# make clean
# make
# cd /usr/ports/japanese/ng
# make install

Operaのウィジェットを使ってみる

というわけで、予想以上にメモリ領域が空いたので
Operaウィジェットを使ってみることにした。


高評価なウィジェットをざっと眺めたところ、
時計やなんかのガジェット類とミニゲーム系が人気なようだ。
とりあえず殺伐とした生活に一服の清涼を求めて水槽を置くことにした。
適当にプレイしているだけでも順調に魚が増えていくちょー簡単なゲームなので気楽。
あと電卓とか世界時計とかもダウンロードするだけダウンロードしてみた。まだ使っていない。

Operaの設定をチューニングする

職場でも自宅でもWebブラウザはOperaを採用しているのだが、
こいつが職場PCで稼働させている方は重くてしょうがないことがままあったので
本格的に設定をチューニングすることにした。


で。opera-wiki.com等々で情報を集めたところ、
どうやらキャッシュ周りの設定とRSSリーダの設定によってリソース(特にメモリ)が
食われるために動作が重くなる現象が確認されているらしい。
とりあえずキャッシュを全く取らないように設定を変更したところ、
消費メモリ容量が設定前の3分の1くらいまで低減した。効果覿面である。
よもやキャッシュ設定が仇になるなんて……

FFFTPの設定をチューニング(して頂く)

当サーバの利用者の中で、時折「複数ファイルをDLしている最中に途中でDLが止まる」という
問い合わせを頂くことがあった。当初はサーバ側に問題があるものと思い様々なチューニングを
施してみたものの、問題の再現率が低かったために決め手に欠き続けていた。


しかし、利用者が使っているFTPクライアントFFFTPが多かったので
ものは試しとFFFTPのQ&Aページにあった項目から
主にこれを試してもらったところ、
どうやら問題は再現せずに済んでいるようだ。


そもそも問題自体が滅多に発生しないものなのであと3ヶ月は様子を見ないとならないだろうが……。