
OCS Installation
- Atul
- Open source
- August 16, 2024
Table of Contents
Open computers and software inventory is an asset management solution.
OCS Inventory official site.
I can manage:
- How many devices are in my network.
- How many softwares are installed on them.
- Scan a range of IP for newly connected devices.
OCS is Free software.
OCS Inventory NG or Open Computer and Software Inventory Next Generation is free software that enables users to automatically inventory their IT assets. OCS-NG collects information about the hardware and software of networked machines running the OCS client program (“OCS Inventory Agent”). OCS can be used to visualize the inventory through a web interface. Furthermore, OCS allows the possibility of deploying applications on the computers according to search criteria. Agent-side IpDiscover and SNMP scan make it possible to identify the entire network of computers and devices. Read more
Setting up OCS Inventory Server
Management server is made up of 4 main components:
- Database server, which stores inventory information.
- Communication server, which handles HTTP communications between database server and agents.
- Administration console, which allows administrators to query the database server using their favorite browser.
- Deployment server, which stores all package deployment configuration (requires HTTPS!).
- Database server currently can only be MySQL 8.0 or MariaDB with InnoDB engine active.
- Communication server needs Apache Web Server 2.2.X / 2.4.X and is written in PERL as an Apache module. Why? Because PERL scripts are compiled when Apache starts, and not at each request. This is better performance-wise.
- Communication server may require some additional PERL modules, according to your distribution.
- Deployment server needs any Web Server with SSL enabled.
- Administration console is written in PHP 7 (or higher) and runs under Apache Web Server 2.2.X /2.4.X. - - - Administration console requires ZIP and GD support enabled in PHP in order to use package deployment.
As I am using Fedora based system so, Setting up OCS Inventory Server with RPM, URL.
But I am thinking to install the server on a container.
Container:
podman pull debian
podman run --name ocs0.1 -d -it debian
This command creates a new container named “ocs0.1” based on the Debian image. The -d option runs the container in the background, and the -it option enables interactive mode.
Adding volume too:
podman run --name ocs0.2 -d -it -v /path/to/data-directory:/data debian
podman attach ocs0.2
4 apt update
6 curl -sS https://deb.ocsinventory-ng.org/pubkey.gpg | sudo apt-key add -
7 apt install curl
8 nano
10 git
12 curl -sS https://deb.ocsinventory-ng.org/pubkey.gpg | sudo apt-key add -
13 curl -sS https://deb.ocsinventory-ng.org/pubkey.gpg | apt-key add -
14 apt install gnupg2
16 curl -sS https://deb.ocsinventory-ng.org/pubkey.gpg | apt-key add -
19 echo "deb http://deb.ocsinventory-ng.org/debian/ bookworm main" | tee /etc/apt/sources.list.d/ocsinventory.list
20 apt update
21 apt install ocsinventory
22 apt-get install -f
23 apt-get install dialog
24 apt install ocsinventory
There is an issue installing the packages.
Trying with new image:
podman run -it --name ocs0.2 --rm -v ~/Desktop/Work/OCS/ocs-data:/data docker.io/library/debian:bullseye /bin/bash
Installing again
Still not working!
Mannually installing on Ubuntu 22.04 container:
From this blog.
podman run --name ocs0.3 -d -it -v ~/Desktop/Work/OCS/ocs-data:/data ubuntu:22.04 /bin/bash
Issue:
root@fd5ee25059b1:/# mysql -u root -p
ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)
It got solved after restarting the DB server.
root@fd5ee25059b1:/data/OCSInventory-Server# ./setup.sh
./setup.sh: 15: [[: not found
+----------------------------------------------------------+
| |
| 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 /data/OCSInventory-Server
Storing log in file /data/OCSInventory-Server/ocs_server_setup.log
+----------------------------------------------------------+
| Checking for database server properties... |
+----------------------------------------------------------+
Your MySQL client seems to be part of MySQL version 10.6.
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 </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 Archive::Zip Perl module...
Found that PERL module Archive::Zip 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/perl/5.34.0] ?
Copying files to /usr/local/share/perl/5.34.0
+----------------------------------------------------------+
| Configuring REST API Server configuration files ... |
+----------------------------------------------------------+
+----------------------------------------------------------+
| OK, looks good ;-) |
| |
| Configuring Communication server Perl modules... |
+----------------------------------------------------------+
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Apache::Ocsinventory
Writing MYMETA.yml and MYMETA.json
+----------------------------------------------------------+
| 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/apache2/conf-available/ocsinventory.conf
Writing communication server configuration to file /etc/apache2/conf-available/z-ocsinventory-server.conf
+----------------------------------------------------------------------+
| OK, Communication server setup successfully finished ;-) |
| |
| Please, review /etc/apache2/conf-available/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] ?
OK, using directory /usr/share/ocsinventory-reports 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 /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 temporary files directory /var/lib/ocsinventory-reports/tmp_dir.
Fixing permissions on directory /var/lib/ocsinventory-reports/tmp_dir.
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 /data/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 ;-)
I guess the server is running fine, but I forgot to add port to access the server.
Adding port after creating the container:
Commiting the changes yet done:
podman commit ocs0.3 ocs0.3.1
podman run -p 8080:80 -td ocs0.3.1
ocsinventory-server: Bad setting. SNMP_LINK_TAG
is not set. Default: 0
Error:
ERROR: MySQL for PHP is not properly installed.
Try installing MySQL for php package (Debian: php5-mysql)
Solution:
apt-get install php-mysql
Solved
- MySQL login: ocs
- MySQL Password: StrongDBPas5w0rd
- Name of Database: ocs
- MySQL hostname: localhost
- Enable SSL: No
After clicking the "" it redirects to index.php file but it is empty
Error:
less /var/log/apache2/error.log
[Wed Aug 21 16:38:12.710524 2024] [php:warn] [pid 1086] [client 10.0.2.100:55578] PHP Warning: require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php): Failed to open stream: No such file or directory in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31, referer: http://localhost:8080/ocsreports/install.php
[Wed Aug 21 16:38:12.710576 2024] [php:error] [pid 1086] [client 10.0.2.100:55578] PHP Fatal error: Uncaught Error: Failed opening required '/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/share/ocsinventory-reports/ocsreports/require/header.php:31\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require()\n#1 {main}\n thrown in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31, referer: http://localhost:8080/ocsreports/install.php
[Wed Aug 21 16:38:21.024597 2024] [php:warn] [pid 1088] [client 10.0.2.100:53590] PHP Warning: require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php): Failed to open stream: No such file or directory in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31
[Wed Aug 21 16:38:21.024658 2024] [php:error] [pid 1088] [client 10.0.2.100:53590] PHP Fatal error: Uncaught Error: Failed opening required '/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/share/ocsinventory-reports/ocsreports/require/header.php:31\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require()\n#1 {main}\n thrown in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31
[Wed Aug 21 16:38:25.741326 2024] [php:warn] [pid 1074] [client 10.0.2.100:57222] PHP Warning: require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php): Failed to open stream: No such file or directory in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31
[Wed Aug 21 16:38:25.741390 2024] [php:error] [pid 1074] [client 10.0.2.100:57222] PHP Fatal error: Uncaught Error: Failed opening required '/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/share/ocsinventory-reports/ocsreports/require/header.php:31\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require()\n#1 {main}\n thrown in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31
[Wed Aug 21 16:38:44.954575 2024] [php:warn] [pid 1073] [client 10.0.2.100:49882] PHP Warning: require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php): Failed to open stream: No such file or directory in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31
[Wed Aug 21 16:38:44.954620 2024] [php:error] [pid 1073] [client 10.0.2.100:49882] PHP Fatal error: Uncaught Error: Failed opening required '/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/share/ocsinventory-reports/ocsreports/require/header.php:31\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require()\n#1 {main}\n thrown in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31
[Wed Aug 21 16:42:22.986219 2024] [php:warn] [pid 1076] [client 10.0.2.100:48368] PHP Warning: require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php): Failed to open stream: No such file or directory in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31, referer: http://localhost:8080/ocsreports/install.php
[Wed Aug 21 16:42:22.986278 2024] [php:error] [pid 1076] [client 10.0.2.100:48368] PHP Fatal error: Uncaught Error: Failed opening required '/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/share/ocsinventory-reports/ocsreports/require/header.php:31\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require()\n#1 {main}\n thrown in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31, referer: http://localhost:8080/ocsreports/install.php
[Wed Aug 21 16:42:29.293602 2024] [php:warn] [pid 1075] [client 10.0.2.100:48372] PHP Warning: require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php): Failed to open stream: No such file or directory in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31, referer: http://localhost:8080/ocsreports/install.php
[Wed Aug 21 16:42:29.293652 2024] [php:error] [pid 1075] [client 10.0.2.100:48372] PHP Fatal error: Uncaught Error: Failed opening required '/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/share/ocsinventory-reports/ocsreports/require/header.php:31\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require()\n#1 {main}\n thrown in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31, referer: http://localhost:8080/ocsreports/install.php
[Wed Aug 21 16:43:43.038029 2024] [php:warn] [pid 1080] [client 10.0.2.100:51858] PHP Warning: require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php): Failed to open stream: No such file or directory in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31, referer: http://localhost:8080/ocsreports/install.php
[Wed Aug 21 16:43:43.038079 2024] [php:error] [pid 1080] [client 10.0.2.100:51858] PHP Fatal error: Uncaught Error: Failed opening required '/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/share/ocsinventory-reports/ocsreports/require/header.php:31\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require()\n#1 {main}\n thrown in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31, referer: http://localhost:8080/ocsreports/install.php
The error messages in the log indicate that the PHP script is unable to find the vendor/autoload.php file, which is typically generated by Composer, a dependency management tool for PHP.
Here are the steps you can take to resolve this issue:
Check the file path: Ensure that the file path /usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php is correct. Verify that the ocsreports directory and the vendor directory exist in the specified location.
Install Composer dependencies: If the vendor directory is missing, it means the Composer dependencies have not been installed. Navigate to the ocsreports directory and run the following command to install the dependencies:
Code
cd /usr/share/ocsinventory-reports/ocsreports composer install
Not working, this composer was tring to install a package, but it is not available at the source(github).
22 Aug progress:
Started the container and the apache server
Error:
Getting error:
[Thu Aug 22 10:35:18.425564 2024] [core:warn] [pid 34] AH00098: pid file /var/run/apache2/apache2.pid overwritten -- Unclean shutdown of previous Apache run?
[Thu Aug 22 10:35:18.438154 2024] [mpm_prefork:notice] [pid 34] AH00163: Apache/2.4.52 (Ubuntu) mod_perl/2.0.12 Perl/v5.34.0 configured -- resuming normal operations
[Thu Aug 22 10:35:18.438197 2024] [core:notice] [pid 34] AH00094: Command line: '/usr/sbin/apache2'
[Thu Aug 22 10:37:03.511154 2024] [php:warn] [pid 40] [client 10.0.2.100:60680] PHP Warning: require_once(/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php): Failed to open stream: No such file or directory in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31
[Thu Aug 22 10:37:03.511224 2024] [php:error] [pid 40] [client 10.0.2.100:60680] PHP Fatal error: Uncaught Error: Failed opening required '/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php' (include_path='.:/usr/share/php') in /usr/share/ocsinventory-reports/ocsreports/require/header.php:31\nStack trace:\n#0 /usr/share/ocsinventory-reports/ocsreports/index.php(44): require()\n#1 {main}\n thrown in /usr/share/ocsinventory-reports/ocsreports/require/header.php on line 31
But the files are there
Solution:
Maybe, OCS Inventory Reports:
Verify the file permissions and ownership of the /usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php file and the entire OCS Inventory Reports directory.
Will check it.
Error: Failed opening required ‘/usr/share/ocsinventory-reports/ocsreports/vendor/autoload.php’
There is not file here.
https://github.com/OCSInventory-NG/OCSInventory-ocsreports/issues/786
The issue is because of composer, it hasn’t created the files.
Running composer:
composer install
root@91e3e9afa1e4:/usr/share/ocsinventory-reports/ocsreports# composer install
Composer could not detect the root package (vendor/composer) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 4 installs, 0 updates, 0 removals
- Downloading ircmaxell/password-compat (v1.0.4)
- Downloading psr/log (1.1.4)
- Downloading jasig/phpcas (1.4.0)
- Downloading phpmailer/phpmailer (v6.9.1)
0/4 [>---------------------------] 0% Failed to download ircmaxell/password-compat from dist: curl error 28 while downloading https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c: Failed to connect to api.github.com port 443 after 5221 ms: Connection timed out
Now trying to download from source
- Syncing ircmaxell/password-compat (v1.0.4) into cache
Composer cannot download a package because it doesn’t exists.
I think manually installing the project is giving issue.
Installation 2:
Container of OCS:
OCS have provide their own container read more here
To get these examples / templates, clone our git repository :
git clone https://github.com/OCSInventory-NG/OCSInventory-Docker-Image
Browse to tag directory (i.e) :
cd 2.12.2/
Inside this directory I have
FROM ubuntu:22.04
ENV OCS_VERSION 2.12.2
LABEL maintainer="contact@ocsinventory-ng.org" \
version="${OCS_VERSION}" \
description="OCS Inventory docker image"
ARG APT_FLAGS="-y"
ENV APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data \
APACHE_LOG_DIR=/var/log/apache2 APACHE_PID_FILE=/var/run/apache2/apache2.pid APACHE_RUN_DIR=/var/run/apache2 APACHE_LOCK_DIR=/var/lock/apache2 \
OCS_DB_SERVER=dbsrv OCS_DB_PORT=3306 OCS_DB_USER=ocs OCS_DB_PASS=ocs OCS_DB_NAME=ocsweb \
OCS_LOG_DIR=/var/log/ocsinventory-server OCS_VARLIB_DIR=/var/lib/ocsinventory-reports/ OCS_WEBCONSOLE_DIR=/usr/share/ocsinventory-reports \
OCS_PERLEXT_DIR=/etc/ocsinventory-server/perl/ OCS_PLUGINSEXT_DIR=/etc/ocsinventory-server/plugins/ \
OCS_SSL_ENABLED=0 OCS_SSL_WEB_MODE=DISABLED OCS_SSL_COM_MODE=DISABLED OCS_SSL_KEY=/path/to/key OCS_SSL_CERT=/path/to/cert OCS_SSL_CA=/path/to/ca \
TZ=Europe/Paris
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
VOLUME /var/lib/ocsinventory-reports /etc/ocsinventory-server /usr/share/ocsinventory-reports/ocsreports/extensions
RUN apt-get update && apt-get install -y \
wget \
curl \
make \
perl \
apache2 \
php \
libxml-simple-perl \
libdbi-perl \
libdbd-mysql-perl \
libapache-dbi-perl \
libnet-ip-perl \
libsoap-lite-perl \
libarchive-zip-perl \
libswitch-perl \
libmojolicious-perl \
libplack-perl \
build-essential \
php-pclzip \
php-mbstring \
php-soap \
php-mysql \
php-curl \
php-xml \
php-zip \
php-gd \
php-ldap
RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/${OCS_VERSION}/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -P /tmp && \
tar xzf /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -C /tmp;
RUN cd /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Apache/ && \
perl Makefile.PL && \
make && \
make install
WORKDIR /etc/apache2/conf-available
# Redirect Apache2 Logs to stdout e stderr
RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
ln -sf /proc/self/fd/2 /var/log/apache2/error.log
COPY conf/* /tmp/conf/
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
COPY ./docker-entrypoint.d /docker-entrypoint.d
EXPOSE 80
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/usr/sbin/apache2", "-DFOREGROUND"]
Creating an image from this containerfile:
podman build -t ocs0.5 .
- -t is for tag
- . is for considering Containerfile from current directory.
Issue:
STEP 9/18: RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/${OCS_VERSION}/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -P /tmp && tar xzf /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -C /tmp;
--2024-08-22 12:05:45-- https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.12.2/OCSNG_UNIX_SERVER-2.12.2.tar.gz
Resolving github.com (github.com)... 0.0.0.17, ::17
Connecting to github.com (github.com)|0.0.0.17|:443...
Here it is taking a lot of time to download, I wonder why it cannot connect to Github.
Ah! It was my Portmaster.
STEP 1/18: FROM ubuntu:22.04
STEP 2/18: ENV OCS_VERSION 2.12.2
--> Using cache 0a3876c6a5173358db265eb32c34d560b13c15f9ced03f3f8038217b9a2ac24b
--> 0a3876c6a517
STEP 3/18: LABEL maintainer="contact@ocsinventory-ng.org" version="${OCS_VERSION}" description="OCS Inventory docker image"
--> Using cache 0d3f68cbf0dee1b06b6229cb8c80f096657f39c8a86c38ba8447538290b9382f
--> 0d3f68cbf0de
STEP 4/18: ARG APT_FLAGS="-y"
--> Using cache 8d6746862be6a378e46d7e3dcd80a5ea4a1bec16d1517876d7d8fa597cdd71c9
--> 8d6746862be6
STEP 5/18: ENV APACHE_RUN_USER=www-data APACHE_RUN_GROUP=www-data APACHE_LOG_DIR=/var/log/apache2 APACHE_PID_FILE=/var/run/apache2/apache2.pid APACHE_RUN_DIR=/var/run/apache2 APACHE_LOCK_DIR=/var/lock/apache2 OCS_DB_SERVER=dbsrv OCS_DB_PORT=3306 OCS_DB_USER=ocs OCS_DB_PASS=ocs OCS_DB_NAME=ocsweb OCS_LOG_DIR=/var/log/ocsinventory-server OCS_VARLIB_DIR=/var/lib/ocsinventory-reports/ OCS_WEBCONSOLE_DIR=/usr/share/ocsinventory-reports OCS_PERLEXT_DIR=/etc/ocsinventory-server/perl/ OCS_PLUGINSEXT_DIR=/etc/ocsinventory-server/plugins/ OCS_SSL_ENABLED=0 OCS_SSL_WEB_MODE=DISABLED OCS_SSL_COM_MODE=DISABLED OCS_SSL_KEY=/path/to/key OCS_SSL_CERT=/path/to/cert OCS_SSL_CA=/path/to/ca TZ=Europe/Paris
--> Using cache 9d5aa772e7bcf2a6e49d509d0060021ee8aaf788180e6bd1a485c735edea84c8
--> 9d5aa772e7bc
STEP 6/18: RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
--> Using cache 9d8a8cf45501463bdebc414568b8c8ed847f51d21ec7f68d00ee11e031d783a4
--> 9d8a8cf45501
STEP 7/18: VOLUME /var/lib/ocsinventory-reports /etc/ocsinventory-server /usr/share/ocsinventory-reports/ocsreports/extensions
--> Using cache a2527ddcd48767de7cfb0e8d8d64157a94680ad8710eac10c5c9d8233bea41b0
--> a2527ddcd487
STEP 8/18: RUN apt-get update && apt-get install -y wget curl make perl apache2 php libxml-simple-perl libdbi-perl libdbd-mysql-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl libarchive-zip-perl libswitch-perl libmojolicious-perl libplack-perl build-essential php-pclzip php-mbstring php-soap php-mysql php-curl php-xml php-zip php-gd php-ldap
--> Using cache 63af50ae5b4e12197867468a3b0187bdc25251a7e0f4825f5773111f8c1c0b75
--> 63af50ae5b4e
STEP 9/18: RUN wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/${OCS_VERSION}/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -P /tmp && tar xzf /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}.tar.gz -C /tmp;
--2024-08-22 12:10:01-- https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.12.2/OCSNG_UNIX_SERVER-2.12.2.tar.gz
Resolving github.com (github.com)... 140.82.121.3
Connecting to github.com (github.com)|140.82.121.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/36722650/b153e901-38d5-44b8-be55-64674aea2c98?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240822%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240822T101006Z&X-Amz-Expires=300&X-Amz-Signature=4ca46db5f6590b66cf4be6b537693b0efc9fc8129b20de49ba276854873ae202&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=36722650&response-content-disposition=attachment%3B%20filename%3DOCSNG_UNIX_SERVER-2.12.2.tar.gz&response-content-type=application%2Foctet-stream [following]
--2024-08-22 12:10:03-- https://objects.githubusercontent.com/github-production-release-asset-2e65be/36722650/b153e901-38d5-44b8-be55-64674aea2c98?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=releaseassetproduction%2F20240822%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20240822T101006Z&X-Amz-Expires=300&X-Amz-Signature=4ca46db5f6590b66cf4be6b537693b0efc9fc8129b20de49ba276854873ae202&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=36722650&response-content-disposition=attachment%3B%20filename%3DOCSNG_UNIX_SERVER-2.12.2.tar.gz&response-content-type=application%2Foctet-stream
Resolving objects.githubusercontent.com (objects.githubusercontent.com)... 185.199.111.133, 185.199.110.133, 185.199.109.133, ...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.111.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5618764 (5.4M) [application/octet-stream]
Saving to: '/tmp/OCSNG_UNIX_SERVER-2.12.2.tar.gz'
0K .......... .......... .......... .......... .......... 0% 796K 7s
5300K .......... .......... .......... .......... .......... 97% 3.40M 0s
5350K .......... .......... .......... .......... .......... 98% 4.82M 0s
5400K .......... .......... .......... .......... .......... 99% 4.16M 0s
5450K .......... .......... .......... ....... 100% 3.82M=2.3s
2024-08-22 12:10:06 (2.36 MB/s) - '/tmp/OCSNG_UNIX_SERVER-2.12.2.tar.gz' saved [5618764/5618764]
--> 184be2976c04
STEP 10/18: RUN cd /tmp/OCSNG_UNIX_SERVER-${OCS_VERSION}/Apache/ && perl Makefile.PL && make && make install
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Apache::Ocsinventory
Writing MYMETA.yml and MYMETA.json
cp Ocsinventory/Server/Capacities/Registry.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Registry.pm
cp Ocsinventory/Interface/Ipdiscover.pm blib/lib/Apache/Ocsinventory/Interface/Ipdiscover.pm
cp Ocsinventory/Interface.pm blib/lib/Apache/Ocsinventory/Interface.pm
cp Ocsinventory/Plugins.pm blib/lib/Apache/Ocsinventory/Plugins.pm
cp Ocsinventory/Interface/Database.pm blib/lib/Apache/Ocsinventory/Interface/Database.pm
cp Ocsinventory/Server/Capacities/Notify.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Notify.pm
cp Ocsinventory/Interface/Saas.pm blib/lib/Apache/Ocsinventory/Interface/Saas.pm
cp Ocsinventory/Interface/Internals.pm blib/lib/Apache/Ocsinventory/Interface/Internals.pm
cp Ocsinventory.pm blib/lib/Apache/Ocsinventory.pm
cp Ocsinventory/Server/Capacities/Snmp.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Snmp.pm
cp Ocsinventory/Server/Capacities/Ipdiscover.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Ipdiscover.pm
cp Ocsinventory/Interface/Updates.pm blib/lib/Apache/Ocsinventory/Interface/Updates.pm
cp Ocsinventory/Interface/SoftwareCategory.pm blib/lib/Apache/Ocsinventory/Interface/SoftwareCategory.pm
cp Ocsinventory/Interface/Snmp.pm blib/lib/Apache/Ocsinventory/Interface/Snmp.pm
cp Ocsinventory/Map.pm blib/lib/Apache/Ocsinventory/Map.pm
cp Ocsinventory/Server/Capacities/Datafilter.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Datafilter.pm
cp Ocsinventory/Interface/Inventory.pm blib/lib/Apache/Ocsinventory/Interface/Inventory.pm
cp Ocsinventory/Interface/AssetCategory.pm blib/lib/Apache/Ocsinventory/Interface/AssetCategory.pm
cp Ocsinventory/SOAP.pm blib/lib/Apache/Ocsinventory/SOAP.pm
cp Ocsinventory/Server/Capacities/Filter.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Filter.pm
cp Ocsinventory/Plugins/Modules.pm blib/lib/Apache/Ocsinventory/Plugins/Modules.pm
cp Ocsinventory/Server/Capacities/Download/Inventory.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Download/Inventory.pm
cp Ocsinventory/Server/Capacities/Download.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Download.pm
cp Ocsinventory/Interface/History.pm blib/lib/Apache/Ocsinventory/Interface/History.pm
cp Ocsinventory/Server/Capacities/Example.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Example.pm
cp Ocsinventory/Interface/Extensions.pm blib/lib/Apache/Ocsinventory/Interface/Extensions.pm
cp Ocsinventory/Interface/Config.pm blib/lib/Apache/Ocsinventory/Interface/Config.pm
cp Ocsinventory/Server/Capacities/Update.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Update.pm
cp Ocsinventory/Server/Inventory/Update/Hardware.pm blib/lib/Apache/Ocsinventory/Server/Inventory/Update/Hardware.pm
cp Ocsinventory/Server/Constants.pm blib/lib/Apache/Ocsinventory/Server/Constants.pm
cp Ocsinventory/Server/Inventory.pm blib/lib/Apache/Ocsinventory/Server/Inventory.pm
cp Ocsinventory/Server/Groups.pm blib/lib/Apache/Ocsinventory/Server/Groups.pm
cp Ocsinventory/Server/Inventory/Update.pm blib/lib/Apache/Ocsinventory/Server/Inventory/Update.pm
cp Ocsinventory/Server/Inventory/Capacities.pm blib/lib/Apache/Ocsinventory/Server/Inventory/Capacities.pm
cp Ocsinventory/Server/Communication.pm blib/lib/Apache/Ocsinventory/Server/Communication.pm
cp Ocsinventory/Server/Capacities/Snmp/Inventory.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Snmp/Inventory.pm
cp Ocsinventory/Server/Communication/Session.pm blib/lib/Apache/Ocsinventory/Server/Communication/Session.pm
cp Ocsinventory/Server/System.pm blib/lib/Apache/Ocsinventory/Server/System.pm
cp Ocsinventory/Server/Modperl1.pm blib/lib/Apache/Ocsinventory/Server/Modperl1.pm
cp Ocsinventory/Server/Duplicate.pm blib/lib/Apache/Ocsinventory/Server/Duplicate.pm
cp Ocsinventory/Server/Useragent.pm blib/lib/Apache/Ocsinventory/Server/Useragent.pm
cp Ocsinventory/Server/Inventory/Export.pm blib/lib/Apache/Ocsinventory/Server/Inventory/Export.pm
cp Ocsinventory/Server/Inventory/Cache.pm blib/lib/Apache/Ocsinventory/Server/Inventory/Cache.pm
cp Ocsinventory/Server/Inventory/Software.pm blib/lib/Apache/Ocsinventory/Server/Inventory/Software.pm
cp Ocsinventory/Server/Inventory/Update/AccountInfos.pm blib/lib/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm
cp Ocsinventory/Server/Inventory/Filter.pm blib/lib/Apache/Ocsinventory/Server/Inventory/Filter.pm
cp Ocsinventory/Server/Modperl2.pm blib/lib/Apache/Ocsinventory/Server/Modperl2.pm
cp Ocsinventory/Server/Capacities/Snmp/Data.pm blib/lib/Apache/Ocsinventory/Server/Capacities/Snmp/Data.pm
cp Ocsinventory/Server/Inventory/Data.pm blib/lib/Apache/Ocsinventory/Server/Inventory/Data.pm
cp Ocsinventory/Server/System/Config.pm blib/lib/Apache/Ocsinventory/Server/System/Config.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Plugins.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Map.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/SOAP.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Constants.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Groups.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Communication.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/System.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Modperl1.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Duplicate.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Useragent.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Modperl2.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Registry.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Notify.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Snmp.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Ipdiscover.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Datafilter.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Filter.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Download.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Example.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Update.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Download/Inventory.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Snmp/Inventory.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Capacities/Snmp/Data.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory/Update.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory/Capacities.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory/Export.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory/Cache.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory/Software.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory/Filter.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory/Data.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory/Update/Hardware.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Inventory/Update/AccountInfos.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/Communication/Session.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Server/System/Config.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/Ipdiscover.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/Database.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/Saas.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/Internals.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/Updates.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/SoftwareCategory.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/Snmp.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/Inventory.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/AssetCategory.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/History.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/Extensions.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Interface/Config.pm
Installing /usr/local/share/perl/5.34.0/Apache/Ocsinventory/Plugins/Modules.pm
Appending installation info to /usr/local/lib/x86_64-linux-gnu/perl/5.34.0/perllocal.pod
--> 5b730cd3c23b
STEP 11/18: WORKDIR /etc/apache2/conf-available
--> 46e52a67af19
STEP 12/18: RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && ln -sf /proc/self/fd/2 /var/log/apache2/error.log
--> 371744952000
STEP 13/18: COPY conf/* /tmp/conf/
--> 9b50c21be618
STEP 14/18: COPY ./docker-entrypoint.sh /docker-entrypoint.sh
--> 44e54cd6aeec
STEP 15/18: COPY ./docker-entrypoint.d /docker-entrypoint.d
--> 1fc3f7f4c320
STEP 16/18: EXPOSE 80
--> 840573a86fea
STEP 17/18: ENTRYPOINT ["/docker-entrypoint.sh"]
--> b4e776940991
STEP 18/18: CMD ["/usr/sbin/apache2", "-DFOREGROUND"]
COMMIT ocs0.5
--> db76d5b162d1
Successfully tagged localhost/ocs0.5:latest
db76d5b162d170b243d4766f9614848acd698a7ece4508329094531637f7e21a
This will create image:
podman images
REPOSITORY TAG IMAGE ID CREATED SIZE
localhost/ocs0.5 latest db76d5b162d1 About a minute ago 572 MB
podman run --name ocs0.5-container -p 8080:80 localhost/ocs0.5
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/01-start.sh
+----------------------------------------------------------+
| |
| Welcome to OCS Inventory NG Management Docker! |
| |
+----------------------------------------------------------+
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-com-server.sh
+-----------------------------------------------+
| Customizing from environment variables... |
+-----------------------------------------------+
Applying Config OCS_DB_USER=ocs from environment variable
Applying Config OCS_DB_NAME=ocsweb from environment variable
Applying Config OCS_DB_PORT=3306 from environment variable
Enabling conf z-ocsinventory-server.
To activate the new configuration, you need to run:
service apache2 reload
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-web-console.sh
Enabling conf ocsinventory-reports.
To activate the new configuration, you need to run:
service apache2 reload
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-api-server.sh
Enabling conf zz-ocsinventory-restapi.
To activate the new configuration, you need to run:
service apache2 reload
/docker-entrypoint.sh: Launching /docker-entrypoint.d/99-finish.sh
+----------------------------------------------------------+
| Setting Apache Server Name to 'localhost'
+----------------------------------------------------------+
+--------------------------------+
| Removing not used files... |
+--------------------------------+
+----------------------------------------------------------+
| OK, prepare finshed ;-) |
| |
| Starting OCS Inventory NG Management Docker... |
+----------------------------------------------------------+
/docker-entrypoint.sh: Configuration complete; ready for start up
AH00526: Syntax error on line 77 of /etc/apache2/conf-enabled/z-ocsinventory-server.conf:
PerlSetEnv takes two arguments, PerlSetEnv
I think version 2.12.2 have issues.
Trying 2.12 instead.
Nope I guess database is not connecting.
Installation 3:
Following this blog.
Creating ubuntu container:
podman run -it --name ocs0.6 -p 8080:80 -v ~/Desktop/Work/OCS/ocs-data:/data docker.io/library/ubuntu:22.04
Running the commands inside ocs0.6 container:
1 exit
2 clear
3 apt install perl libxml-simple-perl libcompress-zlib-perl libdbi-perl libdbd-mysql-perl libnet-ip-perl libsoap-lite-perl libio-compress-perl apache2 libapache2-mod-perl2 libapache2-mod-perl2-dev libapache-dbi-perl libapache-db-perl libapache2-mod-php libarchive-zip-perl mariadb-server composer php-mbstring php-xml php-mysql php-zip php-pclzip php-gd php-soap php-curl php-json
4 clear
5 apt update
6 apt upgrade
7 clear
8 apt install git curl wget make cmake gcc make
9 apt install perl libxml-simple-perl libcompress-zlib-perl libdbi-perl libdbd-mysql-perl libnet-ip-perl libsoap-lite-perl libio-compress-perl
10 apt install apache2 libapache2-mod-perl2 libapache2-mod-perl2-dev libapache-dbi-perl libapache-db-perl libapache2-mod-php libarchive-zip-perl mariadb-server composer php-mbstring php-xml php-mysql php-zip php-pclzip php-gd php-soap php-curl php-json
11 clear
12 service apache2 start
13 service mariadb status
14 service mariadb start
15 php -v
16 composer -v
17 perl -MCPAN -e 'install Apache2::SOAP'
18 perl -MCPAN -e 'install XML::Entities'
19 perl -MCPAN -e 'install Net::IP'
20 perl -MCPAN -e 'install Apache::DBI'
21 perl -MCPAN -e 'install Mojolicious'
22 perl -MCPAN -e 'install Switch'
23 perl -MCPAN -e 'install Plack::Handler'
24 mariadb-secure-installation
25 clear
26 mariadb -u root -p
27 nano /etc/php/8.1/apache2/php.ini
28 apt nano
29 apt install nano
30 nano /etc/php/8.1/apache2/php.ini
31 clear
32 service apache2 restart
33 cd /var/www/
34 git clone https://github.com/OCSInventory-NG/OCSInventory-Server.git
35 clear
36 ls
37 cd OCSInventory-Server/
38 git clone https://github.com/OCSInventory-NG/OCSInventory-ocsreports.git ocsreports
39 clear
40 cd ocsreports/
41 cd /var/www/OCSInventory-Server/
42 nano setup.sh
43 ./setup.sh
44 clear
45 ls
46 ln -s /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/conf-enabled/ocsinventory-reports.conf
47 ln -s /etc/apache2/conf-available/z-ocsinventory-server.conf /etc/apache2/conf-enabled/z-ocsinventory-server.conf
48 ln -s /etc/apache2/conf-available/zz-ocsinventory-restapi.conf /etc/apache2/conf-enabled/zz-ocsinventory-restapi.conf
49 chown -R www-data:www-data /var/lib/ocsinventory-reports
50 apachectl configtest
51 service apache2 restart
52 mv /usr/share/ocsinventory-reports/ocsreports/install.php /usr/share/ocsinventory-reports/ocsreports/-install.php
53 clear
54 history
This set of commands is used to install and configure the OCS Inventory NG (Open Computer and Software Inventory Next Generation) server on a system.
Install required packages:
- This command installs various packages required for the OCS Inventory NG server, including Apache, MariaDB, PHP, and Perl modules.
apt install perl libxml-simple-perl libcompress-zlib-perl libdbi-perl libdbd-mysql-perl libnet-ip-perl libsoap-lite-perl libio-compress-perl apache2 libapache2-mod-perl2 libapache2-mod-perl2-dev libapache-dbi-perl libapache-db-perl libapache2-mod-php libarchive-zip-perl mariadb-server composer php-mbstring php-xml php-mysql php-zip php-pclzip php-gd php-soap php-curl php-json
Update and upgrade packages:
- These commands update the package lists and upgrade the installed packages.
apt update apt upgrade
Install additional development tools:
- This command installs Git, cURL, wget, make, CMake, GCC, and other development tools.
apt install git curl wget make cmake gcc make
Start Apache and MariaDB services:
- These commands start the Apache and MariaDB services.
service apache2 start service mariadb start
Install Perl modules using CPAN:
- These commands install various Perl modules required by the OCS Inventory NG server using the Comprehensive Perl Archive Network (CPAN).
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'
Secure the MariaDB installation:
- This command runs the MariaDB secure installation script.
mariadb-secure-installation
Clone the OCS Inventory NG server and client repositories:
- These commands clone the OCS Inventory NG server and client repositories from GitHub.
cd /var/www/ git clone https://github.com/OCSInventory-NG/OCSInventory-Server.git cd OCSInventory-Server/ git clone https://github.com/OCSInventory-NG/OCSInventory-ocsreports.git ocsreports
Run the OCS Inventory NG server setup script:
- This command runs the setup script for the OCS Inventory NG server.
cd /var/www/OCSInventory-Server/ ./setup.sh
Enable the OCS Inventory NG server and client configurations in Apache:
- These commands create symbolic links to enable the OCS Inventory NG server and client configurations in Apache.
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
Set the ownership of the OCS Inventory NG reports directory:
- This command sets the ownership of the OCS Inventory NG reports directory to the Apache user.
chown -R www-data:www-data /var/lib/oc
Test the Apache configuration:
- This command tests the Apache configuration for any syntax errors.
apachectl configtest
Restart the Apache service:
- This command restarts the Apache service to apply the changes.
service apache2 restart
Rename the OCS Inventory NG installation file:
- This command renames the
install.php
file to-install.php
to prevent direct access to the installation page.
mv /usr/share/ocsinventory-reports/ocsreports/install.php /usr/share/ocsinventory-reports/ocsreports/-install.php
- This command renames the
Check the command history:
- This command displays the command history.
history
After completing these steps, the OCS Inventory NG server should be installed and configured on the system. You can now access the OCS Inventory NG web interface by navigating to the appropriate URL in your web browser.
Installation successful!
Password for mariadb: root
OCS admin account password: ocsinventory
Adding assets to Server:
Sure, here’s the markdown version of the provided information:
FactorFX
OCS Inventory downloads
We thank you for your interest in the OCS Inventory project.
Are you an IT professional? Click here to have more information about expertise and OCS Inventory support services. https://ocsinventory-ng.org/?page_id=140&lang=en
You will find below download links to install OCS Inventory.
Server:
- Linux/Unix Server 2.12.2 https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.12.2/OCSNG_UNIX_SERVER-2.12.2.tar.gz
- Linux/Unix Server 2.12.2 (nightly) http://download.ocsinventory-ng.org/nightly
Agents:
- Windows Agent 2.10.1.0 (64 bits) https://github.com/OCSInventory-NG/WindowsAgent/releases/download/2.10.1.0/OCS-Windows-Agent-2.10.1.0_x64.zip
- Windows Agent 2.10.1.0 (32 bits) https://github.com/OCSInventory-NG/WindowsAgent/releases/download/2.10.1.0/OCS-Windows-Agent-2.10.1.0_x86.zip
- Windows Agent 2.1.1.1 (XP & 2003R2 only) https://github.com/OCSInventory-NG/WindowsAgent/releases/download/2.1.1.1/OCSNG-Windows-Agent-2.1.1.zip
- Unix/Linux Agent 2.10.2 https://github.com/OCSInventory-NG/UnixAgent/releases/download/v2.10.2/Ocsinventory-Unix-Agent-2.10.2.tar.gz
- Unix/Linux Redhat https://rpm.ocsinventory-ng.org repositories http://rpm.ocsinventory-ng.org
- MacOS X Agent 2.10.2 https://github.com/OCSInventory-NG/UnixAgent/releases/download/v2.10.2-MAC/Ocsinventory-Unix-Agent-2.10.2-MAC.tar.gz
- Android Agent 2.7 [https://github.com/OCSInventory-NG/AndroidAgent/releases/download/2.7/OCSNG-Android-Agent.2.7.apk](https://github.com/OCSInventory-NG/AndroidAgent/
23 August progress:
Installing OCS NG on Android.
From here install this app on your android phone.
Nginx Setup Commands
This set of commands is used to install and configure the Nginx web server on a system.
Update package manager and install Nginx:
- This command updates the package manager’s package lists and then installs the Nginx web server package.
sudo dnf upgrade --refresh sudo dnf install nginx
Check Nginx version:
- This command checks the version of the installed Nginx web server.
nginx -v
Allow HTTP traffic through the firewall:
- This command adds the HTTP service to the public firewall zone permanently, allowing incoming HTTP traffic.
sudo firewall-cmd --permanent --zone=public --add-service=http
Allow HTTP traffic through the Uncomplicated Firewall (UFW):
- These commands allow HTTP traffic (port 80) through the UFW firewall.
sudo ufw allow http sudo ufw allow 80
Check Nginx service status:
- This command checks the status of the Nginx service.
systemctl status nginx
Check if Nginx is listening on port 80:
- This command checks if Nginx is listening on port 80.
sudo netstat -antp | grep ':80'
Disable and enable the UFW firewall:
- These commands disable and then enable the UFW firewall.
sudo ufw disable sudo ufw enable
Reboot the system:
- This command reboots the system.
sudo reboot
Test the Nginx configuration:
- This command tests the Nginx configuration file for any syntax errors.
sudo nginx -t
Reload the Nginx service:
- This command reloads the Nginx service with the updated configuration.
sudo nginx -s reload
Data inside nginx.config file
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
types_hash_max_size 2048;
types_hash_bucket_size 128;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
}
}
Installation done!
Issue resolution:
There is no data on server from agents. forum post this is similar but no solution given.
63 cat /var/log/ocsinventory-server/activity.log
64 mariadb -u root -p
65 clear
66 find / -name dbconfig.inc.php 2>/dev/null
67 cat /var/www/OCSInventory-Server/ocsreports/dbconfig.inc.php
68 cat /data/OCSInventory-Server/ocsreports/dbconfig.inc.php
69 cat /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php
70 nano /data/OCSInventory-Server/ocsreports/dbconfig.inc.php
71 cat /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php
72 nano /var/www/OCSInventory-Server/ocsreports/dbconfig.inc.php
73 clear
74 service apache2 restart
75 cat /var/log/ocsinventory-server/activity.log
76 service mariadb start
77 service apache2 start
78 cat /var/log/ocsinventory-server/activity.log
79 cd /var/www/OCSInventory-Server/
80 ls
81 cd etc/
82 ls
83 cd ocsinventory/
84 ls
85 nano ocsinventory-server.conf
86 clear
87 service apache2 restart
88 service mariadb restart
89 cat /var/log/ocsinventory-server/activity.log
95 ./setup.sh
96 cd /etc/apache2/conf-available/z-ocsinventory-server.conf
97 cat /etc/apache2/conf-available/z-ocsinventory-server.conf
98 nano /etc/apache2/conf-available/z-ocsinventory-server.conf
99 ln -s /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/conf-enabled/ocsinventory-reports.conf
100 ln -s /etc/apache2/conf-available/z-ocsinventory-server.conf /etc/apache2/conf-enabled/z-ocsinventory-server.conf
101 ln -s /etc/apache2/conf-available/zz-ocsinventory-restapi.conf /etc/apache2/conf-enabled/zz-ocsinventory-restapi.conf
102 nano -s /etc/apache2/conf-available/zz-ocsinventory-restapi.conf /etc/apache2/conf-enabled/zz-ocsinventory-restapi.conf
103 nano -s /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/conf-enabled/ocsinventory-reports.conf
104 service apache2 restart
105 service mariadb restart
106 cat /var/log/ocsinventory-server/activity.log
107 nano -s /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/conf-enabled/ocsinventory-reports.conf
108 nano -s /etc/apache2/conf-available/zz-ocsinventory-restapi.conf /etc/apache2/conf-enabled/zz-ocsinventory-restapi.conf
109 nano /etc/apache2/conf-available/z-ocsinventory-server.conf
110 service apache2 restart
111 service mariadb restart
112 cat /var/log/ocsinventory-server/activity.log
113 history
Make sure the data about database is correct in all the about files. Because of this there was issue to connect agent with server.
August 24 progress:
Now that server is working, I’ll add how I am starting the server.
- Open Podman and start the container.
podman start ocs0.6 && podman attach ocs0.6
- Start Apache and MariaDB
service mariadb start
service apache start
- As the OCS server is running on a container at localhost:8080, I have configured Nginx to route traffic on my local IP to localhost:8080
sudo nginx