top-banner

OCS Inventory NG(1/3)

OCS Inventory NGというインベントリ取得に特化したOSSがあり、今回は3回に渡り、構築手順をお届けできたらと思います。
まず1、2回目は、普通に構築して動くところまで、3回目はHTTPS化について書きたいと思います。
OSはCentOS7で、OCS Inventory NG 2.5を構築します。
最初は本家のドキュメントを読みながらやったのですが、上手くいかず😫、結局フランスの方のブログを参考にしました。
また、注意事項が1つあります。OCS Inventory のVer2.4.1ではBugがあり、構築後、日本語でのログインが出来ません😵。
ですので、日本語で運用したい方は、2.5か、2.3で構築してください。

SELinuxの設定変更(/etc/sysconfig/selinux

SELinuxの値をデフォルトのenforcingから、permissive or disabled に変更します。
ここはお好みで設定してください。

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=permissive

Firewallの無効化

次にFirewallを無効化します。
別に無効化しなくても良いのですが、私みたいな、ものぐさな方🌝は無条件に設定してください。
止めない場合は、恐らくHTTPの穴だけあければ良い気がしますが。。。

systemctl  stop  firewalld
systemctl  disable  firewalld


次に必要なパッケージの導入をしていきます。

wgetコマンドのインストール

OCS Inventory NGのパッケージをwgetで取得するため、wgetコマンドを導入します。

yum install wget

mariadbのインストール

OCS Inventory NGのデータを入れるmariadbをインストールします。

yum install mariadb-server
systemctl enable mariadb
systemctl start mariadb

Apacheのインストール

OCS Inventory NGをWebUIで操作するためにApacheと関連モジュールをインストールします。

yum install httpd
yum install epel-release
yum install mod_perl mod_php mod_ssl
systemctl enable httpd
systemctl start httpd

Perlモジュールのインストール

Perlのモジュールを追加でインストールします。

yum install perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Net-IP perl-SOAP-Lite perl-Archive-Zip
wget https://harbottle.gitlab.io/epmel/7/x86_64//perl-Apache-DBI-1.12-2.el7.noarch.rpm
yum install ./perl-Apache-DBI-1.12-2.el7.noarch.rpm

PHPモジュールのインストール

PHPのモジュールを追加でインストールします。

yum install php-common php-gd php-mbstring php-soap php-mysql php-ldap php-xml

OCS Inventory NGのダウンロード

OCS Inventory NGのパッケージをダウンロードして、解凍します。

OCS Inventory NGのインストール

OCS Inventory NGのインストールシェルを実行し、インストールをします。
シェルを実行すると、質問形式のメッセージが表示され、基本的にはYes/Noで選択していきます。
ログや設定ファイルの場所は、必要ならデフォルトから変更してください。
ものぐさな方は、問答無用でw以下の通りに選択すればOKです👍🏻

cd OCSNG_UNIX_SERVER_2.5
 ./setup.sh&
+----------------------------------------------------------+
|                                                          |
|  Welcome to OCS Inventory NG Management server setup !   |
|                                                          |
+----------------------------------------------------------+

Trying to determine which OS or Linux distribution you use
+----------------------------------------------------------+
| Checking for Apache web server binaries !		       |
+----------------------------------------------------------+

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)?  ←Enterを入力
<中略>
Which host is running database server [localhost] ?  ←Enterを入力
On which port is running database server [3306] ? ←Enterを入力
<中略>
Where is Apache daemon binary [/usr/sbin/httpd] ? ←Enterを入力
Which user account is running Apache web server [apache] ?←Enterを入力
Which user group is running Apache web server [apache] ?←Enterを入力
Where is Apache Include configuration directory [/etc/httpd/conf.d] ?←Enterを入力
<中略>
Where is PERL interpreter binary [/usr/bin/perl] ?←Enterを入力
Do you wish to setup Communication server on this computer ([y]/n)?←Enterを入力
<中略>
Where to put Communication server log directory [/var/log/ocsinventory-server] ?←Enterを入力
<中略>
Where to put Communication server plugins configuration files [/etc/ocsinventory-server/plugins] ?←Enterを入力
<中略>
Where to put Communication server plugins Perl modules files [/etc/ocsinventory-server/perl] ?←Enterを入力
<中略>
Checking for Apache2::SOAP PERL module...
***  Warning: PERL module Apache2::SOAP is not installed !
This module is only required by OCS Inventory NG SOAP Web Service.
Do you wish to continue ([y]/n] ?←Enterを入力
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] ?←Enterを入力
<中略>
Do you wish to setup Rest API server on this computer ([y]/n)?n  ←"n" を入力
<中略>
Do you allow Setup renaming Communication Server Apache configuration file to 'z-ocsinventory-server.conf' ([y]/n) ? ←Enterを入力
Do you wish to setup Administration Server (Web Administration Console) on this computer ([y]/n)?←Enterを入力
<中略>
Do you wish to continue ([y]/n)?←Enterを入力
<中略>
Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?←Enterを入力
<中略>
Where to create writable/cache directories for deployment packages,
administration console logs, IPDiscover and SNMP [/var/lib/ocsinventory-reports] ?←Enterを入力
<中略>
Setup has created a log file /root/OCSNG_UNIX_SERVER_2.5/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のサービス再起動

インストールが完了したところで、Apacheのサービス再起動をします。

systemctl restart http

次回はDBの作成になります。