インストール+活用メモ

このメモのネットワーク設定は以下の図です。ISPは YahooBB です。



RPM パッケージの情報を知る

rpm -qa

BIND の RPM パッケージが入っているかを調べるには、

rpm -qa | grep bind

のようにする。

インストール先を確認するには、以下のように行う。
たとえば、パッケージ名が hogehoge の場合

rpm -qs hogehoge

RPM パッケージをインストール/アンインストールする

rpm -ivh fooinstall.rpm 

rpm -e fooerase.rpm



apt-get update
apt-get install kernel-headers kernel-doc kernel-source

Vine Linux でエプソンのプリンターを使う

http://www.epkowa.co.jp/linux/index.html

runlevel を変更する

インストールしたときに、グラフィカルログインを選ぶと、runlevel というものが
自動的に 5 となります。これをテキストログインにしたい場合は、 /etc/inittab を編集します。

id:5:initdefault:


id:3:initdefault:

とします。

仮想コンソールの数を減らす

/etc/inittab を編集する。(tty2〜tty6 をコメントアウト)

# Run gettys in standard runlevels
1:2345:respawn:/sbin/mingetty tty1
#2:2345:respawn:/sbin/mingetty tty2
#3:2345:respawn:/sbin/mingetty tty3
#4:2345:respawn:/sbin/mingetty tty4
#5:2345:respawn:/sbin/mingetty tty5
#6:2345:respawn:/sbin/mingetty tty6

ブートフロッピーを作成する

使用しているカーネルの名前を調べる

# ls /lib/modules
2.2.20-0vl10  2.4.19-0vl11smp

smp カーネルを使用しているので、2.4.19-0vl11smp で作成します。

# mkbootdisk 2.4.19-0vl11smp

参考: http://www.atmarkit.co.jp/flinux/rensai/linuxtips/041mkbootfd.html

dhcp サーバーをインストールする (dhcpd)

パッケージを取得する。

rpm -ivh dhcp-2.0pl5-6vl1.i386.rpm 

vi /etc/dhcpd.conf

option domain-name "nakifumi.com";
option domain-name-servers 192.168.0.1;
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option netbios-name-servers 192.168.0.1;
default-lease-time 600;
max-lease-time 7200;

subnet 192.168.0.0 netmask 255.255.255.0 {
 
 host venus {
   hardware ethernet xx:xx:xx:xx:xx:xx;
   fixed-address 192.168.0.150;
 }
 range 192.168.0.100 192.168.0.119;
}

デバイス eth1  のみを対象としたいので /etc/sysconfig/dhcpd に以下を設定します。

DHCPDARGS=eth1

起動します。

/etc/rc.d/init.d/dhcpd
 
ブート時に自動実行したいので対応するランレベル(今回は3)の設定を変更します。

/etc/rc.d/rc3.d/K35dhcpd というファイルがあるので。

mv /etc/rc.d/rc3.d/K35dhcpd /etc/rc.d/rc3.d/S35dhcpd 

として先頭をSとします。(「S」とすると自動実行対象になるらしい ...) 

SSH の設定 (OpenSSH)

パッケージを取得する。 OpenSSH のホームはここ

openssh-3.4p1-0vl2.i386.rpm
openssh-askpass-3.4p1-0vl2.i386.rpm
openssh-askpass-gnome-3.4p1-0vl2.i386.rpm
openssh-clients-3.4p1-0vl2.i386.rpm
openssh-server-3.4p1-0vl2.i386.rpm

上から順番に rpm -ivh *.rpm インストールする。
設定ファイルは /etc/ssh/sshd_config です。

/sbin/service sshd start
/sbin/service sshd stop
/sbin/service sshd restart



DNS キャッシュを設定する

パッケージを取得する。(bind は、セキュリティホールの関係で頻繁に更新されるので随時チェックを!)

bind-8.3.1-0vl2.i386.rpm
bind-devel-8.3.1-0vl2.i386.rpm
bind-utils-8.3.1-0vl2.i386.rpm

上から順番に rpm -ivh *.rpm インストールする。

DNS が参照するファイルには、以下のものがあります。

ファイル名
主な機能
/etc/resolve.conf
名前解決の順序を設定
/etc/named.conf
bind の設定ファイル
/var/named/named.ca
キャッシュ。最新のルートファイルをもってくる。(named.ca にコピーするなりする)
/var/named/named.local
キャッシュ。たぶん特になにもしなくて良い?
/var/named/named.zone
ローカル用設定ファイル。名前からIPアドレスを引くため
/var/named/named.rev
ローカル用設定ファイル。IPアドレスから名前の逆引を行うため

/etc/resolve.conf
search nakifumi.com
nameserver 127.0.0.1

/etc/named.conf
// 検索を許可する端末
acl allowed-hosts{
        192.168.0.0/24;
        localhost;
};
options {
        directory "/var/named";
        // プロバイダのDNS
        forwarders{
                xxx.xxx.xxx.xxx; 
                xxx.xxx.xxx.xxx;
        };
        allow-transfer{
                allowed-hosts;
        };
        allow-query{
                allowed-hosts;
        };
};
zone "." {
        type hint;
        file "named.ca";
};
zone "nakifumi.com" {
        type master;
        file "named.zone";
        allow-query{
                allowed-hosts;
        };
};
zone "0.0.127.in-addr.arpa" {
        type master;
        file "named.local";
};
zone "0.168.192.in-addr.arpa" {
        type master;
        file "named.rev";
        allow-query{
                allowed-hosts;
        };
};

/var/named/named.zone
; Written by Nakamura at 2003/04/17
;
; DNSサーバの名前、サーバの管理者のメールアドレス
@               IN      SOA hydra.nakifumi.com. root.hydra.nakifumi.com. (
                        2003041900 ; serial  連続番号変更時は以前より大きく
                        43200      ; refresh
                        3600       ; retry
                        3600000    ; expire
                        360000     ; default_ttl
                        )
                  ; DNS サーバを指定する
          IN    NS      hydra.nakifumi.com.
          ; メールサーバの名前を指定する
                  ;IN    MX      10      hydra.nakifumi.com.
;
; localhosts
;
localhost       IN      A       127.0.0.1
loghost         IN      CNAME   localhost.
;
;
; local ネットワーク内の端末名を列記する
;
hydra           IN      A       192.168.0.1
venus           IN      A       192.168.0.150

;
; 別名を定義する
dns             IN      CNAME   hydra.nakifumi.com.
www             IN      CNAME   hydra.nakifumi.com.

/var/named/named.rev
;
; named.rev Written By Nakamura at 2003/04/17
;
@               IN      SOA  hydra.nakifumi.com  root.hydra.nakifumi.com. (
                        2003041800 ; serial 連続番号変更時は以前より大きく
                        43200      ; refresh
                        3600       ; retry
                        3600000    ; expire
                        360000     ; default_ttl
                        )
@               IN      NS      hydra.nakifumi.com.
@               IN      PTR     nakifumi.com.
;
; Other Hosts
;
1               IN      PTR     hydra.nakifumi.com.
150             IN      PTR     venus.nakifumi.com.

このままでは、再起動した場合に named が起動されないので設定を確認します。
起動時の runlevel は、3 なので /etc/rc.3 にある S45named を S46named にします。

なぜ46にするかは、すでに45があるためで、重複しないようにするためです。

TCP Wrapper

TCP Wrapper によって、ネットワークからのサービスの許可/禁止を制御できます。
基本的に全てを禁止にしてから、必要なものだけを許可していく設定にします。

/etc/inetd.conf
/etc/hosts.allow 
/etc/hosts.deny

vi /etc/inetd.conf
ssh stream tcp nowait root /usr/sbin/tcpd sshd -i

vi /etc/hosts.deny (全てを禁止!)
ALL: ALL

vi /etc/hosts.allow (家庭内LANからは全て許可にして、隠してあるが sshd は会社の gateway からのみ許可)
ALL : 192.168.0.0/255.255.255.0
ALL : 127.0.0.1
sshd: x.x.x.x

以下のコマンドで再起動して設定が変更されます。
/etc/rc.d/init.d/inet restart

Linux をルーター代わりに使う

貧乏でルーターが買えないので(笑)、今あるマシンにルーターをさせます。
(出来れば、YAMAHA の RTA56v が欲しいのですが)

Kernel 2.4 系のみ対応してます。使用ディストリビューションは、Vine Linux 2.6r1 です。
(iptables に対応しているのが、Kernel 2.4 以降なので)
家庭内のLANに接続しているインターフェイスは、eth1 で、外向き(ADSL モデム接続)は、eth0 としています。

echo 1 > /proc/sys/net/ipv4/ip_forward
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# FinalFantasy XI
/sbin/iptables -t nat -A PREROUTING -p tcp --dport 1100:2000 -i eth0 -j DNAT --to 192.168.0.150

DDNS (Dynamic DNS) を使う

DDNS を使っても独自のドメイン名は使えないものだと思っていたが、使えることが判明。
さっそく、ドメインをとってやってみることにした。

参考:Katsuyuki Kobayashi's HomePage (http://www.kkoba.com/)

1.ドメインをとる

何社か調べましたが、有名なので、お名前.com にきめました。
複数年も考えましたが、とりあえず様子見と思い、単年度の契約をしました。¥4,200 +消費税でした。

取得したドメイン名は、nakifumi.com (ちょっと恥ずかしいかもw)
(4月17日現在のこと)

2.HN.ORG を使う

DDNS のサービスとして HN.ORG を使うことにしました。
  1. hn.org (http://hn.org/)Vanity Dynamic DNS (画面の左側)の Create an Account でアカウントを新規作成します。ここでアカウントが20,000までしか作れない制限がかけてあるので、画面の上部左側の Vanity Accts: 20,000 となっているのが、減るのを待ちます(^_^;)
  2. IPアドレスの更新ツールとして、hn.org が提供しているプログラムを使用します。http://hn.org/downloads/clients/ から各OSに対応した物を取得します。VineLinux なので Unix 用となる Perl スクリプトを取得しました。動作させるには、別に MIME/Base64.pmが必要です。そのままだと動かないようなので、root になってから  perl -MCPAN -e 'install MIME::Base64'  でインストールします。
  3. hn.org で設定

 hn.org setting

    D. hn.org から ip アドレス変更用のスクリプトを取得します。
    UNIX 用は、Perl スクリプトで作成してある hammnernode.pl です。
    ユーザーアカウントとパスワードを設定して、cron で自動起動させます。

         パスワードがばればれなので、chmod 700 あたりで自分しか見れないようにしましょう。

Windows とファイルを共有する(Samba)

日本 Samba ユーザー会から最新の日本語版 samba を取得する。2003/4/17 現在の最新は、 Samba 2.2.7b 日本語版リリース1.0 です。

rpm -ivh samba-2.2.7b.ja-1.0vl1.i386.rpm

参考:
Samba 2.2とLinux (Kernel 2.4) によるWindowsネットワーク構築ガイド

rpm をインストールしようとすると「〜の欠如」がどうのこうの。ようするになんか足りないらしい。
(何が足りないのかは忘れました ...)

2003/6/7 追記
libcups.so.2 が依存しているとか。

面倒なので、ソースからコンパイルしてインストールした。

上記の samba サイトからソース(samba-2.2.7a-ja-1.0.tar.gz)を取得した。
以下のようにコンパイルをした。

# ./configure --prefix=/usr --localstatedir=/var --with-lockdir=/var/lock/samba \
               --libdir=/etc/samba --with-configdir=/etc/samba \
               --with-privatedir=/etc/samba --with-codepagedir=/usr
/share/samba/codepages \
               --with-fhs --with-sambabook=/usr/share/swat/using_samba \
               --with-swatdir=/usr/s
hare/swat --with-quotas --with-syslog --with-utmp \
               --with-msdfs  --with-vfs --with-i18n-swat --with-p
am --with-pam_smbpass
# make
# make install

設定ファイル(/etc/samba/smb.conf)は以下の設定した。

[global]
    workgroup = WORKGROUP
    # server string is the equivalent of the NT Description field
    server string = hydra

    ; hosts allow = 192.168.1. 192.168.2.0./24 192.168.3.0/255.255.255.0 127.0.0.1
        hosts allow = 192.168.0. 127.0.0.1

    # Uncomment this if you want a guest account, you must add this to /etc/passwd
    # otherwise the user "nobody" is used
    ; guest account = pcguest

    # this tells Samba to use a separate log file for each machine
    # that connects
    log file = /usr/local/samba/var/log.%m

     log level = 1

    # Put a capping on the size of the log files (in Kb).
    max log size = 50

    # Security mode. Most people will want user level security. See
    # security_level.txt for details.
    security = share

    ;   include = /usr/local/samba/lib/smb.conf.%m

    socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

    ;   interfaces = 192.168.12.2/24 192.168.13.2/24

    # Should smbd report that it has MS-DFS Capabilities? Only available
    # if --with-msdfs was passed to ./configure
    ; host msdfs = yes

## Network Browsing

    # set local master to no if you don't want Samba to become a master
    # browser on your network. Otherwise the normal election rules apply
        local master = yes

    # OS Level determines the precedence of this server in master browser
    # elections. The default value (20) should be reasonable
    ; os level = 20

    # Domain Master specifies Samba to be the Domain Master Browser. This
    # allows Samba to collate browse lists between subnets. Don't use this
    # if you already have a Windows NT domain controller doing this job
    ; domain master = yes

    # Preferred Master causes Samba to force a local browser election on startup
    # and gives it a slightly higher chance of winning the election
    ; preferred master = yes

## WINS & Name Resolution

    ; wins support = yes
    ; wins server = w.x.y.z
    ; wins proxy = yes
    dns proxy = no

## Passwords & Authentication

    # Use password server option only with security = server
    # The argument list may include:
    #   password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
    # or to auto-locate the domain controller/s
    ;   password server = *
    ;   password server = <NT-Server-Name>

    encrypt passwords = yes
    ; obey pam restrictions = yes

    # When using encrypted passwords, Samba can synchronize the local
    # UNIX password as well.  You will also need the "passwd chat" parameters
    ; unix password sync = yes

    # how should smbd talk to the local system when changing a UNIX
    # password?  See smb.conf(5) for details
    ; passwd chat = <custom chat string>

    # This is only available if you compiled Samba to include --with-pam
    # Use PAM for changing the password
    ; pam password change = yes

## Domain Control

    ;   domain logons = yes
    ; logon script = %m.bat
    ; logon script = %U.bat
    ; logon path = \\%L\Profiles\%U

    # UNC path specifying the network location of the user's home directory
    # only used when acting as a DC for WinNT/2k/XP.  Ignored by Win9x clients
    ; logon home = \\%L\%U

    # What drive should the "logon home" be mounted at upon login ?
    # only used when acting as a DC for WinNT/2k/XP.  Ignored by Win9x clients
    ; logon drive = H:

## Printing

    # If you want to automatically load your printer list rather
    # than setting them up individually then you'll need this
    load printers = yes

    ; printcap name = /etc/printcap
    ; printcap name = lpstat
    ; printing = bsd
    ; disable spoolss = yes
    ; printer admin = root, +ntadmin

## Winbind

    ; winbind uid = 10000-65000
    ; winbind gid = 10000-65000
    ; winbind template homedir = /home/%D/%U
    ; winbind template shell = /bin/sh
    ; winbind separator = +

#============================ Share Definitions ==============================
[homes]
     comment = Home Directories
     browseable = no
     writable = yes
     valid users = %S

[web]
     comment = Web Directory
     path = /usr/local/apache2/htdocs
     browseable = yes
     writeable = yes
     guest ok = yes

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
;    comment = Network Logon Service
;    path = /usr/local/samba/lib/netlogon
;    guest ok = yes
;    writable = no
;    share modes = no


# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
;[Profiles]
;    path = /usr/local/samba/profiles
;    browseable = no
;    guest ok = yes


# NOTE: If you have a BSD-style print system there is no need to
# specifically define each individual printer
[printers]
   comment = All Printers
   path = /usr/spool/samba
   browseable = no
   # Set public = yes to allow user 'guest account' to print
   guest ok = no
   writable = no
   printable = yes

[tmp]
   comment = Temporary file space
   path = /tmp
   read only = no
   public = yes

/etc/inetd.conf に追加
netbios-ssn stream tcp nowait     root /usr/sbin/smbd smbd
netbios-ns  dgram  udp wait       root /usr/sbin/nmbd nmbd
swat        stream tcp nowait.400 root /usr/sbin/swat swat

inetd の再起動
# /sbin/service inet reload

security を user にした場合などは、smbpasswd -a $USERID などでユーザーを追加しておく必要がある。

NTP クライアントとサーバ

サーバー自体の時計が狂うので、NTP クライアントを使ってインターネット上の標準時間サーバーを使って時計を自動で合わせることにします。
さらに、LAN内のマシンの時計も合わせるためサーバーを立ち上げることにします。
  1. NTP クライアントを立ち上げる

PostgreSQL をインストールする

postgresql-7.3.2.tar.gz

インストール
# su -
# useradd postgres
# mkdir /usr/local/pgsql
# chown postgres:postgres /usr/local/pgsql
# su - postgres
# tar zxvf postgresql-7.3.2.tar.gz
# cd postgresql-7.3.2
# ./configure --enable-mutilbyte=EUC_JP
# make
# make install

環境変数の設定等
PATH=$PATH:$HOME/bin:/usr/local/pgsql/bin
export POSTGRES_HOME=/usr/local/pgsql
export PGDATA=/home/postgres/data
export PGLIB=/usr/local/pgsql/lib
export LD_LIBRARY_PATH=/usr/local/pgsql/lib

自動起動の設定をする。
/etc/rc.d/rc.local に以下を追加する。
if [ -x /usr/local/pgsql/bin/postmaster ]; then
  rm -f /tmp/.s.PGSQL.5432
  su - postgres -c "/usr/local/pgsql/bin/postmaster -D /home/postgres/data -o -i &"
else
  echo -n 'postmaster '
fi

Oracle 8i をインストールする

Apache の BASIC 認証 の設定

パスワード格納ファイルを作成します。
# cd /usr/local/apache2/htdocs/ecos
# /usr/local/apache2/bin/htpasswd -c .htpasswd demouser
New password:
Re-type new password:
Adding password for user demouser

認証情報ファイル(.htaccess)の作成
AuthUserFile"/usr/local/apache2/htdocs/bin/.htpasswd"
AuthGroupFile "/dev/null"
AuthName "E-Commerce Site Demo"
AuthType Basic
<Limit GET>
require user demouser
</Limit>

httpd.conf の AllowOverride ディレクティブを編集 (FileInfo を含めるのは後述の osCommerce のため)
#AllowOverride None
AllowOverride Limit AuthConfig FileInfo

最後に Apache を再起動します。

osCommerce をインストールする

必要なもの

今回使用したバージョン
MySQL
4.0.13(mysql-standard-4.0.13-pc-linux-i686.tar.gz) [バイナリ版]
PHP
4.3.2(php-4.3.2.tar.gz)
Apache
2.0.46(httpd-2.0.46.tar.gz)
OpenSSL
0.9.7b(openssl-0.9.7b.tar.gz) [rpm 版]
osCommerce
osCommerce 2.2 MS1 (2003年2月19日版) [2003/6/3 版]

  1. 取得
  2. osCommerce 以外のコンパイルとインストール
    1. MySQL
      1. 事前に MySQL のユーザーとグループを作成しておきます
# groupadd mysql
# adduser -g mysql -d /usr/local/var mysql

  1. コンパイルおよびインストールを行います。  INSTALL-BINARYを参考にする
    # cd /usr/local
    # tar zxvf mysql-standard-4.0.13-pc-linux-i686.tar.gz
    # ln -s mysql-standard-4.0.13-pc-linux-i686/ mysql/
    # cd mysql
    # scripts/mysql_install_db
    # chown -R root  .
    # chown -R mysql data
    # chgrp -R mysql .

    1. OpenSSL (rpm でバージョンアップ)

    1. Apache
# tar zxvf httpd-2.0.46.tar.gz
# cd httpd-2.0.46
# ./configure --enable-modules="so ssl rewrite expires"
# make
# make install

    1. PHP
# tar zxvf php-4.3.2
# ./configure --enable-track-vars --enable-trans-sid --with-mysql --disable-debug --enable-mbstring \               --with-apxs2=/usr/local/apache2/bin/apxs -with-pgsql
# make
# make install
# cp php.ini-dist /usr/local/lib/php.ini

/usr/local/lib/php.ini の設定
[PHP]
output_buffering = Off
register_globals = On

[mbstring]
mbstring.language = Japanese
mbstring.encoding_translation = On
mbstring.http_input = auto
mbstring.http_output = EUC-JP
mbstring.internal_encoding = EUC-JP
mbstring.detect_order = auto
mbstring.substitute_character = none;

    1. Apache  の設定
httpd.conf に以下の2行を追加
LoadModule php4_module libexec/libphp4.so
AddType application/x-httpd-php .php

httpd/conf を修正
DirectoryIndex index.html index.html.var index.php


    1. Apache SSL の設定
証明書の作成

# mkdir /usr/local/apache2/conf/ssl.crt
# cd ssl.crt/

ca.key の作成(鍵ペア)
# openssl genrsa -des3 -out ca.key 1024
Generating RSA private key, 1024 bit long modulus
...++++++
........................................++++++
e is 65537 (0x10001)
Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:

ca.crt の作成 (組織情報の入力)
# openssl req -new -x509 -days 365 -key ca.key -out ca.crt
Using configuration from /usr/share/ssl/openssl.cnf
Enter PEM pass phrase:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:JP
State or Province Name (full name) [Some-State]:Saitama
Locality Name (eg, city) []:Hatogaya
Organization Name (eg, company) [Internet Widgits Pty Ltd]:DynaForge Organization
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:www.nakifumi.com
Email Address []:nakifumi@fsinet.or.jp

server.key (サーバ鍵ペア)
# openssl genrsa -des3 -out server.key 1024
Generating RSA private key, 1024 bit long modulus
..............++++++
..........++++++
e is 65537 (0x10001)
Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:

server.scr の作成(証明書署名要求)
# openssl req -new -key server.key -out server.csr
Using configuration from /usr/share/ssl/openssl.cnf
Enter PEM pass phrase:
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:JP
State or Province Name (full name) [Some-State]:Saitama
Locality Name (eg, city) []:Hatogaya
Organization Name (eg, company) [Internet Widgits Pty Ltd]:DynaForege Oragnization
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server's hostname) []:www.nakifumi.com
Email Address []:nakifumi@fsinet.or.jp

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

あとは証明書を作成する。http://www.modssl.org/ から最新の mod_ssl を取得する。中の pkg_contrib/sign.sh を用いて証明書を作成する。

server.crt(サーバー証明書) の作成
# ./sign.sh server.csr
CA signing: server.csr -> server.crt:
Using configuration from ca.config
Enter PEM pass phrase:
Check that the request matches the signature
Signature ok
The Subjects Distinguished Name is as follows
countryName           :PRINTABLE:'JP'
stateOrProvinceName   :PRINTABLE:'Saitama'
localityName          :PRINTABLE:'Hatogaya'
organizationName      :PRINTABLE:'DynaForege Oragnization'
commonName            :PRINTABLE:'www.nakifumi.com'
emailAddress          :IA5STRING:'nakifumi@fsinet.or.jp'
Certificate is to be certified until Jun 27 11:12:34 2004 GMT (365 days)
Sign the certificate? [y/n]:y


1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Data Base Updated
CA verifying: server.crt <-> CA cert
server.crt: OK

server.key の取得
# openssl req -noout -text -in server.csr

# mkdir /usr/local/apache2/conf/ssl.key
# cp ssk.key /usr/local/apache2/conf/ssl.key
# chmod 400 ca.key
# chmod 400 server.key

PassPhrase の省略
起動時に apachectl startssl を使用するときに上記で設定した PassPhrase  を聞かれますが、いちいち入力するのが面倒なので自動で
起動するように設定します。

任意の場所(/usr/local/apache2/conf/passphrase) に PassPhrase  を書き込んでおきます。
#!/bin/sh
echo '任意のPassPhraseを入力'
 

ssl.conf の設定(いろいろ設定しますが、SSLPassPhraseDialog を上記で設定したファイルを指定します)
SSLPassPhraseDialogexec:/usr/local/apache2/conf/passphrase

起動
# /usr/local/apache2/bin/apachectl startssl
    1. MySQL 設定
MySQL を動かします。
# /usr/local/bin/mysqld_safe --user=mysql &

mysql コマンドを使って root ユーザーのパスワード変更と匿名ユーザーの削除を行います。
# su - mysql
$ /usr/local/mysql/bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.13-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> update mysql.user
    ->  set Password=PASSWORD('hogehoge')
    ->  where User='root';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> commit;
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> delete from mysql.user where user='';
Query OK, 2 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> \q
Bye

osCommerce 用のユーザーを作成します。(ユーザー命は、osc )
$ /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 3.23.56

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> grant all on *.* to shopdemo identified by 'xxxxxxxx';
Query OK, 0 rows affected (0.00 sec)


  1. osCommerce のインストールと設定
付属の INSTALL_japanese.txt を参照
ダウンロードしたファイルを展開します。osCommere  が使用するフォルダのパーミッションを設定します。

# cd /usr/local/src
# wget http://downloads.sourceforge.jp/tep-j/3606/oscommerce-2.2ms1j-R1.tar.gz
# tar zxvf  oscommerce-2.2ms1j-R1.tar.gz
# cd oscommerce-2.2ms1j
# cp -R catalog /usr/local/apache2/htdocs/shopdemo
# cp -R admin /usr/local/apache2/htdocs/shopdemo 
# chmod 706 /usr/local/apache2/htdocs/shopdemo/catalog/includes/configure.php
# chmod 706 /usr/local/apache2/htdocs/shopdemo/admin/includes/configure.php

ブラウザから http://<さーば>/shopdemo/catalog/install/ を読んでインストール画面をだします。

install

New Install を選びます。

設定を入力


Admin Tool で Admin のパスワードの変更を行います。

書き込み禁止にします。
# chmod 644 /usr/local/apache2/htdocs/shopdemo/catalog/includes/configure.php
# chmod 644 /usr/local/apache2/htdocs/shopdemo/admin/includes/configure.php

インストーラーを削除します。
# rm -R -f /usr/local/apache2/htdocs/shopdemo/catalog/install/


Postfix + qpopper でメールの送受信をする

RPM からインストールする。

# rpm -ivh postfix-1.1.12-0vl0.26.i386.rpm

vi /etc/postfix/main.cf
# SOFT BOUNCE
#soft_bounce = no

# LOCAL PATHNAME INFORMATION
queue_directory = /var/spool/postfix

# The command_directory parameter specifies the location of all
# postXXX commands.  The default value is $program_directory.
#
command_directory = /usr/sbin

# The daemon_directory parameter specifies the location of all Postfix
# daemon programs (i.e. programs listed in the master.cf file). The
# default value is $program_directory. This directory must be owned
# by root.
#
daemon_directory = /usr/lib/postfix

# QUEUE AND PROCESS OWNERSHIP
mail_owner = postfix

default_privs = nobody

# INTERNET HOST AND DOMAIN NAMES
myhostname = nakifumi.com
mydomain = nakifumi.com

# SENDING MAIL
#myorigin = $myhostname
#myorigin = $mydomain

# RECEIVING MAIL

inet_interfaces = all

mydestination = $myhostname, localhost.$mydomain $mydomain
#mydestination = $myhostname, localhost.$mydomain, $mydomain,
#    mail.$mydomain, www.$mydomain, ftp.$mydomain

# TRUST AND RELAY CONTROL

#mynetworks_style = class
#mynetworks_style = subnet
#mynetworks_style = host

mynetworks = 192.168.0.0/24, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table

allow_mail_to_commands = alias,forward,include

#relay_domains = $mydestination

# INTERNET OR INTRANET

#relayhost = $mydomain
#relayhost = gateway.my.domain
#relayhost = uucphost
#relayhost = [an.ip.add.ress]

# REJECTING UNKNOWN LOCAL USERS
#local_recipient_maps = $alias_maps unix:passwd.byname

# INPUT RATE CONTROL
#in_flow_delay = 1s

# ADDRESS REWRITING

# TRANSPORT MAP
#
# Insert text from sample-transport.cf if you need explicit routing.

# ALIAS DATABASE
#
#alias_maps = dbm:/etc/aliases
alias_maps = hash:/etc/postfix/aliases
#alias_maps = hash:/etc/aliases, nis:mail.aliases
#alias_maps = netinfo:/aliases

alias_database = hash:/etc/postfix/aliases

# ADDRESS EXTENSIONS (e.g., user+foo)
#
#recipient_delimiter = +

# DELIVERY TO MAILBOX
#
#home_mailbox = Mailbox
#home_mailbox = Maildir/
 
# The mail_spool_directory parameter specifies the directory where
# UNIX-style mailboxes are kept. The default setting depends on the
# system type.
#
#mail_spool_directory = /var/mail
mail_spool_directory = /var/spool/mail

#mailbox_command = /some/where/procmail
#mailbox_command = /some/where/procmail -a "$EXTENSION"

#mailbox_transport = lmtp:unix:/file/name
#mailbox_transport = cyrus

#fallback_transport = lmtp:unix:/file/name
#fallback_transport = cyrus
#fallback_transport =

#luser_relay = $user@other.host
#luser_relay = $local@other.host
#luser_relay = admin+$local
 
# JUNK MAIL CONTROLS
#
# The controls listed here are only a very small subset. See the file
# sample-smtpd.cf for an elaborate list of anti-UCE controls.

# The header_checks parameter specifies an optional table with patterns
# that each logical message header is matched against, including
# headers that span multiple physical lines.  Patterns are matched
# in the specified order, and the search stops upon the first match.
# When a pattern matches, what happens next depends on the associated
# action that is specified in the right-hand side of the table:
#
# REJECT the entire message is rejected.
# REJECT text.... The text is sent to the originator.
# IGNORE the header line is silently discarded.
# WARN   the header is logged (not rejected) with a warning message.
# WARN text... as above, and the text is logged, too.
#
# These patterns do not apply to MIME headers in the message body.
#
# See also the body_checks example in the sample-filter.cf file.
#
#header_checks = regexp:/etc/postfix/header_checks

# FAST ETRN SERVICE
#
# Postfix maintains per-destination logfiles with information about
# deferred mail, so that mail can be flushed quickly with the SMTP
# "ETRN domain.tld" command, or by executing "sendmail -qRdomain.tld".
#
# By default, Postfix maintains deferred mail logfile information
# only for destinations that Postfix is willing to relay to (as
# specified in the relay_domains parameter). For other destinations,
# Postfix attempts to deliver ALL queued mail after receiving the
# SMTP "ETRN domain.tld" command, or after execution of "sendmail
# -qRdomain.tld". This can be slow when a lot of mail is queued.
#
# The fast_flush_domains parameter controls what destinations are
# eligible for this "fast ETRN/sendmail -qR" service.
#
#fast_flush_domains = $relay_domains
#fast_flush_domains =

# SHOW SOFTWARE VERSION OR NOT
#
# The smtpd_banner parameter specifies the text that follows the 220
# code in the SMTP server's greeting banner. Some people like to see
# the mail version advertised. By default, Postfix shows no version.
#
# You MUST specify $myhostname at the start of the text. That is an
# RFC requirement. Postfix itself does not care.
#
#smtpd_banner = $myhostname ESMTP $mail_name
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)

# PARALLEL DELIVERY TO THE SAME DESTINATION
#
# How many parallel deliveries to the same user or domain? With local
# delivery, it does not make sense to do massively parallel delivery
# to the same user, because mailbox updates must happen sequentially,
# and expensive pipelines in .forward files can cause disasters when
# too many are run at the same time. With SMTP deliveries, 10
# simultaneous connections to the same domain could be sufficient to
# raise eyebrows.
#
# Each message delivery transport has its XXX_destination_concurrency_limit
# parameter.  The default is $default_destination_concurrency_limit for
# most delivery transports. For the local delivery agent the default is 2.

#local_destination_concurrency_limit = 2
#default_destination_concurrency_limit = 10

# DEBUGGING CONTROL
#
# The debug_peer_level parameter specifies the increment in verbose
# logging level when an SMTP client or server host name or address
# matches a pattern in the debug_peer_list parameter.
#
debug_peer_level = 2

# The debug_peer_list parameter specifies an optional list of domain
# or network patterns, /file/name patterns or type:name tables. When
# an SMTP client or server host name or address matches a pattern,
# increase the verbose logging level by the amount specified in the
# debug_peer_level parameter.
#
#debug_peer_list = 127.0.0.1
#debug_peer_list = some.domain

# The debugger_command specifies the external command that is executed
# when a Postfix daemon program is run with the -D option.
#
# Use "command .. & sleep 5" so that the debugger can attach before
# the process marches on. If you use an X-based debugger, be sure to
# set up your XAUTHORITY environment variable before starting Postfix.
#
debugger_command =
     PATH=/usr/bin:/usr/X11R6/bin
     xxgdb $daemon_directory/$process_name $process_id & sleep 5

# INSTALL-TIME CONFIGURATION INFORMATION
#
# The following parameters are used when installing a new Postfix version.
#
# sendmail_path: The full pathname of the Postfix sendmail command.
# This is the Sendmail-compatible mail posting interface.
#
sendmail_path = /usr/lib/sendmail

# newaliases_path: The full pathname of the Postfix newaliases command.
# This is the Sendmail-compatible command to build alias databases.
#
#newaliases_path = /usr/bin/newaliases

# mailq_path: The full pathname of the Postfix mailq command.  This
# is the Sendmail-compatible mail queue listing command.
#
mailq_path = /usr/bin/mailq

# setgid_group: The group for mail submission and queue management
# commands.  This must be a group name with a numerical group ID that
# is not shared with other accounts, not even with the Postfix account.
#
#setgid_group = postdrop

# manpage_directory: The location of the Postfix on-line manual pages.
#
#manpage_directory =

# sample_directory: The location of the Postfix sample configuration files.
#
#sample_directory =

# readme_directory: The location of the Postfix README files.
#
#readme_directory =

# Other configurable parameters.

# The allow_percent_hack parameter controls the rewriting of the form
# "user%domain" to "user@domain". This is enabled by default.
#
allow_percent_hack = no

設定が終了したら再起動します。
# /usr/sbin/postfix start

SNMP+MRTG で状態を監視する

UCD-SNMP(NET-SNMP) をインストールする。

UCD-SNMP のソースを取得する。(2003/5/1 現在)
http://sourceforge.net/project/showfiles.php?group_id=12694 の中の ucd-snmp-4.2.6.tar.gzを取得する。

# tar zxvf ucd-snmp-4.2.6.tar.gz
# cd ucd-snmp-4.2.6
# ./configure

質問には、メールアドレスと設置場所(saitama (笑)を入力。あとのパスはデフォルトのまま。
あとは、インストール。

# make
scapi.c: In function `sc_encrypt':
scapi.c:612: incompatible types in initialization
scapi.c:612: incompatible types in initialization
scapi.c:612: incompatible types in initialization
scapi.c:612: incompatible type for argument 1 of `memset'
scapi.c: In function `sc_decrypt':
scapi.c:725: incompatible types in initialization
scapi.c:725: incompatible types in initialization
scapi.c:725: incompatible types in initialization
scapi.c:725: incompatible type for argument 1 of `memset'
make[1]: *** [scapi.lo] エラー 1

make するとこんな感じで、エラーになりコンパイルできません。
調べると OpenSSL のバージョンが 0.9.7 になって引数が変わったためらしい ...
(このマシンの OpenSSL のバージョンは、0.9.7b)
とりあえず、UCD-SNMP の発展バージョンの NET-SNMP 5.0.7 をインストールすることで、世界のどこかの人は
解消できたらしい ... (ぐぐりました)

気を取り直して、さきほどのサイトから 5.0.7 のソース(net-snmp-5.0.7.tar.gz)を取得する。

同じように configure からの一連の流れ ...

# tar zxvf net-snmp-5.0.7.tar.gz
# cd net-snmp-5.0.7
# ./configure

(...)

-Press return to continue-

disabling above prompt for future runs...  yes
checking Default version of SNMP to use...


*** Default SNMP Version:

        Starting with Net-SNMP 5.0, you can choose the default version of
the SNMP protocol to use when no version is given explicitly on the
command line, or via an 'snmp.conf' file.  In the past this was set to
SNMPv1, but you can use this to switch to SNMPv3 if desired.  SNMPv3
will provide a more secure management environment (and thus you're
encouraged to switch to SNMPv3), but may break existing scripts that
rely on the old behaviour.  (Though such scripts will probably need to
be changed to use the '-c' community flag anyway, as the SNMPv1
command line usage has changed as well.).
   At this prompt you can select "1", "2" (for SNMPv2c), or "3" as
the default version for the command tools (snmpget, ...) to use.  This
can always be overridden at runtime using the -v flag to the tools, or
by using the "defVersion" token in your snmp.conf file.

Default version of SNMP to use (3):
setting Default version of SNMP to use to...  3
checking System Contact Information...


*** System Contact Information:

        Describes who should be contacted about the host the agent is
running on.  This information is available in the MIB-II tree.  This
can also be over-ridden using the "syscontact" syntax in the agent's
configuration files.

System Contact Information (root@): nakifumi@fsinet.or.jp
setting System Contact Information to...  nakifumi@fsinet.or.jp
checking System Location...


*** System Location:

        Describes the location of the system.  This information is
available in the MIB-II tree.  this can also be over-ridden using the
"syslocation" syntax in the agent's configuration files.

System Location (Unknown): HydraServer@Saitama.Japan
setting System Location to...  HydraServer@Saitama.Japan
checking Location to write logfile...


*** Logfile location:

        Enter the default location for the snmpd agent to dump
information & errors to.  If not defined (enter the keyword "none"
at the prompt below) the agent will use stdout and stderr instead.
(Note: This value can be over-ridden using command line options.)

Location to write logfile (/var/log/snmpd.log):
setting Location to write logfile to...  /var/log/snmpd.log
checking Location to write persistent information...


*** snmpd persistent storage location:

        Enter a directory for the SNMP library to store persistent
data in the form of a configuration file.  This default location is
different than the old default location (which was for ucd-snmp).  If
you stay with the new path, I'll ask you in a second if you wish to
copy your files over to the new location (once only).  If you pick
some other path than the default, you'll have to copy them yourself.
There is nothing wrong with picking the old path (/var/ucd-snmp) if
you'd rather.

Location to write persistent information (/var/net-snmp):
setting Location to write persistent information to...  /var/net-snmp
checking If we should copy the old persistent directory...

*** Copying old ucd-snmp persistent files to net-snmp persistent directory:

        Would you like to copy the older ucd-snmp persistent files
into your new net-snmp persistent file path?  This will functionally
save all your ucd-snmp data and let it be used within the net-snmp
tools.  This will only be done once when you run make install.  If you
wish to do this, enter yes at the prompt.

Copy ucd-snmp data into the net-snmp data directory (yes):
yes

(...)
# make
# umask 022
# make install

設定ファイル(/usr/local/share/snmp/snmpd.conf)の変更を行う。面倒なのでサンプルをコピーして編集する。
/etc/rc.d/init.d/snmpd を作成する

# su -
# cp /usr/local/src/net-snmp-5.0.8/EXAMPLE.conf /usr/local/share/snmp/snmpd.conf
# vi /usr/local/share/snmp/snmpd.conf

snmpd.conf を編集
# Access Control

# First, map the community name (COMMUNITY) into a security name
#       sec.name  source          community
com2sec local     localhost       private
com2sec mynetwork 192.168.0.0/24  public

# Second, map the security names into group names:
#                 sec.model  sec.name
##group MyRWGroup    v1         local
#group MyRWGroup    v2c        local
#group MyRWGroup    usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork

# Third, create a view for us to let the groups have rights to:
#           incl/excl subtree                          mask
view all    included  .1                               80

####
# Finally, grant the 2 groups access to the 1 view with different
# write permissions:

#                context sec.model sec.level match  read   write  notif
access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none

# -----------------------------------------------------------------------------

# System contact information
syslocation Hydra Server
syscontact Akifumi Nakamura <nakifumi@fsinet.or.jp>

# -----------------------------------------------------------------------------

# Process checks.

#  Make sure mountd is running
proc mountd

#  Make sure there are no more than 4 ntalkds running, but 0 is ok too.
proc ntalkd 4

#  Make sure at least one sendmail, but less than or equal to 10 are running.
proc sendmail 10 1

# a simple hello world
exec echotest /bin/echo hello world

# disk checks

# The agent can check the amount of available disk space, and make
# sure it is above a set limit.

# disk PATH [MIN=DEFDISKMINIMUMSPACE]
#
# PATH:  mount path to the disk in question.
# MIN:   Disks with space below this value will have the Mib's errorFlag set.
#        Default value = DEFDISKMINIMUMSPACE.

# Check the / partition and make sure it contains at least 10 megs.

disk / 10000

# load average checks
# load [1MAX=DEFMAXLOADAVE] [5MAX=DEFMAXLOADAVE] [15MAX=DEFMAXLOADAVE]
#
# 1MAX:   If the 1 minute load average is above this limit at query
#         time, the errorFlag will be set.
# 5MAX:   Similar, but for 5 min average.
# 15MAX:  Similar, but for 15 min average.

# Check for loads:
load 12 14 14

snmp マネージャを使って動作を見てみる
# snmpd
# snmpwalk -v 1 -c public 192.168.0.2

cfgmaker を使い mrtg の設定ファイルを作成する。
# /usr/local/mrtg-2/bin/cfgmaker public@192.168.0.2 > mrtg.cfg

vi 等で作成された mrtg.cfg の workdir を修正する。
#  for UNIX
WorkDir: /usr/local/apache2/htdocs/stats

cron で自動起動するようにする

HotSoNIC を使う

MRTG と同様のSNMPデータグラフ化ソフト。MRTG と違って 3種類以上もグラフ化出来る。

# wget http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/pub/rrdtool-1.0.42.tar.gz
# tar zxvf rrdtool-1.0.42.tar.gz
# cd rrdtool-1.0.42
# ./configure
# make; make install
# make site-perl-install

# cd /usr/local
# wget http://hotsanic.sourceforge.net/archive/HotSaNIC-0.4/HotSaNIC-0.4.0.tgz
# tar zxvf HotSaNIC-0.4.0.tgz
# cd HotSaNIC
# ./setup.pl



SkyBoard をインストールする

http://search.luky.org/vine-users.5/msg00461.html  もしくは
http://www.syscon.co.jp/homepage/information/skyboard/ を参照

Linux を PPTP サーバーにする

カーネルのバージョンは、2.4.19 となっている。

カーネルソースを取得していない場合は、カーネルを取得する。

Vine Linux の人はこのあたりとか。
ftp://ring.asahi-net.or.jp/pub/linux/Vine/Vine-2.6/SRPMS/SRPMS/kernel-2.4.19-0vl11.src.rpm

MS-CHAPv2 を使えるようにするために Kernel にパッチを当てる。
http://public.planetmirror.com/pub/mppe/ から linux-2.4.19-openssl-0.9.6b-mppe.patch.gz を取得する。

# cd /usr/src
# wget ftp://ring.asahi-net.or.jp/pub/linux/Vine/Vine-2.6/SRPMS/SRPMS/kernel-2.4.19-0vl11.src.rpm
# wget http://public.planetmirror.com/pub/mppe/linux-2.4.19-openssl-0.9.6b-mppe.patch.gz
# rpm -ivh  kernel-2.4.19-0vl11.src.rpm
# cd linux-2.4.19
# zcat ../linux-2.4.19-openssl-0.9.6b-mppe.patch.gz | patch -p1

とりあえず一回も config したことないのでおまじないをする。
# make oldconfig

設定を行う
# make menuconfig

PPTPはPPPを利用するためPPP関連のモジュールが含まれている必要があるので確認する。

ルートメニューの 「Network device support --->」 の中に 「PPP (point-to-point protocol) support」が <M> となっているか確認。

確認がよければ、カーネルを構築する。またモジュールも再構築する。
# make dep
# make clean
# make bzImage
# make modules

現在のカーネルのバックアップをとる
# cd /boot
# mv System.map-2.4.19-0vl11smp System.map-2.4.19-0vl11smp.org
# mv vmlinuz-2.4.19-0vl11smp vmlinuz-2.4.19-0vl11smp.org

カーネルを変更する
# cp -p /usr/local/src/linux-2.4.19/arch/i386/boot/bzImage /boot/vmlinuz-2.4.19-3smp
# cp -p /usr/local/src/linux-2.4.19/System.map System.map-2.4.19-3smp
# make modules_install

以下のコマンドでもカーネルの変更は可能
# installkernel VER-REL arch/i386/boot/bzImage System.map

ローダーは、GRUB を使っているので、GRUB の設定を変更する。
/etc/grub.conf を修正して。起動時のカーネルを指定する
title Vine Linux_SMP (vmlinuz-2.4.19-3smp)
        root (hd0,0)
        kernel /vmlinuz-2.4.19-3smp ro root=/dev/hda2

そして、再起動 ...


Tomcat をインストールする

J2SE(Java 2 Platform,Standard Edition) SDK をインストールする。
(使用したものは、rpm 版の j2sdk-1_4_1_02-linux-i586-rpm.bin )

RPM でインストールする
# cd /usr/local/
# chmod +x j2sdk-1_4_1_02-linux-i586-rpm.bin
# ./j2sdk-1_4_1_02-linux-i586-rpm.bin
# rpm -ivh j2sdk-1_4_1_02-fcs-linux-i586.rpm
# ln -s /usr/java/j2sdk1.4.1_02/ /usr/java/jdk

Tomcat を取得する。
http://jakarta.apache.org/tomcat/index.html
(使用したものは、tomcat-4.1.24-LE-jdk14.tar.gz)

# cd /usr/local
# tar zxvf /usr/local/src/tomcat-4.1.24-LE-jdk14.tar.gz
# ln -s jakarta-tomcat-4.1.24-LE-jdk14/ tomcat

Java SDK と Tomcat のために環境変数を /etc/profile に以下を追加します。
export JAVA_HOME=/usr/java/jdk
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/lib
export TOMCAT_HOME=/usr/local/tomcat

変更を反映させます。
# source /etc/profile

Tomcat を起動します。
# /usr/local/tomcat/bin/startup.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME:       /usr/java/jdk

Tomcat を停止します。
# /usr/local/tomcat/bin/shutdown.sh
Using CATALINA_BASE:   /usr/local/tomcat
Using CATALINA_HOME:   /usr/local/tomcat
Using CATALINA_TMPDIR: /usr/local/tomcat/temp
Using JAVA_HOME:       /usr/java/jdk

Apache と Tomcat を連携させます。
参考: http://www.ingrid.org/jajakarta/tomcat/tomcat-3.2.1/doc-ja/tomcat-apache-howto.html#cooperation_need

Apache 2.x と Tomcat 4.x を連携させるには、連携用の仕掛けとして「コネクタ」というのを使うんだと。
Jakarta プロジェクトが Current としている Coyote JK2 を使用することにします。

はじめに jakarta.apache.org から Coyote JK2 を取得します。


apache の modules にモジュールをコピーします。(Apacheの インストール先は /usr/local/apache2/


Apache の設定ファイルである httpd.conf に以下の行を追加して jk2 コネクタを使用するようにします。
LoadModule jk2_module modules/mod_jk2.so

$Apache_Home/conf  に workers2.propeties を作成します。(/usr/local/apache2/conf/workers2.propeties)
[channel.socket:localhost:8009]
info=Ajp13 forwarding over socket
tomcatId=localhost:8009
debug=0

[uri:/examples/*]
[uri:/examples/servlet/*]
info=Map the whole webapp

[shm]
file=${serverRoot}/logs/shm.file
size=1048576

Tomcat の server.xml も関係あるのですが、Apache 4.x だとそのままで出来るので何もしません。
あとは、Tomcat と Apache を終了させて、その後 Tomcat → Apache の順で起動させます。


FML をインストールする

ここ(http://www.sapporo.iij.ad.jp/staff/fukachan/fml/) から取得。

今回は、fml-4.0-stable-20030510.tar.gz を使用。

FML ユーザーの作成とFML ユーザーのディレクトリを作成します。
# groupadd fml
# useradd -g fml fml
# mkdir /usr/local/fml
# mkdir /var/spool/ml
# chown fml /usr/local/fml
# chown fml /var/spool/ml

展開して、付属のインストーラを実行します。
# tar zxvf fml-4.0-stable-20030510.tar.gz
# cd fml-4.0-stable-20030510
# make install
perl ./makefml install
unshift(@INC, /usr/local/src/fml-4.0-stable-20030510/src)
---NOT USING configuration file (for the first time)

   THIS HOST (hydra.nakifumi.com) IS [i686-pc-linux-gnu]

---Please Define Your Fml System Configurations

Personal Use or ML-Admin-Group-Shared or fmlserv you use?
Personal, Group, Fmlserv (personal/group/fmlserv) [personal]

DOMAIN NAME               [nakifumi.com]
FQDN                      [hydra.nakifumi.com] www.nakifumi.com
EXEC FILES DIRECTORY      [/usr/local/fml]
TOP LEVEL ML DIRECTORY    [/var/spool/ml]

Language (Japanese or English) [English] Japanese


TimeZone (TZ: e.g. +0900, -0300) [+0900]


  --- summary ---
      DOMAIN: nakifumi.com
        FQDN: www.nakifumi.com
    EXEC_DIR: /usr/local/fml
      ML_DIR: /var/spool/ml
    Language: Japanese
    TimeZone: +0900


The current configuration is saved in /usr/local/fml/.fml/system

---Install the Fml system to /usr/local/fml. (y/n) [n] y

...

 -- Enjoy Internetworking!

MTA に Postfix を使っているので以下の行を/etc/postfix/main.cf へ追加する。

allow_mail_to_commands = alias,forward,include

保存したら、Postfix の設定を読み込ませる

# postfix reload

Courier-imap + SquirrelMail をインストールする

まずは、Courier-imap をインストールする。

$ cd /usr/local/src
$ wget http://keihanna.dl.sourceforge.net/sourceforge/courier/courier-imap-1.7.3.tar.bz2
$ tar zxvf courier-imap-1.7.3.tar.bz2
$ cd courier-imap-1.7.3
$ ./configure --without-pgsql
$ make
$ make check
$ su -
# cd /usr/local/src/courier-imap-1.7.3
# make install
# make install-configure

つぎに postfix の設定を行う。
Postfix を maildir 方式に変更するのに /etc/postfix/main.cf を修正します。

以下のようになっているのを
#home_mailbox = Mailbox
#home_mailbox = Maildir/

...

#mail_spool_directory = /var/mail
mail_spool_directory = /var/spool/mail

以下のように home_mailbox をコメントをはずし、mail_spool_direcory にコメントをします。(赤字部分修正)
#home_mailbox = Mailbox
home_mailbox = Maildir/

...

#mail_spool_directory = /var/mail
#mail_spool_directory = /var/spool/mail

各ユーザーで以下のコマンドを使って、メール用のディレクトリを作成します。
$ cd ~
$ /usr/lib/courier-imap/bin/maildirmake Maildir





間違い・ご意見等は nakifumi@fsinet.or.jp  まで