{"id":18038,"date":"2023-07-15T01:00:11","date_gmt":"2023-07-14T22:00:11","guid":{"rendered":"https:\/\/kifarunix.com\/?p=18038"},"modified":"2024-03-10T10:22:39","modified_gmt":"2024-03-10T07:22:39","slug":"install-ocs-inventory-server-on-debian","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-ocs-inventory-server-on-debian\/","title":{"rendered":"Install OCS Inventory Server on Debian 12\/Debian 11"},"content":{"rendered":"\n<p>In this tutorial, you will learn how to install OCS Inventory Server on Debian 12\/Debian 11. <a href=\"https:\/\/ocsinventory-ng.org\/?lang=en\" target=\"_blank\" rel=\"noreferrer noopener\">OCS (Open Computers and Software Inventory Next Generation)<\/a> is an opensource assets inventory management solution. It is used to inventory hardware and software details of IT assets either using the OCS Inventory Agent or SNMP polling for assets that the agent cannot be deployed (<em>e.g routers, switches, printers<\/em>. Inventoried results can be visualized through a web interface.<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>Table of Contents<\/h2><nav><ul><li><a href=\"#installing-ocs-inventory-server-on-debian-12-11\">Installing OCS Inventory Server on Debian 12|11<\/a><ul><li><a href=\"#install-maria-db-database\">Install MariaDB Database<\/a><\/li><li><a href=\"#install-php-and-required-modules\">Install PHP and Required Modules<\/a><\/li><li><a href=\"#install-ocs-ng-inventory-apt-repository\">Install OCS NG Inventory APT Repository<\/a><\/li><li><a href=\"#install-ocs-inventory-server\">Install OCS Inventory Server<\/a><\/li><li><a href=\"#update-ocs-inventory-db-connection-settings\">Update OCS Inventory DB Connection Settings<\/a><\/li><li><a href=\"#update-php-settings\">Update PHP Settings<\/a><\/li><li><a href=\"#update-ocs-configs-owership-and-permissions\">Update OCS Configs Owership and Permissions<\/a><\/li><li><a href=\"#finalize-ocs-ng-configuration-via-web-interface\">Finalize OCS-NG Configuration via Web Interface<\/a><\/li><li><a href=\"#ocs-inventory-server-web-dashboard\">OCS Inventory Server Web Dashboard<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-ocs-inventory-server-on-debian-12-11\">Installing OCS Inventory Server on Debian 12|11<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-maria-db-database\">Install MariaDB Database<\/h3>\n\n\n\n<p>A database is required by OCS to store inventory information.<\/p>\n\n\n\n<p>Check the link below to install MariaDB database on Debian;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/?s=mariadb+debian\" target=\"_blank\" rel=\"noreferrer noopener\">How to install and setup MariaDB database on Debian<\/a><\/p>\n\n\n\n<p>Assuming you have already installed MariaDB, let&#8217;s create the database and database users for OCS inventory server.<\/p>\n\n\n\n<p>Be sure to replace the name of the database and database user, and the user password.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p -e \"create database ocsng_db;\"<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mysql -u root -p -e \"create user ocsadmin@localhost identified by 'ChangeME'; \\\ngrant all on ocsng_db.* to ocsadmin@localhost; flush privileges;\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-php-and-required-modules\">Install PHP and Required Modules<\/h3>\n\n\n\n<p>Note that PHP 7.4 is default version available on Debian 11 repositories by default. Use the guide below to install PHP 8 on Debian 11;<\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-php-8-on-debian-11\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install PHP 8.0\/8.1\/8.2\/8.x on Debian 11<\/a><\/p>\n\n\n\n<p>On Debian 12, PHP 8 is available on the default repos. Thus, execute the command below to install PHP and required modules;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install php php-pclzip php-mbstring php-soap php-mysql php-curl php-xml php-zip php-gd<\/code><\/pre>\n\n\n\n<p>Confirm the PHP version installed;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php -v<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>PHP 8.2.7 (cli) (built: Jun  9 2023 19:37:27) (NTS)\nCopyright (c) The PHP Group\nZend Engine v4.2.7, Copyright (c) Zend Technologies\n    with Zend OPcache v8.2.7, Copyright (c), by Zend Technologies<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-ocs-ng-inventory-apt-repository\">Install OCS NG Inventory APT Repository<\/h3>\n\n\n\n<p>In order to be able to install the <a href=\"https:\/\/github.com\/OCSInventory-NG\/OCSInventory-ocsreports\/releases\" target=\"_blank\" rel=\"noreferrer noopener\">latest and stable release<\/a> version of OCS Inventory server on Debian, you need to install their APT repository.<\/p>\n\n\n\n<p><strong>NOTE<\/strong>: As much there is no support for Debian 12 on the APT repository, the repos for Debian 11 should still be able to work.<\/p>\n\n\n\n<p>Thus, to install the OCS APT repository on Debian 12\/Debian 11;<\/p>\n\n\n\n<p>Install the Repository signing key;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install gnupg2 curl wget -y<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -sS http:\/\/deb.ocsinventory-ng.org\/pubkey.gpg | \\\ngpg --dearmor -o \/etc\/apt\/trusted.gpg.d\/ocs.gpg<\/code><\/pre>\n\n\n\n<p>Next, install the repo itself;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"deb http:\/\/deb.ocsinventory-ng.org\/debian\/ bullseye main\" | \\\ntee \/etc\/apt\/sources.list.d\/ocsinventory.list<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-ocs-inventory-server\">Install OCS Inventory Server<\/h3>\n\n\n\n<p>The use of the APT repository installed above ensures that some of the package dependencies required to setup OCS inventory server on Debian installed.<\/p>\n\n\n\n<p>Run system package cache update;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<p>Before you can proceed, install some other required Perl module;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>perl -MCPAN -e 'install XML::Entities'<\/code><\/pre>\n\n\n\n<p>When prompted, enter <strong>yes<\/strong> and press ENTER to proceed.<\/p>\n\n\n\n<p>Next, install OCS Inventory server and web console; on Debian;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install ocsinventory<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"update-ocs-inventory-db-connection-settings\">Update OCS Inventory DB Connection Settings<\/h3>\n\n\n\n<p>Open the Communication Server Apache configuration file and update the database connection details<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/apache2\/conf-available\/z-ocsinventory-server.conf<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n...\n&lt;IfModule mod_perl.c>\n \n  # Which version of mod_perl we are using\n  # For mod_perl &lt;= 1.999_21, replace 2 by 1\n  # For mod_perl > 1.999_21, replace 2 by 2\n  PerlSetEnv OCS_MODPERL_VERSION 2\n\n  # Master Database settings\n  # Replace localhost by hostname or ip of MySQL server for WRITE\n<strong>  PerlSetEnv OCS_DB_HOST localhost<\/strong>\n  # Replace 3306 by port where running MySQL server, generally 3306\n<strong>  PerlSetEnv OCS_DB_PORT 3306<\/strong>\n  # Name of database\n<strong>  PerlSetEnv OCS_DB_NAME ocsng_db\n  PerlSetEnv OCS_DB_LOCAL ocsng_db<\/strong>\n  # User allowed to connect to database\n<strong>  PerlSetEnv OCS_DB_USER ocsadmin<\/strong>\n  # Password for user\n<strong>  PerlSetVar OCS_DB_PWD ChangeME<\/strong>\n  # SSL Configuration\n...\n<\/code><\/pre>\n\n\n\n<p>Save and exit the configuration file when done.<\/p>\n\n\n\n<p>Next, update the database connection details on the API config;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/apache2\/conf-available\/zz-ocsinventory-restapi.conf<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n...\n&lt;Perl>\n  $ENV{PLACK_ENV} = 'production';\n  $ENV{MOJO_HOME} = '\/usr\/share\/perl5';\n  $ENV{MOJO_MODE} = 'deployment';\n<strong>  $ENV{OCS_DB_HOST} = 'localhost';\n  $ENV{OCS_DB_PORT} = '3306';\n  $ENV{OCS_DB_LOCAL} = 'ocsng_db';\n  $ENV{OCS_DB_NAME} = 'ocsng_db';\n  $ENV{OCS_DB_USER} = 'ocsadmin';\n  $ENV{OCS_DB_PWD} = 'ChangeME';<\/strong>\n  $ENV{OCS_DB_SSL_ENABLED} = 0;\n...\n<\/code><\/pre>\n\n\n\n<p>Save and exit the file.<\/p>\n\n\n\n<p>Similarly, update the web console database connection settings;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/ocsinventory-reports\/dbconfig.inc.php<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\n&lt;?php\n<strong> define(\"DB_NAME\", \"ocsng_db\");\n define(\"SERVER_READ\",\"localhost\");\n define(\"SERVER_WRITE\",\"localhost\");\n define(\"SERVER_PORT\",\"3306\");\n define(\"COMPTE_BASE\",\"ocsadmin\");\n define(\"PSWD_BASE\",\"ChangeMe\");<\/strong>\n define(\"ENABLE_SSL\",\"\");\n define(\"SSL_MODE\",\"\");\n define(\"SSL_KEY\",\"\");\n define(\"SSL_CERT\",\"\");\n define(\"CA_CERT\",\"\");\n ?>\n<\/code><\/pre>\n\n\n\n<p>Save the changes and exit the file<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"update-php-settings\">Update PHP Settings<\/h3>\n\n\n\n<p>Edit the PHP <strong><code>php.ini<\/code><\/strong> to optimize certain settings for OSC best suited for your env.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/php\/*\/apache2\/php.ini<\/code><\/pre>\n\n\n\n<p>OCS recommends disabling&nbsp;<code>max_execution_time<\/code>&nbsp;and&nbsp;<code>max_input_time<\/code>by setting the following value:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>max_execution_time = -1\nmax_input_time = -1<\/code><\/pre>\n\n\n\n<p>These settings define the maximum life time of the script and the time that the script should spend in accepting input.<\/p>\n\n\n\n<p>Adjust file upload limit size:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>upload_max_filesize = 50M\npost_max_size = 51M<\/code><\/pre>\n\n\n\n<p>Additionally you can adjust size of memory for php engine.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>memory_limit = 256M<\/code><\/pre>\n\n\n\n<p>Save and exit the file.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"update-ocs-configs-owership-and-permissions\">Update OCS Configs Owership and Permissions<\/h3>\n\n\n\n<p>Set the proper permissions and ownership of OCS configuration files.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod -R 766 \/usr\/share\/ocsinventory-reports<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>chown -R www-data:www-data \/usr\/share\/ocsinventory-reports \\\n\/var\/lib\/ocsinventory-reports<\/code><\/pre>\n\n\n\n<p>Disable default Apache site;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2dissite 000-default.conf<\/code><\/pre>\n\n\n\n<p>Restart Apache and MariaDB.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart apache2 mariadb<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"finalize-ocs-ng-configuration-via-web-interface\">Finalize OCS-NG Configuration via Web Interface<\/h3>\n\n\n\n<p>If there is a firewall in place, open web ports to allow external access to OCS inventory web console.<\/p>\n\n\n\n<p>Navigate to&nbsp;<code>http:\/\/server-hostname-or-IP\/ocsreports<\/code>&nbsp;on your browser to access OCS.<\/p>\n\n\n\n<p>Configure OCS Inventory database connection details and click&nbsp;<strong>Send.<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1413\" height=\"753\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-web-console-db-settings.png\" alt=\"Install OCS Inventory Server on Debian\" class=\"wp-image-18042\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-web-console-db-settings.png?v=1689976028 1413w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-web-console-db-settings-768x409.png?v=1689976028 768w\" sizes=\"(max-width: 1413px) 100vw, 1413px\" \/><\/figure>\n\n\n\n<p>Installation complete;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1351\" height=\"468\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-install-complete.png\" alt=\"Install OCS Inventory Server on Debian\" class=\"wp-image-18044\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-install-complete.png?v=1689976157 1351w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-install-complete-768x266.png?v=1689976157 768w\" sizes=\"(max-width: 1351px) 100vw, 1351px\" \/><\/figure>\n\n\n\n<p>Next, click&nbsp;<em><strong>Click here to enter OCS-NG GUI<\/strong><\/em>&nbsp;to proceed.<\/p>\n\n\n\n<p>If prompted to perform database update, please do so and proceed to login page when update is done.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1588\" height=\"392\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/02\/ocs-setup-3.png\" alt=\"Install OCS Inventory Server on Debian 12\/Debian 11\" class=\"wp-image-11496\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/02\/ocs-setup-3.png?v=1644298805 1588w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/02\/ocs-setup-3-768x190.png?v=1644298805 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2022\/02\/ocs-setup-3-1536x379.png?v=1644298805 1536w\" sizes=\"(max-width: 1588px) 100vw, 1588px\" \/><\/figure>\n\n\n\n<p>Next, click&nbsp;<em><strong>Click here to enter OCS-NG GUI<\/strong><\/em>&nbsp;to login to OCS web interface.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"ocs-inventory-server-web-dashboard\">OCS Inventory Server Web Dashboard<\/h3>\n\n\n\n<p>Use the default credentials:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>login: <em><strong>admin<\/strong><\/em><\/li>\n\n\n\n<li>password: <em><strong>admin<\/strong><\/em><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1452\" height=\"642\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-server-login-page.png\" alt=\"Install OCS Inventory Server on Debian\" class=\"wp-image-18045\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-server-login-page.png?v=1689976300 1452w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-server-login-page-768x340.png?v=1689976300 768w\" sizes=\"(max-width: 1452px) 100vw, 1452px\" \/><\/figure>\n\n\n\n<p>OCS Inventory server dashboard;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1448\" height=\"696\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-dashboard.png\" alt=\"Install OCS Inventory Server on Debian\" class=\"wp-image-18046\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-dashboard.png?v=1689976476 1448w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-dashboard-768x369.png?v=1689976476 768w\" sizes=\"(max-width: 1448px) 100vw, 1448px\" \/><\/figure>\n\n\n\n<p>Reset the password:&nbsp;<strong>Settings gear &gt; My account &gt; Password.<\/strong><\/p>\n\n\n\n<p>Remove the installation script.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv \/usr\/share\/ocsinventory-reports\/ocsreports\/install.php{,.old}<\/code><\/pre>\n\n\n\n<p>That marks the end of our guide on how to install OCS NG Inventory server on Debian 12\/Debian 11.<\/p>\n\n\n\n<p>Reference: <a href=\"http:\/\/wiki.ocsinventory-ng.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">OCS Inventory Documentation<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you will learn how to install OCS Inventory Server on Debian 12\/Debian 11. OCS (Open Computers and Software Inventory Next Generation) is<\/p>\n","protected":false},"author":10,"featured_media":11497,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[121,984,1094],"tags":[6859,7094,7095,4678,7093],"class_list":["post-18038","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-asset-management","category-ocs-inventory","tag-debian-12","tag-debian-12-install-ocs-inventory-server","tag-ocs-inventory-server","tag-ocs-server","tag-ocs-server-install-debian","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/18038"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=18038"}],"version-history":[{"count":7,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/18038\/revisions"}],"predecessor-version":[{"id":20812,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/18038\/revisions\/20812"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/11497"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=18038"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=18038"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=18038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}