# vi /usr/share/pear/pearcmd.php
@ini_set('memory_limit','80M'); を追記
# yum install ImageMagick-devel
# pecl install imagick
# vi /etc/php.ini
extension=imagick.so を追記
# service httpd restart
# yum install dcraw ※RAW現像用
■参考
http://labs.uechoco.com/blog/2008/04/phppecl.html
■imagick2.0系のドキュメント
http://php.morva.net/manual/ja/book.imagick.php
ネットに出回っているのは1.0系が多く、使えない。後方互換なし。
2008年5月27日火曜日
2008年5月3日土曜日
MySQLのバックアップ
毎回忘れるのでメモ。
データ元で
# /kfs/backup/mysqlsnapshot -u [ID] -p [PW] -l -v -s /kfs/backup/output
# rsync -av /kfs/backup/output/* dbm01.hoge.com:/var/lib/mysql/
データ先で
# service mysqld stop
# cd /var/lib/mysql
# tar -zxvf *.tar ←1つずつ展開しないとだめ。
# service mysqld start
なおInnnoDBの場合はmysqlsnapshotでは取れない。
# mysqldump -u*** -p*** --all-databases -l --flush-logs > ***.sql
データ元で
# /kfs/backup/mysqlsnapshot -u [ID] -p [PW] -l -v -s /kfs/backup/output
# rsync -av /kfs/backup/output/* dbm01.hoge.com:/var/lib/mysql/
データ先で
# service mysqld stop
# cd /var/lib/mysql
# tar -zxvf *.tar ←1つずつ展開しないとだめ。
# service mysqld start
なおInnnoDBの場合はmysqlsnapshotでは取れない。
# mysqldump -u*** -p*** --all-databases -l --flush-logs > ***.sql
2008年4月26日土曜日
ssh01を立ち上げる
外部からのSSH着信用に専用待ち受けサーバを立てることにしました。
やっぱ危ないもんね。
cp --sparse=auto /kfs_alpha/xen/standard.img /kfs_alpha/xen/ssh01.img
cp /etc/xen/standard /etc/xen/ssh01
sed -i 's/name = "standard"/name = "ssh01"/g' /etc/xen/ssh01
sed -i 's/maxmem = 512/maxmem = 256/g' /etc/xen/ssh01
sed -i 's/memory = 512/memory = 256/g' /etc/xen/ssh01
sed -i 's/uuid = "37d373d8-22ae-7923-2e14-3977aa63ac00"/uuid = "37d373d8-22ae-7923-2e14-3977aa630029"/g' /etc/xen/ssh01
sed -i 's/disk = \[ \"tap:aio:\/kfs_alpha\/xen\/standard.img,xvda,w\" \]/disk = \[ "tap:aio:\/kfs_alpha\/xen\/ssh01.img,xvda,w\" \]/g' /etc/xen/ssh01
sed -i 's/vif = \[ \"mac=00:16:3e:63:95:00,bridge=xenbr0\" \]/vif = \[ \"mac=00:16:3e:63:00:29,bridge=xenbr0\" \]/g' /etc/xen/ssh01
○ssh01
sed -i 's/IPADDR=192.168.0.XXX/IPADDR=192.168.0.41/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HWADDR=00:16:3E:63:95:XX/HWADDR=00:16:3E:63:00:29/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HOSTNAME=standard.hoge.com/HOSTNAME=ssh01.hoge.com/g' /etc/sysconfig/network
rm -rf /etc/ssh/ssh_host*
rm -rf /root/.bash_history
reboot
○公開鍵設定まで
# yum update
・DNSに設定追加
・Webmin Clusterに参加させ、ユーザーを同期させる
・SSH公開鍵のセット
# cd ~
# mkdir .ssh
# vi .ssh/authorized_keys
公開鍵をペースト
# chmod 600 .ssh/authorized_keys
# chmod 700 .ssh
# chwon -R hoge:hoge .ssh
これを各ユーザー分セットしてしまえ
○鍵なしログイン禁止
# vi /etc/ssh/sshd_config
#PasswordAuthentication yes
→PasswordAuthentication no
# /etc/rc.d/init.d/sshd restart
いじょ。
なお、鍵はPoderosaで作成しましたが、WinSCPとPuTTyはPuTTy形式の秘密鍵しか認識しないので、秘密鍵についてはPoderosaで生成後、puttygenでputty形式に変換しました。
あとー、/etc/snmp/snmpd.confを他のサーバからコピーしておく。standardイメージには入ってないです。
やっぱ危ないもんね。
cp --sparse=auto /kfs_alpha/xen/standard.img /kfs_alpha/xen/ssh01.img
cp /etc/xen/standard /etc/xen/ssh01
sed -i 's/name = "standard"/name = "ssh01"/g' /etc/xen/ssh01
sed -i 's/maxmem = 512/maxmem = 256/g' /etc/xen/ssh01
sed -i 's/memory = 512/memory = 256/g' /etc/xen/ssh01
sed -i 's/uuid = "37d373d8-22ae-7923-2e14-3977aa63ac00"/uuid = "37d373d8-22ae-7923-2e14-3977aa630029"/g' /etc/xen/ssh01
sed -i 's/disk = \[ \"tap:aio:\/kfs_alpha\/xen\/standard.img,xvda,w\" \]/disk = \[ "tap:aio:\/kfs_alpha\/xen\/ssh01.img,xvda,w\" \]/g' /etc/xen/ssh01
sed -i 's/vif = \[ \"mac=00:16:3e:63:95:00,bridge=xenbr0\" \]/vif = \[ \"mac=00:16:3e:63:00:29,bridge=xenbr0\" \]/g' /etc/xen/ssh01
○ssh01
sed -i 's/IPADDR=192.168.0.XXX/IPADDR=192.168.0.41/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HWADDR=00:16:3E:63:95:XX/HWADDR=00:16:3E:63:00:29/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/ONBOOT=no/ONBOOT=yes/g' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/HOSTNAME=standard.hoge.com/HOSTNAME=ssh01.hoge.com/g' /etc/sysconfig/network
rm -rf /etc/ssh/ssh_host*
rm -rf /root/.bash_history
reboot
○公開鍵設定まで
# yum update
・DNSに設定追加
・Webmin Clusterに参加させ、ユーザーを同期させる
・SSH公開鍵のセット
# cd ~
# mkdir .ssh
# vi .ssh/authorized_keys
公開鍵をペースト
# chmod 600 .ssh/authorized_keys
# chmod 700 .ssh
# chwon -R hoge:hoge .ssh
これを各ユーザー分セットしてしまえ
○鍵なしログイン禁止
# vi /etc/ssh/sshd_config
#PasswordAuthentication yes
→PasswordAuthentication no
# /etc/rc.d/init.d/sshd restart
いじょ。
なお、鍵はPoderosaで作成しましたが、WinSCPとPuTTyはPuTTy形式の秘密鍵しか認識しないので、秘密鍵についてはPoderosaで生成後、puttygenでputty形式に変換しました。
あとー、/etc/snmp/snmpd.confを他のサーバからコピーしておく。standardイメージには入ってないです。
2008年4月20日日曜日
unixbenchによるベンチマークテスト
unixbenchでベンチしてみる。
rpmforgeのx86_64のrpmはディレクトリ構成がイケてないので、シンボリックリンク貼っております。
# yum --enablerepo=rpmforge install unixbench
# ln -s /usr/lib64/unixbench /usr/lib/unixbench
# unixbench
このまま30~40分待つ。
# rm /usr/lib/unixbench
# yum remove unixbench
なお、x86_64でi386を使う場合は、rpm持ってきてrpmコマンドで入れないとだめだぞ。
# wget http://ftp-stud.fht-esslingen.de/dag/redhat/el5/en/i386/dag/RPMS/unixbench-4.0.1-1.el5.rf.i386.rpm
# rpm --install unixbench-4.0.1-1.el5.rf.i386.rpm
# unixbench
# rpm --erase unixbench
Celeron D 341 と Core 2 Quad のunixbench対決結果
rpmforgeのx86_64のrpmはディレクトリ構成がイケてないので、シンボリックリンク貼っております。
# yum --enablerepo=rpmforge install unixbench
# ln -s /usr/lib64/unixbench /usr/lib/unixbench
# unixbench
このまま30~40分待つ。
# rm /usr/lib/unixbench
# yum remove unixbench
なお、x86_64でi386を使う場合は、rpm持ってきてrpmコマンドで入れないとだめだぞ。
# wget http://ftp-stud.fht-esslingen.de/dag/redhat/el5/en/i386/dag/RPMS/unixbench-4.0.1-1.el5.rf.i386.rpm
# rpm --install unixbench-4.0.1-1.el5.rf.i386.rpm
# unixbench
# rpm --erase unixbench
Celeron D 341 と Core 2 Quad のunixbench対決結果
| プロセッサ | CelD341 | CelD341 | Q6700 | CelD341 | Q6700 |
| ドメイン種別 | Dom0 | DomU | Dom0 | Dom0 | Dom0 |
| ドメイン名/td> | alpha | dev | alpha | beta | alpha |
| unixbenchのアーキテクチャ | x86_64 | x86_64 | x86_64 | i386 | i386 |
| Arithmetic Test (type = double) | 237.4 | 235.3 | 287.5 | 213.4 | 240.0 |
| Dhrystone 2 using register variables | 526.2 | 525.3 | 1297.2 | 385.3 | 945.0 |
| Execl Throughput | 173.8 | 7.8 | 372.3 | 202.8 | 417.0 |
| File Copy 1024 bufsize 2000 maxblocks | 322.3 | 319.0 | 802.4 | 316.5 | 708.6 |
| File Copy 256 bufsize 500 maxblocks | 212.2 | 214.8 | 530.8 | 207.9 | 463.8 |
| File Copy 4096 bufsize 8000 maxblocks | 590.9 | 525.9 | 301.0 | 586.0 | 297.1 |
| Pipe Throughput | 156.0 | 171.6 | 404.1 | 155.4 | 333.5 |
| Pipe-based Context Switching | 0.0 | 0.0 | 0.0 | 111.0 | 221.0 |
| Process Creation | 117.9 | 114.5 | 304.5 | 152.0 | 393.8 |
| Shell Scripts (8 concurrent) | 321.7 | 68.2 | 312.8 | 328.3 | 320.5 |
| System Call Overhead | 115.1 | 119.0 | 290.1 | 102.8 | 209.4 |
2008年4月13日日曜日
全Dom0にPostfixを入れる
しまった、面倒なことになってしまった。
PHPやPerlはsendmailをコマンドラインで叩いてメール送信するので、各Dom0にMTAを導入してやらないとメールを集約できないじゃん・・・。。。
Webminで全mail01を除く各Dom0にPostfixを入れて、設定ファイルをコピーすることにする。ああ、まんどい。
※alphaには入れない。Dom0が常に動いているとは言い切れないのでトラブルの元。
全DomUに
# yum -y install postfix
全DomUに設定追記
myhostname = stats01.hoge.com
mydomain = hoge.com
myorigin = $mydomain
inet_interfaces = all
#proxy_interfaces =
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
#SMTP-Auth
smtpd_banner = $myhostname ESMTP unknown
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
#MailSizeLimitter 100MB
message_size_limit = 104857600
#MailBoxSizeLimitter 500MB
mailbox_size_limit = 512000000
mynetworks = 192.168.0.0/24, 127.0.0.0/8
relay_domains = $mydestination
relayhost = mail01.hoge.com
#transport_maps = hash:/etc/postfix/transport
#alias_maps = hash:/etc/aliases, hash:/etc/mailman/aliases
#manual setting
allow_mail_to_commands = alias,forward,include
allow_mail_to_files = alias,forward,include
disable_vrfy_command = yes
allow_percent_hack = yes
swap_bangpath = yes
forward_path = $home/.forward$recipient_delimiter$extension,$home/.forward
sendmail_path = /usr/sbin/sendmail
これでローカル配信以外は全部mail01.hoge.comにリレーされる。
全DomUで
# /etc/rc.d/init.d/saslauthd start
# chkconfig saslauthd on
# chkconfig --list saslauthd
# mkdir -p /etc/skel/Maildir/new
# mkdir -p /etc/skel/Maildir/cur
# mkdir -p /etc/skel/Maildir/tmp
# chmod -R 700 /etc/skel/Maildir/
# /etc/rc.d/init.d/sendmail stop
# chkconfig sendmail off
# chkconfig --list sendmail
# alternatives --set mta /usr/sbin/sendmail.postfix
# /etc/rc.d/init.d/postfix start
# chkconfig postfix on
# chkconfig --list postfix
これでよしと。
■動作まとめ
○mail01
@hoge.com宛・・・ローカル配信する。
外向け・・・携帯はプロバイダSMTPサーバ、その他は直接当該SMTPサーバにリレー。
外から@xxx.hoge.com宛・・・全部ローカル配信。
○mail01以外
@hoge.com宛・・・ローカル配信する。
@xxx.hoge.com宛・・・該当xxx.hoge.comにリレー。
外向け・・・mail01.hoge.com宛にリレー。
外から@xxx.hoge.com宛・・・全部ローカル配信。
PHPやPerlはsendmailをコマンドラインで叩いてメール送信するので、各Dom0にMTAを導入してやらないとメールを集約できないじゃん・・・。。。
Webminで全mail01を除く各Dom0にPostfixを入れて、設定ファイルをコピーすることにする。ああ、まんどい。
※alphaには入れない。Dom0が常に動いているとは言い切れないのでトラブルの元。
全DomUに
# yum -y install postfix
全DomUに設定追記
myhostname = stats01.hoge.com
mydomain = hoge.com
myorigin = $mydomain
inet_interfaces = all
#proxy_interfaces =
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
#SMTP-Auth
smtpd_banner = $myhostname ESMTP unknown
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
#MailSizeLimitter 100MB
message_size_limit = 104857600
#MailBoxSizeLimitter 500MB
mailbox_size_limit = 512000000
mynetworks = 192.168.0.0/24, 127.0.0.0/8
relay_domains = $mydestination
relayhost = mail01.hoge.com
#transport_maps = hash:/etc/postfix/transport
#alias_maps = hash:/etc/aliases, hash:/etc/mailman/aliases
#manual setting
allow_mail_to_commands = alias,forward,include
allow_mail_to_files = alias,forward,include
disable_vrfy_command = yes
allow_percent_hack = yes
swap_bangpath = yes
forward_path = $home/.forward$recipient_delimiter$extension,$home/.forward
sendmail_path = /usr/sbin/sendmail
これでローカル配信以外は全部mail01.hoge.comにリレーされる。
全DomUで
# /etc/rc.d/init.d/saslauthd start
# chkconfig saslauthd on
# chkconfig --list saslauthd
# mkdir -p /etc/skel/Maildir/new
# mkdir -p /etc/skel/Maildir/cur
# mkdir -p /etc/skel/Maildir/tmp
# chmod -R 700 /etc/skel/Maildir/
# /etc/rc.d/init.d/sendmail stop
# chkconfig sendmail off
# chkconfig --list sendmail
# alternatives --set mta /usr/sbin/sendmail.postfix
# /etc/rc.d/init.d/postfix start
# chkconfig postfix on
# chkconfig --list postfix
これでよしと。
■動作まとめ
○mail01
@hoge.com宛・・・ローカル配信する。
外向け・・・携帯はプロバイダSMTPサーバ、その他は直接当該SMTPサーバにリレー。
外から@xxx.hoge.com宛・・・全部ローカル配信。
○mail01以外
@hoge.com宛・・・ローカル配信する。
@xxx.hoge.com宛・・・該当xxx.hoge.comにリレー。
外向け・・・mail01.hoge.com宛にリレー。
外から@xxx.hoge.com宛・・・全部ローカル配信。
DomU mail01の設定
■Postfix&IMAPサーバ
○参考サイト
http://centossrv.com/postfix.shtml
○Postfix設定 全部最後にまとめて書く。
# vi /etc/postfix/main.cf
myhostname = mail01.hoge.com
mydomain = hoge.com
myorigin = $mydomain
inet_interfaces = all
#proxy_interfaces =
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
#SMTP-Auth
smtpd_banner = $myhostname ESMTP unknown
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
#MailSizeLimitter 100MB
message_size_limit = 104857600
#MailBoxSizeLimitter 500MB
mailbox_size_limit = 512000000
mynetworks = 192.168.0.0/24, 127.0.0.0/8
relay_domains = $mydestination
#relayhost = op25b.asahi-net.or.jp
transport_maps = hash:/etc/postfix/transport
alias_maps = hash:/etc/aliases, hash:/etc/mailman/aliases
#manual setting
allow_mail_to_commands = alias,forward,include
allow_mail_to_files = alias,forward,include
disable_vrfy_command = yes
allow_percent_hack = yes
swap_bangpath = yes
forward_path = $home/.forward$recipient_delimiter$extension,$home/.forward
sendmail_path = /usr/sbin/sendmail
# vi /etc/postfix/transport
最後に追記
ezweb.ne.jp :mail.asahi-net.or.jp
.ezweb.ne.jp :mail.asahi-net.or.jp
docomo.ne.jp :mail.asahi-net.or.jp
.docomo.ne.jp :mail.asahi-net.or.jp
vodafone.ne.jp :mail.asahi-net.or.jp
.vodafone.ne.jp :mail.asahi-net.or.jp
softbank.ne.jp :mail.asahi-net.or.jp
.softbank.ne.jp :mail.asahi-net.or.jp
pdx.ne.jp :mail.asahi-net.or.jp
.pdx.ne.jp :mail.asahi-net.or.jp
○SMTP-AuthにシステムのID/PWを使う
# /etc/rc.d/init.d/saslauthd start
# chkconfig saslauthd on
# chkconfig --list saslauthd
○Maildir形式メールボックス自動作成
# mkdir -p /etc/skel/Maildir/new
# mkdir -p /etc/skel/Maildir/cur
# mkdir -p /etc/skel/Maildir/tmp
# chmod -R 700 /etc/skel/Maildir/
○Sendmail止める
# /etc/rc.d/init.d/sendmail stop
# chkconfig sendmail off
# chkconfig --list sendmail
# alternatives --config mta
○Postfix起動
# /etc/rc.d/init.d/postfix start
# chkconfig postfix on
# chkconfig --list postfix
続いてDovecot(今回はIMAPのみとする)
これも最後にまとめて追記。
#vi /etc/dovecot.conf
protocols = imap imaps
mail_location = maildir:~/Maildir
あと自動起動設定して完了。
なお、ユーザーiwataについてはiwata01.hoge.comにメールを転送するよう、.forwardファイルを設定しておく。
○mailman
mailmanもインスコしておく。
# yum install mailman
# vi /etc/mailman/mm_cfg.py
DEFAULT_URL_HOST = 'mail.hoge.com'
DEFAULT_EMAIL_HOST = 'hoge.com'
MTA = 'Postfix'
DEFAULT_SERVER_LANGUAGE = 'ja'
DEFAULT_GENERIC_NONMEMBER_ACTION = 2
DEFAULT_LIST_ADVERTISED = No
DEFAULT_SUBJECT_PREFIX = "[%(real_name)s:%%d] "
DEFAULT_REPLY_GOES_TO_LIST = 1
OWNERS_CAN_ENABLE_PERSONALIZATION = Yes
VERP_PERSONALIZED_DELIVERIES = Yes
# /usr/lib/mailman/bin/mmsitepass [パスワード]
# /usr/lib/mailman/bin/genaliases
aliasesが /etc/mailman/aliases に生成される。
# chown mailman. /etc/mailman/aliases*
# chmod g+w /etc/mailman/aliases*
# vi /etc/postfix/main.cf
alias_maps = hash:/etc/aliases, hash:/etc/mailman/aliases
# /etc/rc.d/init.d/postfix restart
# /etc/rc.d/init.d/httpd reload
ここまででインスコは完了。続いてデータ引き継いでおく。
# rsync -av 192.168.0.9:/etc/mailman /etc/
# rsync -av 192.168.0.9:/usr/lib/mailman /usr/lib/
# rsync -av 192.168.0.9:/var/lib/mailman /var/lib/
# rsync -av 192.168.0.9:/var/log/mailman /var/log/
あと、ドメイン変更は以下を参考に。
http://mm.tkikuchi.net/pipermail/mmjp-users/2004-June/000917.html
# /etc/rc.d/init.d/postfix restart
# /etc/rc.d/init.d/httpd reload
# /etc/rc.d/init.d/mailman restart
で完了。
○参考サイト
http://centossrv.com/postfix.shtml
○Postfix設定 全部最後にまとめて書く。
# vi /etc/postfix/main.cf
myhostname = mail01.hoge.com
mydomain = hoge.com
myorigin = $mydomain
inet_interfaces = all
#proxy_interfaces =
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
home_mailbox = Maildir/
#SMTP-Auth
smtpd_banner = $myhostname ESMTP unknown
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
#MailSizeLimitter 100MB
message_size_limit = 104857600
#MailBoxSizeLimitter 500MB
mailbox_size_limit = 512000000
mynetworks = 192.168.0.0/24, 127.0.0.0/8
relay_domains = $mydestination
#relayhost = op25b.asahi-net.or.jp
transport_maps = hash:/etc/postfix/transport
alias_maps = hash:/etc/aliases, hash:/etc/mailman/aliases
#manual setting
allow_mail_to_commands = alias,forward,include
allow_mail_to_files = alias,forward,include
disable_vrfy_command = yes
allow_percent_hack = yes
swap_bangpath = yes
forward_path = $home/.forward$recipient_delimiter$extension,$home/.forward
sendmail_path = /usr/sbin/sendmail
# vi /etc/postfix/transport
最後に追記
ezweb.ne.jp :mail.asahi-net.or.jp
.ezweb.ne.jp :mail.asahi-net.or.jp
docomo.ne.jp :mail.asahi-net.or.jp
.docomo.ne.jp :mail.asahi-net.or.jp
vodafone.ne.jp :mail.asahi-net.or.jp
.vodafone.ne.jp :mail.asahi-net.or.jp
softbank.ne.jp :mail.asahi-net.or.jp
.softbank.ne.jp :mail.asahi-net.or.jp
pdx.ne.jp :mail.asahi-net.or.jp
.pdx.ne.jp :mail.asahi-net.or.jp
○SMTP-AuthにシステムのID/PWを使う
# /etc/rc.d/init.d/saslauthd start
# chkconfig saslauthd on
# chkconfig --list saslauthd
○Maildir形式メールボックス自動作成
# mkdir -p /etc/skel/Maildir/new
# mkdir -p /etc/skel/Maildir/cur
# mkdir -p /etc/skel/Maildir/tmp
# chmod -R 700 /etc/skel/Maildir/
○Sendmail止める
# /etc/rc.d/init.d/sendmail stop
# chkconfig sendmail off
# chkconfig --list sendmail
# alternatives --config mta
○Postfix起動
# /etc/rc.d/init.d/postfix start
# chkconfig postfix on
# chkconfig --list postfix
続いてDovecot(今回はIMAPのみとする)
これも最後にまとめて追記。
#vi /etc/dovecot.conf
protocols = imap imaps
mail_location = maildir:~/Maildir
あと自動起動設定して完了。
なお、ユーザーiwataについてはiwata01.hoge.comにメールを転送するよう、.forwardファイルを設定しておく。
○mailman
mailmanもインスコしておく。
# yum install mailman
# vi /etc/mailman/mm_cfg.py
DEFAULT_URL_HOST = 'mail.hoge.com'
DEFAULT_EMAIL_HOST = 'hoge.com'
MTA = 'Postfix'
DEFAULT_SERVER_LANGUAGE = 'ja'
DEFAULT_GENERIC_NONMEMBER_ACTION = 2
DEFAULT_LIST_ADVERTISED = No
DEFAULT_SUBJECT_PREFIX = "[%(real_name)s:%%d] "
DEFAULT_REPLY_GOES_TO_LIST = 1
OWNERS_CAN_ENABLE_PERSONALIZATION = Yes
VERP_PERSONALIZED_DELIVERIES = Yes
# /usr/lib/mailman/bin/mmsitepass [パスワード]
# /usr/lib/mailman/bin/genaliases
aliasesが /etc/mailman/aliases に生成される。
# chown mailman. /etc/mailman/aliases*
# chmod g+w /etc/mailman/aliases*
# vi /etc/postfix/main.cf
alias_maps = hash:/etc/aliases, hash:/etc/mailman/aliases
# /etc/rc.d/init.d/postfix restart
# /etc/rc.d/init.d/httpd reload
ここまででインスコは完了。続いてデータ引き継いでおく。
# rsync -av 192.168.0.9:/etc/mailman /etc/
# rsync -av 192.168.0.9:/usr/lib/mailman /usr/lib/
# rsync -av 192.168.0.9:/var/lib/mailman /var/lib/
# rsync -av 192.168.0.9:/var/log/mailman /var/log/
あと、ドメイン変更は以下を参考に。
http://mm.tkikuchi.net/pipermail/mmjp-users/2004-June/000917.html
# /etc/rc.d/init.d/postfix restart
# /etc/rc.d/init.d/httpd reload
# /etc/rc.d/init.d/mailman restart
で完了。
オリジナルCMS HogeCMSの改造
■DBサーバ切り替え
このあたり。
# find ./ -name \*.php -print | xargs grep dbm01
mailsend/mail_send.php
edit.php
beacon.php
gallery/config.php
loginsys/login.php
beacon_bench.php
■キャッシュ対応
Squidを入れたので、キャッシュ制御をちゃんとせねばならん。
○common.php - 5分間キャッシュ有効
header("Expires: ".gmdate("D, d M Y H:i:s",time()+300)." GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s"). " GMT");
header("Cache-Control: public, max-age=300");
header("Vary: User-Agent");
※投稿フォームがキャッシュされると困るので、index.phpに手を入れないとダメだな・・・。。
○beacon.php - キャッシュさせない
header("Expires: Thu, 01 Dec 1994 16:00:00 GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s"). " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
○image.php - 5分間キャッシュ有効
header("Expires: ".gmdate("D, d M Y H:i:s",time()+300)." GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s"). " GMT");
header("Cache-Control: public, max-age=300");
header("Vary: User-Agent");
※下の方にキャッシュ無効設定が隠れているので注意
このあたり。
# find ./ -name \*.php -print | xargs grep dbm01
mailsend/mail_send.php
edit.php
beacon.php
gallery/config.php
loginsys/login.php
beacon_bench.php
■キャッシュ対応
Squidを入れたので、キャッシュ制御をちゃんとせねばならん。
○common.php - 5分間キャッシュ有効
header("Expires: ".gmdate("D, d M Y H:i:s",time()+300)." GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s"). " GMT");
header("Cache-Control: public, max-age=300");
header("Vary: User-Agent");
※投稿フォームがキャッシュされると困るので、index.phpに手を入れないとダメだな・・・。。
○beacon.php - キャッシュさせない
header("Expires: Thu, 01 Dec 1994 16:00:00 GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s"). " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
○image.php - 5分間キャッシュ有効
header("Expires: ".gmdate("D, d M Y H:i:s",time()+300)." GMT");
header("Last-Modified: ". gmdate("D, d M Y H:i:s"). " GMT");
header("Cache-Control: public, max-age=300");
header("Vary: User-Agent");
※下の方にキャッシュ無効設定が隠れているので注意
登録:
投稿 (Atom)