2012年6月7日 星期四

Ubuntu 12.04下安裝SendmailAnalyzer

先至SendmailAnalyzer官網下載SendmailAnalyzer,並將檔案放至要安裝的Linux主機上。
SendmailAnalyzer官方有寫明安裝的系統需求,轉載如下:

Requirement

SendmailAnalyzer can work in any platform where Sendmail and Perl could run. What you need is a modern Perl distribution 5.8.x or more is good but older version should also work.
You need the following Perl modules. If they are not yet include in your OS distribution you can always find them at http://search.cpan.org/
        MIME::Base64;
        MIME::QuotedPrint;
        GD
        GD::Graph
        GD::TextUtil
        GD::Graph::bars3d;
Or if you have Internet access from your server, you can execute the following command to install GD::Graph::bars3d and all its dependencies.
 perl -MCPAN -e 'install GD::Graph::bars3d'
The graph output are generated using the libgd and libpng. You can get them at the following places:
 http://www.libgd.org/
 http://www.libpng.org/
安裝:
先至下載的SendmailAnalyzer檔案位置下,執行
tar xzf sendmailanalyzer-x.x.tar.gz
接著進入解壓縮的資料夾內
cd sendmailanalyzer-x.x/
以管理員身分執行以下指令
perl Makefile.PL
make && make install
預設會將SendmailAnalyzer安裝在/usr/local/sendmailanalyzer,接著修改
/usr/local/sendmailanalyzer/sendmailanalyzer.conf內容,將LOG_FILE修改如下
LOG_FILE        /var/log/mail.log
存檔後離開! 
接著到apache下新增一個
SendmailAnalyzer site讓SendmailAnalyzer使用。
cd /etc/apache2/sites-available/
vim sendmailanalyzer
接著輸入如下內容
Alias /SendmailAnalyzer /usr/local/sendmailanalyzer/www
<Directory /usr/local/sendmailanalyzer/www>
  Options ExecCGI
  AddHandler cgi-script .cgi
  DirectoryIndex sa_report.cgi
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
  Allow from 192.168.1.0/24
</Directory>
上方設定只允許server本機及192.168.1.0/24登入SendmailAnalyzer
接著啟用SendmailAnalyzer site並重新載入apache
a2ensite sendmailanalyzer
service apache2 reload

接著設定SendmailAnalyzer成為服務,並使其在系統開機時自動啟動
在/etc/init.d下做/usr/local/sendmailanalyzer下sendmailanalyzer的聯結
ln /usr/local/sendmailanalyzer 
執行update-rc.d 讓sendmailanalyzer成為服務
update-rc.d sendmailanalyzer defaults

設定crontab讓sendermailanalyzer每5分鐘讀取一次mail.log
crontab -e
*/5 * * * * /usr/local/sendmailanalyzer/sa_cache -a > /dev/null 2>&1

至此,sendermailanalyzer安裝完成,若進入sendermailanalyzer畫面卻看不到圖表,應該是有缺少某些Perl modules,試試以下指令:
apt-get update
apt-get install php5 php5-gd libtemplate-plugin-gd-perl



沒有留言:

張貼留言