如何在Debian 10 / Debian 9上安裝OCS庫存服務器

如何在Debian 10 / Debian 9 Linux服務器上安裝OCS Inventory Server?.OCS Inventory是一種開放源代碼軟件,用於以更簡單和有組織的方式管理您的IT資產。它具有客戶端-服務器模型,OCS Inventory NG要求其代理了解每台計算機或服務器的軟件和硬件組成。

它還可以使用IP發現來發現無法接收代理的網絡元素,然後使用SNMP完成從IP發現掃描中檢索到的數據,這對於打印機,掃描儀,路由器等設備非常有用。

以下是在Debian Linux上安裝OCS Inventory Server的軟件要求。

  • MySQL服務器
  • 佩爾
  • Apache Web服務器
  • Apache Mod_perl
  • 啟用ZIP支持的PHP。
  • Apache Mod_php
  • Perl模塊XML ::簡單
  • Perl模塊Compress :: Zlib
  • Perl模塊DBI
  • Perl模塊DBD :: Mysql
  • Perl模塊Apache :: DBI
  • Perl模塊網絡:: IP
  • Perl模塊存檔:: Zip
  • Perl模塊Apache2:SOAP
  • Perl模塊SOAP :: Lite
  • Perl模塊XML ::實體

步驟1:安裝MySQL Server,make和gcc

我不想安裝MySQL服務器,而是安裝MariaDB。有關在Debian上安裝MariaDB的信息,請參閱下面的指南:

在Debian上安裝MariaDB服務器

要安裝make和gcc,請運行:

sudo apt update
sudo apt -y install git make cmake gcc make build-essential

步驟2:安裝Apache Web服務器

要在Debian上安裝Apache和必需的模塊,請運行以下命令:

sudo apt -y install libapache2-mod-perl2 libapache-dbi-perl libapache-db-perl libapache2-mod-php 

步驟3:安裝PHP和php-zip模塊

我們還需要安裝php和php-zip模塊。

sudo apt -y install php php-zip php-pclzip php-gd php-mysql php-soap php-curl php-json php-xml php-mbstring

步驟4:安裝Perl和所有必需的模塊

可以通過運行以下命令來安裝Perl及其所有模塊:

sudo apt -y 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 libdbd-mysql-perl libnet-ip-perl libxml-simple-perl libarchive-zip-perl 
sudo cpan install XML::Entities Apache2::SOAP Net::IP Apache::DBI Mojolicious Switch Plack::Handler Archive::Zip

步驟5:創建OCS庫存數據庫

以root用戶身份登錄到MariaDB數據庫並為OCS創建數據庫:

$ mysql -u root -p
CREATE DATABASE ocs;
GRANT ALL PRIVILEGES ON ocs.* TO [email protected] IDENTIFIED BY "StrongDBPassword";
FLUSH PRIVILEGES;
QUIT;

步驟6:安裝OCS庫存服務器

從Github克隆項目:

$ git clone https://github.com/OCSInventory-NG/OCSInventory-Server.git
Cloning into 'OCSInventory-Server'…
remote: Enumerating objects: 7473, done.
remote: Total 7473 (delta 0), reused 0 (delta 0), pack-reused 7473
Receiving objects: 100% (7473/7473), 52.59 MiB | 1.23 MiB/s, done.
Resolving deltas: 100% (5309/5309), done.

更改為克隆目錄。

$ cd OCSInventory-Server/
$ git clone https://github.com/OCSInventory-NG/OCSInventory-ocsreports.git ocsreports
Cloning into 'ocsreports'…
remote: Enumerating objects: 29, done.
remote: Counting objects: 100% (29/29), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 28646 (delta 9), reused 22 (delta 9), pack-reused 28617
Receiving objects: 100% (28646/28646), 81.96 MiB | 1.06 MiB/s, done.
Resolving deltas: 100% (18118/18118), done.

編輯 setup.sh 更改MySQL憑據的腳本:

DB_SERVER_HOST="localhost"
DB_SERVER_PORT="3306"
DB_SERVER_USER="ocs"
DB_SERVER_PWD="StrongDBPassword"

如果您使用的是遠程數據庫服務器,請更改 DB_SERVER_HOST 可以根據自己的喜好修改其他更改,並在運行腳本的同時啟動安裝過程。

$ sudo ./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
....

Which host is running database server [localhost] ? 
On which port is running database server [3306] ?

同意所有選項以完成設置。確保所有Perl檢查均成功。

.....................
+----------------------------------------------------------+
 | 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 SOAP::Lite Perl module…
 Found that PERL module SOAP::Lite is available.
 Checking for Archive::Zip Perl module…
 Found that PERL module Archive::Zip is available.
 +----------------------------------------------------------+
 |         Checking for optional Perl Modules…            |
 +----------------------------------------------------------+
 Checking for Apache2::SOAP PERL module…
 Found that PERL module SOAP::Apache2 is available.
 Checking for XML::Entities PERL module…
 Found that PERL module XML::Entities is available.
 Do you wish to setup Rest API server on this computer ([y]/n)? y
 +----------------------------------------------------------+
 | Checking for REST API Dependencies …                       |
 +----------------------------------------------------------+
 Found that PERL module Mojolicious::Lite is available.
 Found that PERL module Switch is available.
 Found that PERL module Plack::Handler is available.
 +----------------------------------------------------------+
 | Configuring REST API Server files …                        |
 +----------------------------------------------------------+

If the installation was successful, you should get a message:

+----------------------------------------------------------+
 |      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.
 Creating snmp mibs directory /var/lib/ocsinventory-reports/snmp.
 Fixing permissions on directory /var/lib/ocsinventory-reports/snmp.
 Creating Administration server log files directory /var/lib/ocsinventory-reports/logs.
 Fixing permissions on directory /var/lib/ocsinventory-reports/logs.
 Creating Administration server scripts log files directory /var/lib/ocsinventory-reports/scripts.
 Fixing permissions on directory /var/lib/ocsinventory-reports/scripts.
 Configuring IPDISCOVER-UTIL Perl script.
 Installing IPDISCOVER-UTIL Perl script.
 Fixing permissions on IPDISCOVER-UTIL Perl script.
 Writing Administration server configuration to file /etc/apache2/conf-available/ocsinventory-reports.conf
 +----------------------------------------------------------------------+
 |        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 ;-)

步驟7:配置OCS庫存服務器

安裝OCS後,它會為您生成Apache配置文件。您需要通過創建別名來啟用它:

sudo ln -s /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/conf-enabled/ocsinventory-reports.conf
sudo ln -s /etc/apache2/conf-available/z-ocsinventory-server.conf /etc/apache2/conf-enabled/z-ocsinventory-server.conf

如果您需要REST API,還請添加:

sudo ln -s /etc/apache2/conf-available/zz-ocsinventory-restapi.conf /

重新啟動Apache服務器

sudo chown -R www-data:www-data /var/lib/ocsinventory-reports
sudo systemctl restart apache2 

編輯 /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php 並為MySQL創建的用戶添加用戶名和密碼。 setup.sh 帶有正確的憑據,它們將會出現。

在瀏覽器中打開以下URL,檢查信息,然後單擊“發送”:

提供先前創建的數據庫憑據,然後單擊 發送

如何在Debian 10 / Debian 9上安裝OCS庫存服務器

點擊“點擊此處進入OCS-NG GUI” 鏈接以獲取儀錶板。

如何在Debian 10 / Debian 9上安裝OCS庫存服務器

確認“執行更新” 訊息。

出於安全原因,請將以下內容移至網絡上無法訪問的位置

sudo mv /usr/share/ocsinventory-reports/ocsreports/install.php 
/usr/share/ocsinventory-reports/ocsreports/install.php.bak

使客戶端可以更新管理TAG編輯 /etc/apache2/conf.d/z-ocsinventory-server.conf 並從更改以下指令 01個

PerlSetEnv OCS_OPT_ACCEPT_TAG_UPDATE_FROM_CLIENT 1

步驟8:訪問Web界面

成功安裝後,訪問Web儀錶板。

http://$server_ip_address/ocsreports

如何在Debian 10 / Debian 9上安裝OCS庫存服務器

默認登錄憑據為:

Username: admin
Password: admin

通過導航到更改管理員密碼 設置>我的帳戶>密碼。

如何在Debian 10 / Debian 9上安裝OCS庫存服務器

提供新密碼並單擊確定按鈕。您可以從此處瀏覽OCS庫存,並開始向其輸入數據。

類似文章:

在Debian 10(Buster)上安裝ERPNext ERP系統

評分最高的AWS Cloud認證準備書

最佳LPIC-1和LPIC-2認證學習書籍

最佳CCNA安全(210-260)認證學習書籍

Sidebar