GlpiによるIT資産管理とocsinvetory-ngによるインベントリ情報収集 
 
日本語対応とインストールと設定について
ocsinventory-ng  Open Computer and Software Inventory Next Generation
glpi  Free IT and asset management software

日本語対応パッチ入りのocsinventory-ngportsです。ベースは1.02です。
ダウンロードはこちらから

ports_ocsinventory-ng-1.02.tgz

ports_ocsinventory-ng-1.02.1.tgz

glpiは日本語対応がされていますので、ほぼ問題ありません。
ocsinventory-ngで日本語を扱えるようにするにはちょっとした変更が必要です。

上記ソフトウエアの実行するには
apache,php,mysql,perlといったソフトウエアが必要です。

glpiのインストール前にインストールしておくべきソフトウエア
今回はmysql6.0を使ってみましたが、5.xでも4.xでも動作すると思います。mysql60-serverのインストール時には
make WITH_CHARSET=utf8 WITH_XCHARSET=all
で標準の文字コードをuft8にしておく。

cd /usr/ports/databases/mysql60-server
make
make install
cp /usr/local/share/mysql/my-medium.cnf /usr/local/etc/my.conf
vi /usr/local/etc/my.conf

セクション[client],[mysqld],[mysql]
default_character_set = utf8
の行を追加します。



mysqlのインストールが終わったら、すぐにデータベースにパスワードを設定しましょう。

mysql
mysql> grant all on *.* to root@localhost identified by ‘mypassword’;
mysql> quit;





php5のインストール
/usr/ports/lang/php5をインストールします。
インストールが終わったら日本語に関する設定を追加します。

cd /usr/ports/lang/php5
make
make install
cp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini
vi /usr/local/etc/php.ini

日本語に関する設定を追加します。
;include_path = ".:/php/includes"
include_path = "/usr/local/include/php:/usr/local/share/pear
;session.save_path = "/tmp"
session.save_path = "/tmp"
;mbstring.language = Japanese
mbstring.language = Japanese
;mbstring.internal_encoding = EUC-JP
mbstring.internal_encoding = UTF-8
;mbstring.http_output = SJIS
mbstring.http_output = UTF-8

mod_perl2
このmod_perl2をインストールし終わった/etc/make.confWITH_MODPERL2=yes
の行を追加しておくこと、これを忘れるとglpiのインストール時にmod_perl1.3が使用されて悲しいことになる。


以下の二つもglpiのインストール前に、手動でいれておくこと。
■p5-DBD-mysql60-4.010php5-mysql-5.2.9ocsinventory-ngのインストール
portsからocsinventory-ngをインストールすると、セットアップに必用なファイルが
/usr/local/share/ocsinventory-ng
にコピーされます。
/usr/local/share/ocsinventory-ng/setup.shを実行します。

cd /usr/ports/net-mgnt/ocsinventory-ng
make
make install

cd /usr/local/share/ocsinventory-ng
./setup.sh

上記setup.shの実行で/etc/logrotate.dが無いとエラーになります。

mkdir /usr/local/etc/logrotate.d
ln -s /usr/local/etc/logrotate.d /etc/logrotate.d

無いディレクトリは作ってやります。

上記のportsからインストールされるocsinventory-ng1.01で少々古いことに気がついた。
現在は1.02が最新版
セットアップを実行して動作確認したところでocsinventory-ngをアンインストール。
http://sourceforge.net/project/downloading.php?group_id=58373&filename=OCSNG_UNIX_SERVER-1.02.tar.gz
または、
http://jaist.dl.sourceforge.net/sourceforge/ocsinventory/OCSNG_UNIX_SERVER-1.02.tar.gz
こちらを/usr/local/share/ocsinventory-ng/へ解凍する。
setup.shを実行。
データーベースがlatin1で作られてしまいました。
これではだめなのでデータベースocswebを一旦削除。

ここからocsinventory-ngの日本語対応。
まず国旗のjapanese.pngを用意。english.txtjapanese.txtにコピー。
日本語化(UTF-8)対応の修正箇所がいっぱいあるのでパッチを用意しました。

おおまかな修正点
ここからは、パッチ済みをソースでインストール
パッチを含んだportsパッケージを用意しましたので、これを使ってください。

パッチ済みportsパッケージでmake ; make install した後のsetup.shの実行

# ./setup.sh

+----------------------------------------------------------+
| |
| Welcome to OCS Inventory NG Management server setup ! |
| |
+----------------------------------------------------------+

CAUTION: If upgrading Communication server from OCS Inventory NG 1.0 RC2 and
previous, please remove any Apache configuration for Communication Server!

Do you wish to continue ([y]/n)?
Assuming Communication server 1.0 RC2 or previous is not installed
on this computer.

Starting OCS Inventory NG Management server setup from folder /usr/local/share/ocsinventory-ng
Storing log in file /usr/local/share/ocsinventory-ng/ocs_server_setup.log

+----------------------------------------------------------+
| Checking for database server properties... |
+----------------------------------------------------------+

Your MySQL client seems to be part of MySQL version 6.0.
Your computer seems to be running MySQL 4.1 or higher, good ;-)

Which host is running database server [localhost] ?
OK, database server is running on host localhost ;-)

On which port is running database server [3306] ?
OK, database server is running on port 3306 ;-)

+----------------------------------------------------------+
| Checking for Apache web server daemon... |
+----------------------------------------------------------+

Where is Apache daemon binary [/usr/local/sbin/httpd] ?
OK, using Apache daemon /usr/local/sbin/httpd ;-)

+----------------------------------------------------------+
| Checking for Apache main configuration file... |
+----------------------------------------------------------+

Where is Apache main configuration file [/usr/local/etc/apache22/httpd.conf] ?
OK, using Apache main configuration file /usr/local/etc/apache22/httpd.conf ;-)

+----------------------------------------------------------+
| Checking for Apache user account... |
+----------------------------------------------------------+

Which user account is running Apache web server [User] ?www
OK, Apache is running under user account www ;-)

+----------------------------------------------------------+
| Checking for Apache group... |
+----------------------------------------------------------+

Which user group is running Apache web server [www] ?
OK, Apache is running under users group www ;-)

+----------------------------------------------------------+
| Checking for Apache Include configuration directory... |
+----------------------------------------------------------+

Setup found Apache Include configuration directory in.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [] ?/usr/local/etc/apache22/Includes
OK, Apache Include configuration directory /usr/local/etc/apache22/Includes found ;-)

+----------------------------------------------------------+
| Checking for PERL Interpreter... |
+----------------------------------------------------------+

Found PERL Intrepreter at </usr/bin/perl> ;-)
Where is PERL Intrepreter binary [/usr/bin/perl] ?
OK, using PERL Intrepreter /usr/bin/perl ;-)

Do you wish to setup Communication server on this computer ([y]/n)?

+----------------------------------------------------------+
| Checking for Make utility... |
+----------------------------------------------------------+

OK, Make utility found at </usr/bin/make> ;-)

+----------------------------------------------------------+
| Checking for Apache mod_perl version... |
+----------------------------------------------------------+

Checking for Apache mod_perl version 1.99_22 or higher
Found that mod_perl version 1.99_22 or higher is available.
OK, Apache is using mod_perl version 1.99_22 or higher ;-)

+----------------------------------------------------------+
| Checking for Communication server log directory... |
+----------------------------------------------------------+

Communication server can create detailled logs. This logs can be enabled
by setting interger value of LOGLEVEL to 1 in Administration console
menu Configuration.
Where to put Communication server log directory [/var/log/ocsinventory-server] ?
OK, Communication server will put logs into directory /var/log/ocsinventory-server ;-)

+----------------------------------------------------------+
| Checking for required Perl Modules... |
+----------------------------------------------------------+

Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for Apache::DBI PERL module...
Found that PERL module Apache::DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for Compress::Zlib PERL module...
Found that PERL module Compress::Zlib is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.

+----------------------------------------------------------+
| Checking for optional Perl Modules... |
+----------------------------------------------------------+

Checking for SOAP::Lite PERL module...
Found that PERL module SOAP::Lite is available.
Checking for XML::Entities PERL module...
*** Warning: PERL module XML::Entities is not installed !
This module is only required by OCS Inventory NG SOAP Web Service.
Do you wish to continue ([y]/n] ?

+----------------------------------------------------------+
| OK, looks good ;-) |
| |
| Configuring Communication server Perl modules... |
+----------------------------------------------------------+

Writing Makefile for Apache::Ocsinventory

+----------------------------------------------------------+
| OK, looks good ;-) |
| |
| Preparing Communication server Perl modules... |
+----------------------------------------------------------+

+----------------------------------------------------------+
| OK, prepare finshed ;-) |
| |
| Installing Communication server Perl modules... |
+----------------------------------------------------------+

+----------------------------------------------------------+
| OK, Communication server Perl modules install finished;-)|
| |
| Creating Communication server log directory... |
+----------------------------------------------------------+

Creating Communication server log directory /var/log/ocsinventory-server.

Fixing Communication server log directory files permissions.
Configuring logrotate for Communication server.
Removing old communication server logrotate file /etc/logrotate.d/ocsinventory-NG
Writing communication server logrotate to file /etc/logrotate.d/ocsinventory-server

+----------------------------------------------------------+
| OK, Communication server log directory created ;-) |
| |
| Now configuring Apache web server... |
+----------------------------------------------------------+

To ensure Apache loads mod_perl before OCS Inventory NG Communication Server,
Setup can name Communication Server Apache configuration file
'z-ocsinventory-server.conf' instead of 'ocsinventory-server.conf'.
Do you allow Setup renaming Communication Server Apache configuration file
to 'z-ocsinventory-server.conf' ([y]/n) ?
OK, using 'z-ocsinventory-server.conf' as Communication Server Apache configuration file
Removing old communication server configuration to file
/usr/local/etc/apache22/Includes/ocsinventory.conf
Writing communication server configuration to file /usr/local/etc/apache22/Includes/z-ocsinventory-server.conf

+----------------------------------------------------------+
| OK, Communication server setup sucessfully finished ;-) |
| |
| Please, review /usr/local/etc/apache22/Includes/z-ocsinventory-server.conf
| to ensure all is good. Then restart Apache daemon. |
+----------------------------------------------------------+

Do you wish to setup Administration Server (Web Administration Console)
on this computer ([y]/n)?

+----------------------------------------------------------+
| Checking for Administration Server directories... |
+----------------------------------------------------------+

CAUTION: Setup now install files in accordance with Filesystem Hierarchy
Standard. So, no file is installed under Apache root document directory
(Refer to Apache configuration files to locate it).
If you're upgrading from OCS Inventory NG Server 1.01 and previous, YOU
MUST REMOVE (or move) directories 'ocsreports' and 'download' from Apache
root document directory.
If you choose to move directory, YOU MUST MOVE 'download' directory to
Administration Server writable/cache directory (by default
/var/lib/ocsinventory-reports), especialy if you use deployement feature.

Do you wish to continue ([y]/n)?
Assuming directories 'ocsreports' and 'download' removed from
Apache root document directory.

Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?
OK, using directory /usr/share/ocsinventory-reports to install static files ;-)
Where to create writable/cache directories for deployement packages and
IPDiscover [/var/lib/ocsinventory-reports] ?
OK, writable/cache directory is /var/lib/ocsinventory-reports ;-)

+----------------------------------------------------------+
| Checking for required Perl Modules... |
+----------------------------------------------------------+

Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.

+----------------------------------------------------------+
| Installing files for Administration server... |
+----------------------------------------------------------+

Creating PHP directory /usr/share/ocsinventory-reports/ocsreports.
Copying PHP files to /usr/share/ocsinventory-reports/ocsreports.
Fixing permissions on directory /usr/share/ocsinventory-reports/ocsreports.
Creating database configuration file /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php.
Creating IPDiscover directory /var/lib/ocsinventory-reports/ipd.
Fixing permissions on directory /var/lib/ocsinventory-reports/ipd.
Creating packages directory /var/lib/ocsinventory-reports/download.
Fixing permissions on directory /var/lib/ocsinventory-reports/download.
Configuring IPDISCOVER-UTIL Perl script.
Installing IPDISCOVER-UTIL Perl script.
Fixing permissions on IPDISCOVER-UTIL Perl script.
Writing Administration server configuration to file /usr/local/etc/apache22/Includes/ocsinventory-reports.conf

+----------------------------------------------------------+
| OK, Administration server installation finished ;-) |
| |
| Please, review /usr/local/etc/apache22/Includes/ocsinventory-reports.conf
| to ensure all is good and restart Apache daemon. |
| |
| Then, point your browser to http://server//ocsreports
| to configure database server and create/update schema. |
+----------------------------------------------------------+

Setup has created a log file /usr/local/share/ocsinventory-ng/ocs_server_setup.log. Please, save this file.
If you encounter error while running OCS Inventory NG Management server,
we can ask you to show us his content !

DON'T FORGET TO RESTART APACHE DAEMON !


Enjoy OCS Inventory NG ;-)

標準以外の入力が必要なのはapacheのユーザー「www」の入力と、ApacheIncludeファイルの場所を答える時だけです。
それだけでプログラムのインストール完了です。
次にデータベースを設定します。
データベースはブラウザーからセットアップします。
セットアップの前にデータベースを作っておきます。この作業をしないとデータベースがLatin1で作られてしまいます。

# mysql -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 120
Server version: 6.0.10-alpha FreeBSD port: mysql-server-6.0.10

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

mysql> drop database ocsweb;
Query OK, 51 rows affected (0.12 sec)

mysql> create database ocsweb;
Query OK, 1 row affected (0.00 sec)

mysql> use ocsweb;
Database changed
mysql> show variables like "chara%";
+--------------------------+----------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/share/mysql/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.00 sec)

mysql> ALTER DATABASE `ocsweb` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Query OK, 1 row affected (0.00 sec)

mysql> show variables like "chara%";
+--------------------------+----------------------------------+
| Variable_name | Value |
+--------------------------+----------------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/share/mysql/charsets/ |
+--------------------------+----------------------------------+
8 rows in set (0.00 sec)

mysql>

データベース「ocsweb」がutf8になりました。



ブラウザでhttp://server/ocsreports/install.phpをアクセスします。


デフォルト値のocsとそのパスワードではなく、管理者アカウントであるrootとそのパスワードを指定します。

初期データベースが作られました。 ブラウザでhttp://server/ocsreports/をアクセスします。

まだ英語のモードですので、日本の国旗をクリックします。

ユーザーに「Admin」パスワードに「admin」を入れて「送信」ボタンを押します。


管理者である「Admin」ユーザーのパスワードを変更して、インストールは完了です。
お疲れ様でした。 glpiは日本語化されていますので連携をとるのはそんなに難しくないです。
ocs
データベースの情報をglpiにインポートするときに文字化けしないようにするのも簡単です。
その点につきましてはあらためてドキュメントを書き残す予定です。