centos7 | OCSNG资产管理系统安装配置 | ocs inventory | 出错汇总

自己在,借鉴Mr.葛的博客安装OCSNG的过程中遇到了一些问题,记录在下面。

重要:
如若成功安装后在agent端提示服务无法访问的500错误Failed to send Prolog <HTTP Status Code #500>,是环境没有配置好,包的版本和种类不正确导致的,如果发生这个错误,建议把mysql、php、perl、ocs全部删除干净后按照官方文档一步一步安装。请全部按照官网安装最新版本!
官方链接:Setting up OCS Inventory Server

配环境

  • 配置yum环境
rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
  • 修改remi.repo 源 (默认安装为php5.4 修改开启此PHP5.6 , 新的客户端最低支持5.6)
  vim /etc/yum.repos.d/remi.repo

  name=Remi's PHP 5.6 RPM repository for Enterprise Linux 7 - $basearch
  #baseurl=http://rpms.remirepo.net/enterprise/7/php56/$basearch/
  #mirrorlist=https://rpms.remirepo.net/enterprise/7/php56/httpsmirror
  mirrorlist=http://cdn.remirepo.net/enterprise/7/php56/mirror
  # NOTICE: common dependencies are in "remi-safe"
  enabled=1
  gpgcheck=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
  • 安装依赖和LAMP
    我这里在原博主的基础上添加了一些必要的包。
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm 
 
rpm -ivh mysql57-community-release-el7-8.noarch.rpm   
 
yum install mysql-server -y
 
yum install httpd  php-mysql gcc gcc-c++ glibc-devel glibc-headers autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libXpm libX11 libxml2-devel gettext-devel pcre-devel php php-devel php-gd php-pecl-zip php-devel php-pear php-imap php-ldap php-odbc php-xml php-xmlrpc mod_perl php-mbstring perl mod_perl perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Net-IP perl-Apache-DBI perl-Apache2-SOAP php-common perl-XML-Entities perl-Mojolicious perl-Plack perl-Switch perl-Apache-DBI perl-Mojolicious.noarch perl-Apache2-SOAP perl-Archive-Zip

mysql

更改mysql初始密码

安装OCS

  • 下载解压安装包
cd /opt/
 
wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.4.1/OCSNG_UNIX_SERVER_2.4.1.tar.gz
 
tar xvf OCSNG_UNIX_SERVER_2.4.1.tar.gz
  • 安装
[root@tiger opt]# cd OCSNG_UNIX_SERVER_2.4.1/
 
[root@tiger OCSNG_UNIX_SERVER_2.4.1]# ./setup.sh
 
一路回车即可,如有错误请检查所有Perl模块是否安装正确

注意这里需要填写
 Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ?/var/www/html/      #此处需要手工输入

错误一:
安装如果报错:$s->add_config() has failed: Could not open configuration file /etc/ocsinventory-server/plugins
创建目录即可:mkdir -p /etc/ocsinventory-server/plugins

错误二:
PERL module Archive::Zip is not installed

*** ERROR: PERL module Archive::Zip is not installed !
*** ERROR: There is one or more required PERL modules missing on your computer !
yum search perl-Archive

找到相应的zip版本安装即可

yum install perl-Archive-Zip

错误三:

AH00558:Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message

找到自己的apache配置文件。

find / -name httpd.conf

打开

vim xxx/httpd/conf/httpd.conf

检索到ServerName,应该检索到# ServerName localhost:80之类的
下面一行添加ServerName localhost:80即可,或者把注释符号#去掉也可

错误四:

Scalar value @args[$i] better written as $args[$i] at /usr/local/share/perl5/Apache/Ocsinventory/Interface/AssetCategory.pm line 54.
Scalar value @args[$i] better written as $args[$i] at /usr/local/share/perl5/Apache/Ocsinventory/Interface/AssetCategory.pm line 54.

按照提示将54行代码改了即可

vim /usr/local/share/perl5/Apache/Ocsinventory/Interface/AssetCategory.pm

完整安装过程

[root@slave3 OCSNG_UNIX_SERVER_2.4.1]# ./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)?
Assuming Communication server 1.0 RC2 or previous is not installed
on this computer.

Starting OCS Inventory NG Management server setup from folder /opt/OCSNG_UNIX_SERVER_2.4.1
Storing log in file /opt/OCSNG_UNIX_SERVER_2.4.1/ocs_server_setup.log

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

Your MySQL client seems to be part of MySQL version 5.7.
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/httpd] ?
OK, using Apache daemon /usr/sbin/httpd ;-)


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

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


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

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


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

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


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

Setup found Apache Include configuration directory in
/etc/httpd/conf.d.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [/etc/httpd/conf.d] ?
OK, Apache Include configuration directory /etc/httpd/conf.d found ;-)


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

Found PERL interpreter at </usr/bin/perl> ;-)
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)?


+----------------------------------------------------------+
|             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 detailed logs. This logs can be enabled
by setting integer 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 Communication server plugins configuration directory...    |
+----------------------------------------------------------------------------+

Communication server need a directory for plugins configuration files. 
Where to put Communication server plugins configuration files [/etc/ocsinventory-server/plugins] ?
OK, Communication server will put plugins configuration files into directory /etc/ocsinventory-server/plugins ;-)

+-------------------------------------------------------------------+
|   Checking for Communication server plugins perl directory...     |
+-------------------------------------------------------------------+

Communication server need a directory for plugins Perl modules files.
Where to put Communication server plugins Perl modules files [/etc/ocsinventory-server/perl] ?
OK, Communication server will put plugins Perl modules files into directory /etc/ocsinventory-server/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)?

+----------------------------------------------------------+
| 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 ...               		 |
+----------------------------------------------------------+

Where do you want the API code to be store [/usr/local/share/perl5] ?
Copying files to /usr/local/share/perl5

+----------------------------------------------------------+
| Configuring REST API Server configuration files ...  		 |
+----------------------------------------------------------+


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

Checking if your kit is complete...
Looks good
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 ;-)            |
|                                                                      |
|   Creating Communication server plugins configuration directory...   |
+----------------------------------------------------------------------+

Creating Communication server plugins configuration directory /etc/ocsinventory-server/plugins.


+----------------------------------------------------------------------+
| OK, Communication server plugins configuration directory created ;-) |
|                                                                      |
|        Creating Communication server plugins Perl directory...       |
+----------------------------------------------------------------------+

Creating Communication server plugins Perl directory /etc/ocsinventory-server/perl.


+----------------------------------------------------------------------+
|     OK, Communication server plugins Perl 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 /etc/httpd/conf.d/ocsinventory.conf
Writing communication server configuration to file /etc/httpd/conf.d/z-ocsinventory-server.conf

+----------------------------------------------------------------------+
|       OK, Communication server setup successfully finished ;-)       |
|                                                                      |
| Please, review /etc/httpd/conf.d/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), especially if you use deployment 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] ?/var/www/html/ 
OK, using directory /var/www/html/ to install static files ;-)

Where to create writable/cache directories for deployment packages,
administration console logs, IPDiscover and SNMP [/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 /var/www/html//ocsreports.
Copying PHP files to /var/www/html//ocsreports.
Fixing permissions on directory /var/www/html//ocsreports.
Creating database configuration file /var/www/html//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/httpd/conf.d/ocsinventory-reports.conf

+----------------------------------------------------------------------+
|        OK, Administration server installation finished ;-)           |
|                                                                      |
| Please, review /etc/httpd/conf.d/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 /opt/OCSNG_UNIX_SERVER_2.4.1/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 ;-)

  • 启动服务
chown -R apache. /var/www/html/
 
systemctl start httpd
 
systemctl enable httpd
 
systemctl start mysqld
 
systemctl enable  mysqld
  • ocsng配置
    浏览器访问:http://localhost/ocsreports
    错误一 : 不显示页面
    如果你这儿无法启动httpd,可以参考以下,我的这篇博客
    https://blog.csdn.net/stone_fall/article/details/102070604
    将之前下载的ocs文件中的如下文件与目录复制到/usr/local/share/perl5/Apache/即可
/opt/OCSNG_UNIX_SERVER_2.4.1/Apache/Ocsinventory
/opt/OCSNG_UNIX_SERVER_2.4.1/Apache/Ocsinventory.pm

没有/usr/local/share/perl5/Apache/目录mkdir -p 创建即可。

mv -f /opt/OCSNG_UNIX_SERVER_2.4.1/Apache/Ocsinventory /usr/local/share/perl5/Apache/
mv -f /opt/OCSNG_UNIX_SERVER_2.4.1/Apache/Ocsinventory.pm /usr/local/share/perl5/Apache/

正常显示页面后,填写mysql帐号密码。
数据库名称:ocsweb
mysql主机名:mysql

配置后,安装结束会提示下面文字。

Installation finished you can log in index.php with login=admin and password=admin
发布了134 篇原创文章 · 获赞 57 · 访问量 5万+

猜你喜欢

转载自blog.csdn.net/stone_fall/article/details/102209665