玄箱 Debian で WebMail[SquirrelMail編]

メモ:  Category:kuro_box

Debian化した玄箱に、WebMailが使用できる環境を構築したいと思います。

玄箱の環境は、exim4 , dovecot ,(fetchmail,procmail)です。

構築イメージ

WebMailの候補としては、SquirrelMail , IlohaMail , IMP , RoundCube などがありますが 今回はGoogleで最も多くヒットしたSquirrelMailを使用してみます。

(SquirrelMailは、スクイリルメールと読むそうです。)

玄箱にSquirrelMailをインストール

apt-getを使ってSquirrelMailをインストールします。

# apt-get update
# apt-get install squirrelmail
パッケージリストを読みこんでいます... 完了
依存関係ツリーを作成しています... 完了
以下の特別パッケージがインストールされます:
  apache2-mpm-prefork libapache2-mod-php4 libbz2-1.0 libzzip-0-12 php4-common
  squirrelmail-locales
提案パッケージ:
  php4-pear libbz2-dev bzip2 imapproxy
推奨パッケージ:
  ispell aspell aspell-bin
以下のパッケージは「削除」されます:
  apache2-mpm-worker
以下のパッケージが新たにインストールされます:
  apache2-mpm-prefork libapache2-mod-php4 libbz2-1.0 libzzip-0-12 php4-common
  squirrelmail squirrelmail-locales
アップグレード: 0 個、新規インストール: 7 個、削除: 1 個、保留: 5 個。
6674kB のアーカイブを取得する必要があります。
展開後に追加で 22.7MB のディスク容量が消費されます。
続行しますか? [Y/n]


squirrelmail-locales (1.4.4-20050308-1) を設定しています ...
squirrelmail (1.4.4-8) を設定しています ...
Installing default squirrelmail config.
Run /usr/sbin/squirrelmail-configure as root to configure/upgrade config.

squirrelmailのインストールは、とても簡単にできます。

squirrelmailの設定

インストールの完了時に「Run /usr/sbin/squirrelmail-configure as root to configure/upgrade config.」 と言われるので、squirrelmail-configureを実行して環境設定をします。

# /usr/sbin/squirrelmail-configure

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >>

SquirrelMailに表示される組織名の設定

初期値では、組織名がSquirrelMailに設定されています。必要な場合、次のように設定します。

Main Menuで「1」を選択します。

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Organization Preferences
1.  Organization Name      : SquirrelMail
2.  Organization Logo      : ../images/sm_logo.png
3.  Org. Logo Width/Height : (308/111)
4.  Organization Title     : SquirrelMail $version
5.  Signout Page           :
6.  Top Frame              : _top
7.  Provider link          : http://www.squirrelmail.org/
8.  Provider name          : SquirrelMail

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >>

「1」を選択して組織名を変更します。(例:bnote)

We have tried to make the name SquirrelMail as transparent as
possible.  If you set up an organization name, most places where
SquirrelMail would take credit will be credited to your organization.

If your Organization Name includes a '$', please precede it with a \.
Other '$' will be considered the beginning of a variable that
must be defined before the $org_name is printed.
$version, for example, is included by default, and will print the
string representing the current SquirrelMail version.

[bnote]: bnote

SquirrelMailの言語を設定する

SquirrelMailで使用する言語の初期値を設定します。MainMenuで「10」と入力し言語設定 メニューへ遷移します。

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Language preferences
1.  Default Language       : en_US
2.  Default Charset        : iso-8859-1
3.  Enable lossy encoding  : false

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >>

「1」を選択し、Default Languageを設定します。

Command >> 1

SquirrelMail attempts to set the language in many ways.  If it
can not figure it out in another way, it will default to this
language.  Please use the code for the desired language.

[en_US]: ja_JP

「2」を選択し、Default Charsetを設定します。

Command >> 2

This option controls what character set is used when sending
mail and when sending HTML to the browser.

This option is used only when default language is 'en_US'.

[iso-8859-1]: iso-2022-jp

SquirrelMailのバージョンを非表示にする

MainMenuで「4」と入力しGeneral Optionsメニューへ遷移します。

Command >> 4

SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
General Options
1.  Data Directory              : /var/lib/squirrelmail/data/
2.  Attachment Directory        : /var/spool/squirrelmail/attach/
3.  Directory Hash Level        : 0
4.  Default Left Size           : 150
5.  Usernames in Lowercase      : false
6.  Allow use of priority       : true
7.  Hide SM attributions        : false
8.  Allow use of receipts       : true
9.  Allow editing of identity   : true/true
10. Allow server thread sort    : false
11. Allow server-side sorting   : false
12. Allow server charset search : true
13. Enable UID support          : true
14. PHP session name            : SQMSESSID

R   Return to Main Menu
C   Turn color on
S   Save data
Q   Quit

Command >>

Hide SM attributionsを選択しtrueへ変更します。

Command >> 7
Hide SM attributions (y/n) [n]:y

Apacheの設定

ApacheのDocumentRootにSquirrelMail用のディレクトリを作成します。

# cd /mnt/public_html
# mkdir squirrelmail

/etc/apache2/sites-available/以下のサイト定義ファイルに(例えば、defult)に以下の設定を追加します。

Alias /squirrelmail/ "/usr/share/squirrelmail/"
<Directory "/usr/share/squirrelmail">
    Options Indexes FollowSymLinks
</Directory>

ここまで設定したら動作確認をしてみます。外部のブラウザなどから http://192.168.1.xxx/squirrelmail/src/configtest.php として設定を確認します。

外部公開した場合、このconfigtest.phpが見えてしまうのは気持ちがよくないのでApacheの設定を変更します。

Alias /squirrelmail/ "/usr/share/squirrelmail/"
<Directory "/usr/share/squirrelmail">
    Options Indexes FollowSymLinks
    <Files configtest.php>
        order deny,allow
        deny from all
        allow from 192.168.1.
    </Files>
</Directory>

bluenote by BBB