「OpenComputers and Software Inventory Next Generation」とも呼ばれるOCSインベントリは、無料の資産管理プラットフォームです。これは、IT資産をよりシンプルで組織的な方法で管理するために使用されます。 OCSを使用すると、ルーター、スイッチ、コンピューター、プリンターなど、ネットワーク上のすべてのアクティブなデバイスからハードウェアとソフトウェアのインベントリを収集できます。また、Sun Solaris、IBM AIX、HP-UX、Windows、Linux、MacOSなどの多くのオペレーティングシステムもサポートしています。
OCS Inventoryは、ビジネスに適したITハードウェアインベントリシステムを探している場合に最適なツールです。
このチュートリアルでは、Ubuntu20.04にOCSインベントリサーバーをインストールする方法を説明します。
- Ubuntu20.04を実行しているサーバー。
- ルートパスワードはサーバーで構成されています。
まず、サーバーを最新バージョンに更新することをお勧めします。次のコマンドで更新できます:
apt-get update -y
サーバーが最新になったら、サーバーにいくつかの依存関係をインストールする必要があります。次のコマンドですべてをインストールできます:
apt-get install make cmake gcc make git curl unzip -y
すべてのパッケージがインストールされたら、次のステップに進むことができます。
LAMPサーバーをインストールする
まず、Apache Webサーバー、MariaDBサーバー、PHP、およびその他の必要なPHP拡張機能をサーバーにインストールする必要があります。次のコマンドを実行して、それらすべてをインストールできます。
apt-get install apache2 mariadb-server libapache2-mod-perl2 libapache-dbi-perl libapache-db-perl php7.4 libapache2-mod-php7.4 php7.4-common php7.4-sqlite3 php7.4-mysql php7.4-gmp php7.4-curl php7.4-mbstring php7.4-gd php7.4-cli php7.4-xml php7.4-zip php7.4-soap php7.4-json php-pclzip composer
すべてのパッケージがインストールされたら、php.iniファイルを編集し、いくつかの推奨設定を微調整します。
nano /etc/php/7.4/apache2/php.ini
次の設定を変更します:
memory_limit = 256M post_max_size = 100M upload_max_filesize = 100M max_execution_time = 360 date.timezone = America/Chicago
終了したら、ファイルを保存して閉じます。
Perlと必要なモジュールをインストールする
OCSインベントリでは、PerlといくつかのPerlモジュールをサーバーにインストールする必要もありました。次のコマンドですべてをインストールできます:
apt-get install perl libxml-simple-perl libcompress-zlib-perl libdbi-perl libdbd-mysql-perl libnet-ip-perl libsoap-lite-perl libio-compress-perl libapache-dbi-perl libapache2-mod-perl2 libapache2-mod-perl2-dev -y
すべてのモジュールをインストールしたら、次のコマンドでモジュールを有効にします。
perl -MCPAN -e 'install Apache2::SOAP'
perl -MCPAN -e 'install XML::Entities'
perl -MCPAN -e 'install Net::IP'
perl -MCPAN -e 'install Apache::DBI'
perl -MCPAN -e 'install Mojolicious'
perl -MCPAN -e 'install Switch'
perl -MCPAN -e 'install Plack::Handler'
終了したら、次のステップに進むことができます。
MariaDBデータベースを構成する
次に、OCSインベントリ用のデータベースとユーザーを作成する必要があります。まず、次のコマンドを使用してMariaDBシェルにログインします。
mysql
ログインしたら、次のコマンドを使用してデータベースとユーザーを作成します。
MariaDB [(none)]> CREATE DATABASE ocsdb;
MariaDB [(none)]> CREATE USER 'ocsuser'@'localhost' IDENTIFIED BY 'password';
次に、次のコマンドを使用して、ocsdbにすべての権限を付与します。
MariaDB [(none)]> GRANT ALL ON ocsdb.* TO 'ocsuser'@'localhost' WITH GRANT OPTION;
次に、特権をフラッシュし、次のコマンドを使用してMariaDBシェルを終了します。
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;
OCSインベントリをダウンロードしてインストールする
まず、Gitリポジトリから最新バージョンのOCSをダウンロードする必要があります。次のコマンドでダウンロードできます:
git clone https://github.com/OCSInventory-NG/OCSInventory-Server.git
ダウンロードしたら、ディレクトリをOCSInventory-Serverに変更し、次のコマンドを使用してocsreportプロジェクトをダウンロードします。
cd OCSInventory-Server
git clone https://github.com/OCSInventory-NG/OCSInventory-ocsreports.git ocsreports
次に、ディレクトリをocsreportsに変更し、次のコマンドを使用してComposerをインストールします。
cd ocsreports
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
Composerをインストールすると、次の出力が得られます。
All settings correct for using Composer Downloading... Composer (version 1.10.10) successfully installed to: /usr/local/bin/composer Use it: php /usr/local/bin/composer
次に、OCSInventory-Serverディレクトリに戻り、setup.shファイルを編集します。
cd ..
nano setup.sh
以下に示すようにデータベース設定を定義します。
# Which host run database server DB_SERVER_HOST="localhost" # On which port run database server DB_SERVER_PORT="3306" # Database server credentials DB_SERVER_USER="ocsuser" DB_SERVER_PWD="password"
終了したら、ファイルを保存して閉じます。
次に、次のコマンドを実行してOCSインベントリのインストールを開始します。
./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)?y Assuming Communication server 1.0 RC2 or previous is not installed on this computer. Starting OCS Inventory NG Management server setup from folder /root/OCSInventory-Server Storing log in file /root/OCSInventory-Server/ocs_server_setup.log +----------------------------------------------------------+ | Checking for database server properties... | +----------------------------------------------------------+ Your MySQL client seems to be part of MySQL version 10.3. 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/sbin/apache2ctl] ? OK, using Apache daemon /usr/sbin/apache2ctl ;-) +----------------------------------------------------------+ | Checking for Apache main configuration file... | +----------------------------------------------------------+ Where is Apache main configuration file [/etc/apache2/apache2.conf] ? OK, using Apache main configuration file /etc/apache2/apache2.conf ;-) +----------------------------------------------------------+ | Checking for Apache user account... | +----------------------------------------------------------+ Which user account is running Apache web server [www-data] ? OK, Apache is running under user account www-data ;-) +----------------------------------------------------------+ | Checking for Apache group... | +----------------------------------------------------------+ Which user group is running Apache web server [www-data] ? OK, Apache is running under users group www-data ;-) +----------------------------------------------------------+ | Checking for Apache Include configuration directory... | +----------------------------------------------------------+ Setup found Apache Include configuration directory in /etc/apache2/conf-available. Setup will put OCS Inventory NG Apache configuration in this directory. Where is Apache Include configuration directory [/etc/apache2/conf-available] ? OK, Apache Include configuration directory /etc/apache2/conf-available found ;-) +----------------------------------------------------------+ | Checking for PERL Interpreter... | +----------------------------------------------------------+ Found PERL interpreter at ;-) Where is PERL interpreter binary [/usr/bin/perl] ? OK, using PERL interpreter /usr/bin/perl ;-) Do you wish to setup Communication server on this computer ([y]/n)?y +----------------------------------------------------------------------+ | OK, Administration server installation finished ;-) | | | | Please, review /etc/apache2/conf-available/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 /root/OCSInventory-Server/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 its content ! DON'T FORGET TO RESTART APACHE DAEMON ! Enjoy OCS Inventory NG ;-)
OCSインベントリを有効にする
次に、OCSInventory仮想ホスト構成ファイルも有効にする必要があります。次のコマンドで有効にできます:
ln -s /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/conf-enabled/ocsinventory-reports.conf
ln -s /etc/apache2/conf-available/z-ocsinventory-server.conf /etc/apache2/conf-enabled/z-ocsinventory-server.conf
ln -s /etc/apache2/conf-available/zz-ocsinventory-restapi.conf /etc/apache2/conf-enabled/zz-ocsinventory-restapi.conf
次に、次のコマンドを使用して、ocsinventory-reportsディレクトリの所有権をwww-dataに変更します。
chown -R www-data:www-data /var/lib/ocsinventory-reports
次に、Apacheサービスを再起動して、変更を適用します。
systemctl restart apache2
次に、Webブラウザーを開き、URLhttp://your-server-ip/ocsreports/install.phpを入力します。 OCSインベントリのインストール画面が表示されます:
OCSデータベース、データベースのユーザー名、パスワードを入力し、送信をクリックします。 ボタン。インストールが正常に完了すると、次の画面が表示されます。
ここをクリックしてOCS-NGGUIに入ります 。以下に示すようなOCSインベントリログイン画面が表示されます。
デフォルトのユーザー名とパスワードをadmin/adminとして指定し、送信をクリックします ボタン。次の画面にOCSインベントリダッシュボードが表示されます。
管理者ユーザーのデフォルトのログインパスワードを安全なパスワードに変更するように注意してください。最後に、install.phpファイルを削除して、ダッシュボードのアラートメッセージを削除します。
rm -f /usr/share/ocsinventory-reports/ocsreports/install.php
おめでとう!これで、Ubuntu20.04にOCSインベントリが正常にインストールされました。 WebブラウザからIT資産を簡単に管理できるようになりました。ご不明な点がございましたら、お気軽にお問い合わせください。