投げ銭

★当サイトへの投げ銭(PayPal)★

LINK


(無償、寄付歓迎) logo
世界中で使われるISO標準オフィスソフト(MSオフィス互換)

★LibreOfficeの導入事例★
詳細について

人気の投稿(1ヶ月間)

Ad

Ad

投げ銭

★当サイトへの投げ銭(PayPal)★

2014年4月29日火曜日

To install POPFile and its required Perl modules in minimal CentOS 6.5.


How to install POPFile in minimal CentOS 6.5.

Running POPFile uses some additional software.
So you need to install it before install POPFile.
The required software are Perl and certain Perl modules.

1. Perl
2. certain Perl modules


Following is how to install Perl and certain Perl modules.


(1) Check out Required Perl modules.

The current list of modules that you may need to install includes the following: says;
DBI
DBD::SQLite
Digest::base
Digest::MD5
HTML::Tagset
MIME::Base64
MIME::QuotedPrint
Date::Parse (all platforms except Windows)
HTML::Template
Encode (if you want Japanese/Korean language support)
IO::Socket::Socks (if you want to use a SOCKS proxy)
IO::Socket::SSL (if you want to use SSL)
Net::SSLeay (if you want to use SSL)
SOAP::Lite (if you want to use XMLRPC)



(2) Install Perl itself first.

Perl has some its modules being required of POPFile.

[root@localhost ~]# yum install perl
Installed:
  perl.x86_64 4:5.10.1-136.el6

Dependency Installed:
  perl-Module-Pluggable.x86_64 1:3.90-136.el6    perl-Pod-Escapes.x86_64 1:1.04-136.el6    perl-Pod-Simple.x86_64 1:3.13-136.el6    perl-libs.x86_64 4:5.10.1-136.el6
  perl-version.x86_64 3:0.77-136.el6



(3) Check whether or not Required Perl modules are in your CentOS 6.5 sytem.

The following commands can display the versions of installed modules.
If not installed the module in your system, the version is not displayed.


These results are about My PC CentOS 6.5 64bit edition with Perl installed.

<Installed>

Digest::base
[root@localhost ~]# perl -M-Digest::base -e 'print $Digest::base::VERSION'
1.16

Digest::MD5
[root@localhost ~]# perl -M-Digest::MD5 -e 'print $Digest::MD5::VERSION'
2.39

MIME::Base64
[root@localhost ~]# perl -M-MIME::Base64 -e 'print $MIME::Base64::VERSION'
3.08

MIME::QuotedPrint
[root@localhost ~]# perl -M-MIME::QuotedPrint -e 'print $MIME::QuotedPrint::VERSION'
3.08

Encode (if you want Japanese/Korean language support)
[root@localhost ~]# perl -M-Encode -e 'print $Encode::VERSION'
2.35


<Not Installed>
(a) DBI
(b) DBD::SQLite
(c) HTML::Tagset

(d) Date::Parse (all platforms except Windows)
(e) HTML::Template

(f) IO::Socket::Socks (if you want to use a SOCKS proxy)
(g) Net::SSLeay (if you want to use SSL)
(h) IO::Socket::SSL (if you want to use SSL)

(i) SOAP::Lite (if you want to use XMLRPC)

Perl modules in this list "NOT INSTALLED", need to be added in your system.



(4) Install POPFile Required Perl modules using YUM.


(a) DBI
[root@localhost ~]# yum install perl-DBI
Installed:
  perl-DBI.x86_64 0:1.609-4.el6

Complete!
(b) DBD::SQLite
[root@localhost ~]# yum install perl-DBD-SQLite
Installed:
  perl-DBD-SQLite.x86_64 0:1.27-3.el6

Complete!
(c) HTML::Tagset
[root@localhost ~]# yum install perl-HTML-Tagset
Installed:
  perl-HTML-Tagset.noarch 0:3.20-4.el6

Complete!
(d) Date::Parse (all platforms except Windows)
[root@localhost ~]# yum install perl-DateTime-Format-DateParse
Installed:
  perl-DateTime-Format-DateParse.noarch 0:0.04-1.1.el6

Dependency Installed:
  perl-Class-Singleton.noarch 0:1.4-6.el6         perl-DateTime.x86_64 1:0.5300-2.el6
  perl-List-MoreUtils.x86_64 0:0.22-10.el6        perl-Params-Validate.x86_64 0:0.92-3.el6
  perl-TimeDate.noarch 1:1.16-11.1.el6

Complete!
[root@localhost ~]# yum deplist perl-DateTime-Format-DateParse | grep Date::Parse
  dependency: perl(Date::Parse)
  dependency: perl(Date::Parse) >= 2.27
(e) HTML::Template

This module is in EPEL repository.

[root@localhost ~]# yum localinstall http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@localhost ~]# yum install perl-HTML-Template
Installed:
  perl-HTML-Template.noarch 0:2.9-10.el6

Complete!
(f) IO::Socket::Socks (if you want to use a SOCKS proxy)

I can not find this module in yum repository.
This is for SOCKS proxy. I do not need this module.

(g) Net::SSLeay (if you want to use SSL)
[root@localhost ~]# yum install perl-Net-SSLeay
Installed:
  perl-Net-SSLeay.x86_64 0:1.35-9.el6

Complete!
(h) IO::Socket::SSL (if you want to use SSL)
[root@localhost ~]# yum install perl-IO-Socket-SSL
Installed:
  perl-IO-Socket-SSL.noarch 0:1.31-2.el6

Dependency Installed:
  perl-Net-LibIDN.x86_64 0:0.12-3.el6

Complete!
(i) SOAP::Lite (if you want to use XMLRPC)
[root@localhost ~]# yum install perl-SOAP-Lite
Installed:
  perl-SOAP-Lite.noarch 0:0.710.10-3.el6

Dependency Installed:
  perl-Email-Date-Format.noarch 0:1.002-5.el6         perl-MIME-Lite.noarch 0:3.027-2.el6
  perl-MIME-Types.noarch 0:1.28-2.el6                 perl-MailTools.noarch 0:2.04-4.el6
  perl-URI.noarch 0:1.40-2.el6

Complete!

Done ! POPFile required Perl and its modules are installed.




Following is how to install POPFile itself.


(5) Download POPFile.

I selected the Newest version for Cross-platform.

[root@localhost popfile-v1.1.3]# wget http://getpopfile.org/downloads/popfile-1.1.3.zip
[root@localhost popfile-v1.1.3]# ls
popfile-1.1.3.zip


(6) Install POPFile.

To install POPFile is only to extract the downloaded ZIP file.

First, I installed unzip to extract a ZIP file.

[root@localhost software]# yum install unzip
Installed:
  unzip.x86_64 0:6.0-1.el6

I extracted the downloaded POPFile ZIP file.

[root@localhost popfile-v1.1.3]# unzip popfile-1.1.3.zip
[root@localhost popfile-v1.1.3]# ls
Classifier  bayes.pl     license   popfile-1.1.3.zip  v1.1.3.change
POPFile     black.gif    otto.gif  popfile.pck        v1.1.3.change.nihongo
Proxy       favicon.ico  otto.png  popfile.pl
Services    insert.pl    pipe.pl   skins
UI          languages    pix.gif   stopwords




(7) Start POPFile once to get a configuration file.

I stated POPFile, and then stop it using key CTRL and C simultaneously.
POPFile made a configuration file.

[root@localhost popfile-v1.1.3]# perl ./popfile.pl
POPFile Engine loading

    Loading...
         {core: config history mq logger}
         {classifier: wordmangle bayes}
         {interface: xmlrpc html}
         {proxy: smtp pop3 nntp}
         {services: imap}

POPFile Engine v1.1.3 starting

    Initializing...
         {core: config history logger mq}
         {classifier: bayes wordmangle}
         {interface: html xmlrpc}
         {proxy: nntp pop3 smtp}
         {services: imap}

    Starting...
         {core: config history logger mq}
         {classifier: bayes wordmangle}
         {interface: html}
         {proxy: pop3}
         {services:}

POPFile Engine v1.1.3 running

Here Push CTRL and C simultaneously.
^C

POPFile Engine v1.1.3 stopping

    Stopping...
         {classifier: bayes wordmangle}
         {core: config history logger mq}
         {interface: html}
         {proxy: pop3}
         {services:}

POPFile Engine v1.1.3 terminated

The file "popfile.cfg" is POPFile configuration file.

[root@localhost popfile-v1.1.3]# ls
Classifier  favicon.ico  pipe.pl            popfile1386720000.log
POPFile     insert.pl    pix.gif            skins
Proxy       languages    popfile-1.1.3.zip  stopwords
Services    license      popfile.cfg        v1.1.3.change
UI          messages     popfile.db         v1.1.3.change.nihongo
bayes.pl    otto.gif     popfile.pck
black.gif   otto.png     popfile.pl

2014年4月23日水曜日

【Linux CentOS 6.5 64bit minimal】 POPFileインストール手順 (依存PerlモジュールをYUMで導入し、POPFileの起動と初期設定を完了させる)

更新:2016年11月7日(ダウンロード先、CentOS 6.8 minimal対応確認)


CentOS 6.5 64bit minimal に、POPFileをインストールし、動作させるためには、
次の三種類に分けられるソフトウェアをあらかじめ準備しておく必要がある。

<1> Perl本体
<2> Perlモジュール(基本的なもの)
<3> Perlモジュール(mecab-perl)が依存しているソフトウェア


これらのソフトウェアを正しくインストールした後で、
POPFile本体をインストールし、起動し、基本的な設定を行う。

以下は、CentOS 6.5 64bit minimalに、POPFileをインストールする手順である。


手順では、必要なソフトウェアの圧縮済ファイルを解凍しインストールするところがある。
それらのファイルは別途ダウンロードしておき、作業の際にはそれを指定する必要がある。

2016年11月7日現在では、下記サイトに、ダウンロードリンクが掲載されている。
http://taku910.github.io/mecab/#download

下記、三種類のファイルをダウンロードしておく。
・ MeCab 本体(mecab-0.996.tar.gz)

 MeCab 用の辞書(mecab-ipadic-2.7.0-20070801.tar.gz)
IPA 辞書
IPA 辞書, IPAコーパス に基づき CRF でパラメータ推定した辞書です。 (推奨)


・ perl/ruby/python/java バインディング(mecab-perl-0.996.tar.gz)



■POPFileが要求する「Perlモジュール(基本的なもの<2>)」が何であるか確かめた

次のサイトに要求されるPerlモジュールが下記のように列挙されていた。
The current list of modules that you may need to install includes the following:

DBI
DBD::SQLite
Digest::base
Digest::MD5
HTML::Tagset
MIME::Base64
MIME::QuotedPrint
Date::Parse (all platforms except Windows)
HTML::Template
Encode (if you want Japanese/Korean language support)
IO::Socket::Socks (if you want to use a SOCKS proxy)
IO::Socket::SSL (if you want to use SSL)
Net::SSLeay (if you want to use SSL)
SOAP::Lite (if you want to use XMLRPC)
以下では、列挙されたすべてのPerlモジュールをシステムに導入する。



■とにかくまずは、Perlをインストールした

PerlをYUMを使ってインストールした。
インストールに伴って、いくつかのPerlモジュールも導入されるようなので、第一に行う

[root@localhost ~]# yum install perl
Installed:
  perl.x86_64 4:5.10.1-136.el6

Dependency Installed:
  perl-Module-Pluggable.x86_64 1:3.90-136.el6    perl-Pod-Escapes.x86_64 1:1.04-136.el6    perl-Pod-Simple.x86_64 1:3.13-136.el6    perl-libs.x86_64 4:5.10.1-136.el6
  perl-version.x86_64 3:0.77-136.el6



■要求されるPerlモジュール(基本的なもの<2>)がシステムに存在するか確認した

次のようにコマンドを入力すると、存在するモジュールについてバージョンが返される。
この方法で、要求されるモジュールについて有無を確認した。


○要求されるモジュールのうち、下記はインストール済みである

Digest::base
[root@localhost ~]# perl -M-Digest::base -e 'print $Digest::base::VERSION'
1.16

Digest::MD5
[root@localhost ~]# perl -M-Digest::MD5 -e 'print $Digest::MD5::VERSION'
2.39

MIME::Base64
[root@localhost ~]# perl -M-MIME::Base64 -e 'print $MIME::Base64::VERSION'
3.08

MIME::QuotedPrint
[root@localhost ~]# perl -M-MIME::QuotedPrint -e 'print $MIME::QuotedPrint::VERSION'
3.08

Encode (if you want Japanese/Korean language support)
[root@localhost ~]# perl -M-Encode -e 'print $Encode::VERSION'
2.35


○要求されるモジュールのうち、下記のものはシステムに存在せず、インストールが別途必要である
(1) DBI
(2) DBD::SQLite
(3) HTML::Tagset

(4) Date::Parse (all platforms except Windows)
(5) HTML::Template

(6) IO::Socket::Socks (if you want to use a SOCKS proxy)
(7) Net::SSLeay (if you want to use SSL)
(8) IO::Socket::SSL (if you want to use SSL)

(9) SOAP::Lite (if you want to use XMLRPC)



■上で確かめたシステムに無いPerlモジュール(基本的なもの<2>)をインストールした


Perlモジュールのインストールは、YUMで行った。

(1) DBI
[root@localhost ~]# yum install perl-DBI
Installed:
  perl-DBI.x86_64 0:1.609-4.el6

Complete!
(2) DBD::SQLite
[root@localhost ~]# yum install perl-DBD-SQLite
Installed:
  perl-DBD-SQLite.x86_64 0:1.27-3.el6

Complete!
(3) HTML::Tagset
[root@localhost ~]# yum install perl-HTML-Tagset
Installed:
  perl-HTML-Tagset.noarch 0:3.20-4.el6

Complete!
(4) Date::Parse (all platforms except Windows)
[root@localhost ~]# yum install perl-DateTime-Format-DateParse
Installed:
  perl-DateTime-Format-DateParse.noarch 0:0.04-1.1.el6

Dependency Installed:
  perl-Class-Singleton.noarch 0:1.4-6.el6         perl-DateTime.x86_64 1:0.5300-2.el6
  perl-List-MoreUtils.x86_64 0:0.22-10.el6        perl-Params-Validate.x86_64 0:0.92-3.el6
  perl-TimeDate.noarch 1:1.16-11.1.el6

Complete!
[root@localhost ~]# yum deplist perl-DateTime-Format-DateParse | grep Date::Parse
  dependency: perl(Date::Parse)
  dependency: perl(Date::Parse) >= 2.27
(5) HTML::Template

このPerlモジュールはepelリポジトリにあるため、リポジトリの準備も予め行った。

[root@localhost ~]# yum localinstall http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
[root@localhost ~]# yum install perl-HTML-Template
Installed:
  perl-HTML-Template.noarch 0:2.9-10.el6

Complete!
(6) IO::Socket::Socks (if you want to use a SOCKS proxy)

このPerlモジュールは、YUMリポジトリに見つけられなかった。
しかし、SOCKSを使わないなら、不要のようである。

(7) Net::SSLeay (if you want to use SSL)
[root@localhost ~]# yum install perl-Net-SSLeay
Installed:
  perl-Net-SSLeay.x86_64 0:1.35-9.el6

Complete!
(8) IO::Socket::SSL (if you want to use SSL)
[root@localhost ~]# yum install perl-IO-Socket-SSL
Installed:
  perl-IO-Socket-SSL.noarch 0:1.31-2.el6

Dependency Installed:
  perl-Net-LibIDN.x86_64 0:0.12-3.el6

Complete!
(9) SOAP::Lite (if you want to use XMLRPC)
[root@localhost ~]# yum install perl-SOAP-Lite
Installed:
  perl-SOAP-Lite.noarch 0:0.710.10-3.el6

Dependency Installed:
  perl-Email-Date-Format.noarch 0:1.002-5.el6         perl-MIME-Lite.noarch 0:3.027-2.el6
  perl-MIME-Types.noarch 0:1.28-2.el6                 perl-MailTools.noarch 0:2.04-4.el6
  perl-URI.noarch 0:1.40-2.el6

Complete!

以上で、Perlモジュール(基本的なもの<2>)のシステムへの導入は完了である。



■Perlモジュール(mecab-perl<3>)が依存するソフトウェアを先ずインストールした

Perlモジュール(mecab-perl<3>)が依存するソフトウェアは、mecabという日本語解析ソフトウェアである。


1、CentOS 6.5 minimalなので、開発環境のインストールからはじめた。

[root@localhost ~]# yum install gcc gcc-c++
Installed:
  gcc.x86_64 0:4.4.7-4.el6             gcc-c++.x86_64 0:4.4.7-4.el6

Dependency Installed:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6            cpp.x86_64 0:4.4.7-4.el6
  libstdc++-devel.x86_64 0:4.4.7-4.el6         mpfr.x86_64 0:2.4.1-6.el6
  ppl.x86_64 0:0.10.2-11.el6

Complete!

2、mecabという日本語解析ソフトウェアをインストールした。

・minimalにはwgetもなかったので、インストールした。

[root@localhost mecab]# yum install wget


・mecabの最新バージョン0.996(2014年4月現在)をダウンロードした。

[root@localhost mecab]# wget mecab-0.996.tar.gz
長さ: 1398663 (1.3M) [application/x-gzip]
`mecab-0.996.tar.gz' に保存中
`mecab-0.996.tar.gz' へ保存完了 [1398663/1398663]

・次のファイルが取得されたのを確認した。

[root@localhost mecab-0.996]# ls
mecab-0.996.tar.gz

・解凍を行い、生成されたフォルダを開いた。

[root@localhost mecab-0.996]# tar -zxvf mecab-0.996.tar.gz
[root@localhost mecab-0.996]# cd mecab-0.996


・インストール作業を次のように順に行った。

[root@localhost mecab-0.996]# ./configure
(略)
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/Makefile.msvc
config.status: creating man/Makefile
config.status: creating doc/Makefile
config.status: creating tests/Makefile
config.status: creating swig/version.h
config.status: creating mecab.iss
config.status: creating mecab-config
config.status: creating mecabrc
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default commands
[root@localhost mecab-0.996]# make
[root@localhost mecab-0.996]# make install


3、mecabが利用する専用の辞書をインストールした

・mecab用辞書の最新バージョン2.7.0(2014年4月現在)をダウンロードした。

[root@localhost mecab]# wget mecab-ipadic-2.7.0-20070801.tar.gz
長さ: 12208105 (12M) [application/octet-stream]
`mecab-ipadic-2.7.0-20070801.tar.gz' に保存中
`mecab-ipadic-2.7.0-20070801.tar.gz' へ保存完了 [12208105/12208105]

・次のファイルが取得されたのを確認した。

[root@localhost mecab-ipadic-2.7.0]# ls
mecab-ipadic-2.7.0-20070801.tar.gz

・解凍を行い、生成されたフォルダを開いた。

[root@localhost mecab]#  tar -zxvf mecab-ipadic-2.7.0-20070801.tar.gz
[root@localhost mecab-ipadic-2.7.0]# cd mecab-ipadic-2.7.0-20070801


・インストール作業を次のように順に行った。

[root@localhost mecab-ipadic-2.7.0-20070801]# ./configure --with-charset=utf8
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets $(MAKE)... yes
checking for working aclocal-1.4... missing
checking for working autoconf... missing
checking for working automake-1.4... missing
checking for working autoheader... missing
checking for working makeinfo... missing
checking for a BSD-compatible install... /usr/bin/install -c
checking for mecab-config... /usr/local/bin/mecab-config
configure: creating ./config.status
config.status: creating Makefile

次のmakeコマンド時に、下に示すようなエラーが出た場合は、まず ldconfigコマンドを実行する必要があった。
/usr/local/libexec/mecab/mecab-dict-index -d . -o . -f EUC-JP -t utf8
/usr/local/libexec/mecab/mecab-dict-index: error while loading shared libraries: libmecab.so.2: cannot open shared object file: No such file or directory
make: *** [matrix.bin] Error 127

[root@localhost mecab-ipadic-2.7.0-20070801]# make
 /usr/local/libexec/mecab/mecab-dict-index -d . -o . -f EUC-JP -t utf8
reading ./unk.def ... 40
emitting double-array: 100% |###########################################|
./model.def is not found. skipped.
reading ./Conjunction.csv ... 171
(略)
done!
echo To enable dictionary, rewrite /usr/local/etc/mecabrc as \"dicrc = /usr/local/lib/mecab/dic/ipadic\"
To enable dictionary, rewrite /usr/local/etc/mecabrc as "dicrc = /usr/local/lib/mecab/dic/ipadic"
[root@localhost mecab-ipadic-2.7.0-20070801]# make install
make[1]: ディレクトリ `/root/software/mecab/mecab-ipadic-2.7.0-20070801' に入ります
make[1]: `install-exec-am' に対して行うべき事はありません.
/bin/sh ./mkinstalldirs /usr/local/lib/mecab/dic/ipadic
mkdir /usr/local/lib/mecab
mkdir /usr/local/lib/mecab/dic
mkdir /usr/local/lib/mecab/dic/ipadic
 /usr/bin/install -c -m 644 ./matrix.bin /usr/local/lib/mecab/dic/ipadic/matrix.bin
 /usr/bin/install -c -m 644 ./char.bin /usr/local/lib/mecab/dic/ipadic/char.bin
 /usr/bin/install -c -m 644 ./sys.dic /usr/local/lib/mecab/dic/ipadic/sys.dic
 /usr/bin/install -c -m 644 ./unk.dic /usr/local/lib/mecab/dic/ipadic/unk.dic
 /usr/bin/install -c -m 644 ./left-id.def /usr/local/lib/mecab/dic/ipadic/left-id.def
 /usr/bin/install -c -m 644 ./right-id.def /usr/local/lib/mecab/dic/ipadic/right-id.def
 /usr/bin/install -c -m 644 ./rewrite.def /usr/local/lib/mecab/dic/ipadic/rewrite.def
 /usr/bin/install -c -m 644 ./pos-id.def /usr/local/lib/mecab/dic/ipadic/pos-id.def
 /usr/bin/install -c -m 644 ./dicrc /usr/local/lib/mecab/dic/ipadic/dicrc
make[1]: ディレクトリ `/root/software/mecab/mecab-ipadic-2.7.0-20070801' から出ます


4、mecabの動作テストを行った

mecabコマンドを発行すると、入力待ちになるので、適当な日本語文を打ってからエンターを打つ。
結果が確認できたら、CTRL + C で終了する。

[root@localhost mecab-ipadic-2.7.0-20070801]# mecab
これでメカブのインストールは完了しました
これ    名詞,代名詞,一般,*,*,*,これ,コレ,コレ
で      助詞,格助詞,一般,*,*,*,で,デ,デ
メカブ  名詞,一般,*,*,*,*,*
の      助詞,連体化,*,*,*,*,の,ノ,ノ
インストール    名詞,一般,*,*,*,*,インストール,インストール,インストール
は      助詞,係助詞,*,*,*,*,は,ハ,ワ
完了    名詞,サ変接続,*,*,*,*,完了,カンリョウ,カンリョー
し      動詞,自立,*,*,サ変・スル,連用形,する,シ,シ
まし    助動詞,*,*,*,特殊・マス,連用形,ます,マシ,マシ
た      助動詞,*,*,*,特殊・タ,基本形,た,タ,タ
EOS
^C

以上で、mecabのインストールは完了した。



■Perlモジュール(mecab-perl<3>)をインストールした

上で、Perlモジュール(mecab-perl<3>)が依存するソフトウェアであるmecabが導入できたら、
以下の作業も問題なく終了した。


・Perlモジュール(mecab-perl<3>)は、上でインストール完了したmecabのバージョンと同じものをダウンロードした。

[root@localhost mecab-perl-0.996]# wget mecab-perl-0.996.tar.gz
長さ: 49888 (49K) [application/x-gzip]
`mecab-perl-0.996.tar.gz' に保存中
`mecab-perl-0.996.tar.gz' へ保存完了 [49888/49888]

・解凍を行い、生成されたフォルダを開いた。

[root@localhost mecab-perl-0.996]# tar -zxvf mecab-perl-0.996.tar.gz
[root@localhost mecab-perl-0.996]# cd mecab-perl-0.996


・この後のインストール作業に必要なパッケージをYUMで導入した。

ダウンロードしたmecab-perlは、Makefile作成用の作業用スクリプトを持っている。
これを正しく動作させるためには、次のパッケージが必要だった。(なければエラーになった。)

[root@localhost mecab-perl-0.996]# yum install perl-ExtUtils-MakeMaker
Installed:
  perl-ExtUtils-MakeMaker.x86_64 0:6.55-136.el6

Dependency Installed:
  db4-cxx.x86_64 0:4.7.25-18.el6_4          db4-devel.x86_64 0:4.7.25-18.el6_4   gdbm-devel.x86_64 0:1.8.0-36.el6   perl-ExtUtils-ParseXS.x86_64 1:2.2003.0-136.el6
  perl-Test-Harness.x86_64 0:3.17-136.el6   perl-devel.x86_64 4:5.10.1-136.el6

Complete!

・Makefileを作成する作業用スクリプトを実行した。

[root@localhost mecab-perl-0.996]# perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for MeCab
これで、Makefileが作成されたようだ。


・インストール作業を次のように順に行った。

[root@localhost mecab-perl-0.996]# make
cp MeCab.pm blib/lib/MeCab.pm
g++ -c  -I/usr/local/include -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic   -DVERSION=\"0.996\" -DXS_VERSION=\"0.996\" -fPIC "-I/usr/lib64/perl5/CORE"   MeCab_wrap.cxx
MeCab_wrap.cxx: In function ‘int SWIG_AsVal_unsigned_SS_long(SV*, long unsigned int*)’:
MeCab_wrap.cxx:1846: 警告: 符合付きと符合無しの整数式同士の比較です
MeCab_wrap.cxx: In function ‘void boot_MeCab(PerlInterpreter*, CV*)’:
MeCab_wrap.cxx:7372: 警告: unused variable ‘items’
Running Mkbootstrap for MeCab ()
chmod 644 MeCab.bs
rm -f blib/arch/auto/MeCab/MeCab.so
g++  -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic MeCab_wrap.o  -o blib/arch/auto/MeCab/MeCab.so     \
           -L/usr/local/lib -lmecab -lstdc++    \

chmod 755 blib/arch/auto/MeCab/MeCab.so
cp MeCab.bs blib/arch/auto/MeCab/MeCab.bs
chmod 644 blib/arch/auto/MeCab/MeCab.bs
[root@localhost mecab-perl-0.996]# make install
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /usr/local/lib64/perl5/auto/MeCab/MeCab.bs
Installing /usr/local/lib64/perl5/auto/MeCab/MeCab.so
Installing /usr/local/lib64/perl5/MeCab.pm
Appending installation info to /usr/lib64/perl5/perllocal.pod




■以上の全作業を終えて、ようやくPOPFile本体をダウンロード、インストールした。


・最新バージョン1.1.3(2014年4月現在)をダウンロードした。
Linuxマシンへのインストールなので、Cross-platform版を選択した。

[root@localhost popfile-v1.1.3]# wget http://getpopfile.org/downloads/popfile-1.1.3.zip
[root@localhost popfile-v1.1.3]# ls
popfile-1.1.3.zip

・zip解凍ソフトウェアであるunzipパッケージをインストールした。

[root@localhost software]# yum install unzip
Installed:
  unzip.x86_64 0:6.0-1.el6

・zipファイルを解凍した。

[root@localhost popfile-v1.1.3]# unzip popfile-1.1.3.zip
[root@localhost popfile-v1.1.3]# ls
Classifier  bayes.pl     license   popfile-1.1.3.zip  v1.1.3.change
POPFile     black.gif    otto.gif  popfile.pck        v1.1.3.change.nihongo
Proxy       favicon.ico  otto.png  popfile.pl
Services    insert.pl    pipe.pl   skins
UI          languages    pix.gif   stopwords
解凍すると、以上のようにファイルが得られるので、適切なディレクトリで作業を行った。

POPFile本体のインストールはこれで完了した。



■インストールしたPOPFileの初期設定を行った


・設定用テンプレートを自動生成させるために、POPFileを一度起動させてから、終了させた。

[root@localhost popfile-v1.1.3]# perl ./popfile.pl
POPFile Engine loading

    Loading...
         {core: config history mq logger}
         {classifier: wordmangle bayes}
         {interface: xmlrpc html}
         {proxy: smtp pop3 nntp}
         {services: imap}

POPFile Engine v1.1.3 starting

    Initializing...
         {core: config history logger mq}
         {classifier: bayes wordmangle}
         {interface: html xmlrpc}
         {proxy: nntp pop3 smtp}
         {services: imap}

    Starting...
         {core: config history logger mq}
         {classifier: bayes wordmangle}
         {interface: html}
         {proxy: pop3}
         {services:}

POPFile Engine v1.1.3 running

ここで、CTRL + Cで強制終了させた。
^C

POPFile Engine v1.1.3 stopping

    Stopping...
         {classifier: bayes wordmangle}
         {core: config history logger mq}
         {interface: html}
         {proxy: pop3}
         {services:}

POPFile Engine v1.1.3 terminated


・生成されたテンプレートファイル名を確認した。

[root@localhost popfile-v1.1.3]# ls
Classifier  favicon.ico  pipe.pl            popfile1386720000.log
POPFile     insert.pl    pix.gif            skins
Proxy       languages    popfile-1.1.3.zip  stopwords
Services    license      popfile.cfg        v1.1.3.change
UI          messages     popfile.db         v1.1.3.change.nihongo
bayes.pl    otto.gif     popfile.pck
black.gif   otto.png     popfile.pl

・初期設定を行った。

[root@localhost popfile-v1.1.3]# vi popfile.cfg
下では、パラメーターの内、初期設定として有用な一部だけを取り上げている。
bayes_nihongo_parser MeCab 大文字小文字に注意。さもなければ動作せず文字化けする。
html_language Nihongo ←日本語メールの処理、GUIの日本語化
html_local 0 ←127.0.0.1以外のインターフェイスへのアクセスでもGUIにアクセス許可(ただし、予めIPフィルタの設定を必ず適切に行っておくこと)
html_port 8081 ←GUIアクセスのためのTCPポートの設定


■初期設定を完了したPOPFileを起動した


・バックグラウンドで動作させるために、次の形式でコマンドを入力した。

[root@localhost popfile-v1.1.3]# perl ./popfile.pl &
[1] 9903
[root@localhost popfile-v1.1.3]#
POPFile Engine loading

    Loading...
         {core: config history mq logger}
         {classifier: wordmangle bayes}
         {interface: xmlrpc html}
         {proxy: smtp pop3 nntp}
         {services: imap}

POPFile Engine v1.1.3 starting

    Initializing...
         {core: config history logger mq}
         {classifier: bayes wordmangle}
         {interface: html xmlrpc}
         {proxy: nntp pop3 smtp}
         {services: imap}

    Starting...
         {core: config history logger mq}
         {classifier: bayes wordmangle}
         {interface: html}
         {proxy: pop3}
         {services:}

POPFile Engine v1.1.3 running


・TCPポートが待機状態になっているかを確認した。

[root@localhost software]# netstat -ltn
tcp        0      0 0.0.0.0:8081                0.0.0.0:*                   LISTEN
このような行がみつかれば、設定した通りに(tcp 8081)ポートが開いている。



・終了するために、次のようにして、perlプロセスを探してkillコマンドを発行した。
(同名で必要なプロセスを終了しないように要注意!)


[root@localhost popfile-v1.1.3]# cat popfile.pid

あるいは、

[root@localhost software]# ps -A | grep perl
10944 pts/3    00:00:00 perl
[root@localhost software]# kill 10944
POPFile Engine v1.1.3 stopping

[root@localhost software]#     Stopping...
         {classifier: bayes wordmangle}
         {core: config history logger mq}
         {interface: html}
         {proxy: pop3}
         {services:}

POPFile Engine v1.1.3 terminated
^C
[1]+  終了                  perl ./popfile.pl


★POPFileの簡単な仕組み説明や、起動時の自動起動方法、障害検出と自動回復などの方法については、
次のドキュメントを参照してみてください。
【Linux CentOS 5.6】迷惑メール分類プロキシサーバPOPFileと、MeCabの連携システム構築作業メモ



(参考)
・A Working Perl Installation is Required
< http://getpopfile.org/docs/howtos:allplatformsrequireperl > 2014年4月23日

・MeCab: Yet Another Part-of-Speech and Morphological Analyzer
< http://mecab.googlecode.com/svn/trunk/mecab/doc/index.html > 2014年4月23日

・Centos6のPerl5.10.1には標準モジュールが足りない件について
< http://d.hatena.ne.jp/perlcodesample/20120603/1339333786 > 2014年4月23日

・【Linux CentOS 5.6】迷惑メール分類プロキシサーバPOPFileと、MeCabの連携システム構築作業メモ
< http://akira-arets.blogspot.jp/2011/06/centos56popfilemecab.html > 2014年4月23日

・donbulinuxVPS 鯖に git いれたよ
< http://d.hatena.ne.jp/donbulinux/20111017/1318835429 > 2014年4月17日

・MeCab: Yet Another Part-of-Speech and Morphological Analyzer
< http://taku910.github.io/mecab/ > 2016年11月7日

・インストール/MeCabのインストール
< http://getassoc.cs.nii.ac.jp/?%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB%2FMeCab%E3%81%AE%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB > 2016年12月19日

・IPADIC(IPA辞書)とはなにものか?
< http://parame.mwj.jp/blog/0209 > 2016年12月19日

・毎週2回、Web上の最新のコーパスを追加したMeCab辞書が、mecab-ipadic-neologdとして、GitHub 上で公開されている
< http://qiita.com/HirofumiYashima/items/6476e987d6318818eefc > 2016年12月19日

投げ銭

★当サイトへの投げ銭(PayPal)★

Ad

Ad