{"id":4092,"date":"2019-03-30T21:58:34","date_gmt":"2019-03-30T18:58:34","guid":{"rendered":"https:\/\/kifarunix.com\/?p=4092"},"modified":"2024-03-11T22:24:57","modified_gmt":"2024-03-11T19:24:57","slug":"install-ocs-inventory-agent-on-debian","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-ocs-inventory-agent-on-debian\/","title":{"rendered":"Install OCS Inventory Agent on Debian 12|11|10"},"content":{"rendered":"\n<p>How can I install OCS Inventory Agent on Debian 12\/Debian 11\/Debian 10. This is a step by step guide to take you through this process.<\/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-agent-on-debian-12-11-10\">Installing OCS Inventory Agent on Debian 12|11|10<\/a><ul><li><a href=\"#run-system-update\">Run system update<\/a><\/li><li><a href=\"#install-ocs-inventory-agent\">Install OCS Inventory Agent<\/a><ul><li><a href=\"#install-ocs-inventory-agent-from-ocs-apt-repos\">Install OCS Inventory Agent from OCS APT Repos<\/a><ul><li><a href=\"#install-ocs-inventory-agent-debian-apt-repos\">Install OCS Inventory Agent Debian APT Repos<\/a><\/li><li><a href=\"#installing-ocs-inventory-agent-from-ocs-apt-repos\">Installing OCS Inventory Agent from OCS APT Repos<\/a><\/li><\/ul><\/li><li><a href=\"#compiling-and-installing-ocs-inventory-agent-on-debian\">Compiling and Installing OCS Inventory Agent on Debian<\/a><ul><li><a href=\"#install-required-libraries\">Install Required Libraries<\/a><\/li><li><a href=\"#installing-ocs-inventory-agent-from-source\">Installing OCS Inventory Agent from Source<\/a><\/li><\/ul><\/li><li><a href=\"#ocs-inventory-agent-server-communication\">OCS Inventory Agent-Server Communication<\/a><\/li><\/ul><\/li><li><a href=\"#verify-assets-details-on-ocs-inventory-servery\">Verify Assets Details on OCS Inventory Servery<\/a><\/li><li><a href=\"#reference\">Reference;<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-ocs-inventory-agent-on-debian-12-11-10\">Installing OCS Inventory Agent on Debian 12|11|10<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"run-system-update\">Run system update<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">apt update<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"install-ocs-inventory-agent\">Install OCS Inventory Agent<\/h3>\n\n\n\n<p>There are two ways in which you can install OCS inventory agent.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Installing OCS Inventory Agent from OCS APT Repos<\/li>\n\n\n\n<li>Compiling and Installing OCS Inventory Agent<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"install-ocs-inventory-agent-from-ocs-apt-repos\">Install OCS Inventory Agent from OCS APT Repos<\/h4>\n\n\n\n<p>This is the easiest of installing OCS inventory agent<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"install-ocs-inventory-agent-debian-apt-repos\">Install OCS Inventory Agent Debian APT Repos<\/h5>\n\n\n\n<p>Currently there is no available repos for Debian 12.<\/p>\n\n\n\n<p>Thus, on Debian 12\/Debian 11<\/p>\n\n\n\n<p>To use this method, install the OCS APT repository;<\/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<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<p>On Debian 10;<\/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<pre class=\"wp-block-code\"><code>echo \"deb http:\/\/deb.ocsinventory-ng.org\/debian\/ buster main\" | \\\ntee \/etc\/apt\/sources.list.d\/ocsinventory.list<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"installing-ocs-inventory-agent-from-ocs-apt-repos\">Installing OCS Inventory Agent from OCS APT Repos<\/h5>\n\n\n\n<p>Once you have the repositories in place, then proceed to 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>Check the available version of OCS inventory agent package;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-cache policy ocsinventory-agent<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nocsinventory-agent:\n  Installed: (none)\n  Candidate: 2:2.10.0\n  Version table:\n     2:2.10.0 500\n        500 http:\/\/deb.ocsinventory-ng.org\/debian bullseye\/main amd64 Packages\n     2:2.8-1 500\n        500 http:\/\/deb.debian.org\/debian bullseye\/main amd64 Packages\n\n<\/code><\/pre>\n\n\n\n<p>The current version of OCS inventory agent is v2.10.0 as <a href=\"https:\/\/github.com\/OCSInventory-NG\/UnixAgent\/releases\" target=\"_blank\" rel=\"noreferrer noopener\">releases page<\/a>.<\/p>\n\n\n\n<p>Thus, run the command below to install it;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install ocsinventory-agent<\/code><\/pre>\n\n\n\n<p>During the installation, you will be prompted to setup OCS agent.<\/p>\n\n\n\n<p>Go through each prompt and provide your appropriate answer;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\nDo you want to configure the agent\nPlease enter 'y' or 'n'?> [y] y\nWhere do you want to write the configuration file?\n 0 -> \/etc\/ocsinventory\n 1 -> \/usr\/local\/etc\/ocsinventory\n 2 -> \/etc\/ocsinventory-agent\n?>  2\nDo you want to create the directory \/etc\/ocsinventory-agent?\nPlease enter 'y' or 'n'?> [y] y\nShould the old unix_agent settings be imported ?\nPlease enter 'y' or 'n'?> [y] n\n[info] The config file will be written in \/etc\/ocsinventory-agent\/ocsinventory-agent.cfg,\nWhat is the address of your ocs server?>  asset-mgr.kifarunix-demo.com\nDo you need credential for the server? (You probably don't)\nPlease enter 'y' or 'n'?> [n] n\nDo you want to apply an administrative tag on this machine\nPlease enter 'y' or 'n'?> [y] y\ntag?>  debian12\nDo yo want to install the cron task in \/etc\/cron.d\nPlease enter 'y' or 'n'?> [y] y\nWhere do you want the agent to store its files? (You probably don't need to change it)?> [\/var\/lib\/ocsinventory-agent] \nDo you want to create the \/var\/lib\/ocsinventory-agent directory?\n\nPlease enter 'y' or 'n'?> [y] y\nShould I remove the old unix_agent\nPlease enter 'y' or 'n'?> [n] y\nDo you want to activate debug configuration option ?\nPlease enter 'y' or 'n'?> [y] n\nDo you want to use OCS Inventory NG UNix Unified agent log file ?\nPlease enter 'y' or 'n'?> [y] y\nSpecify log file path you want to use?>  \/var\/log\/ocs-agent.log\nDo you want disable SSL CA verification configuration option (not recommended) ?\nPlease enter 'y' or 'n'?> [n] y\nDo you want to set CA certificates file path ?\nPlease enter 'y' or 'n'?> [y] n\nDo you want to use OCS-Inventory software deployment feature?\nPlease enter 'y' or 'n'?> [y] n\nDo you want to use OCS-Inventory SNMP scans feature?\nPlease enter 'y' or 'n'?> [y] y\nDo you want to send an inventory of this machine?\nPlease enter 'y' or 'n'?> [y] y\nSetting OCS Inventory NG server address...\n<\/code><\/pre>\n\n\n\n<p>And that is it.<\/p>\n\n\n\n<p>The package will also install a cronjob that iventories your system on daily basis;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/etc\/cron.d\/ocsinventory-agent<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>PATH=\/usr\/sbin:\/usr\/bin:\/sbin:\/bin\n15 9 * * * root \/usr\/bin\/ocsinventory-agent --lazy &gt; \/dev\/null 2&gt;&amp;1<\/strong><\/code><\/pre>\n\n\n\n<p>It will also create configs under <strong><code>\/etc\/ocsinventory-agent\/ocsinventory-agent.cfg<\/code><\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/etc\/ocsinventory-agent\/ocsinventory-agent.cfg<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nbasevardir=\/var\/lib\/ocsinventory-agent\nlogfile=\/var\/log\/ocs-agent.log\nssl=0\nserver=http:\/\/asset-mgr.kifarunix-demo.com\/ocsinventory\ndebug=\ntag=debian12\n<\/code><\/pre>\n\n\n\n<p>You can also run system inventory manually;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ocsinventory-agent<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"compiling-and-installing-ocs-inventory-agent-on-debian\">Compiling and Installing OCS Inventory Agent on Debian<\/h4>\n\n\n\n<p>This method guarantees the installation of a specific version, including new release versions.<\/p>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"install-required-libraries\">Install Required Libraries<\/h5>\n\n\n\n<p>To install OCS Inventory agent will all the required packages, run the command below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt install make gcc libmodule-install-<strong>perl<\/strong> dmidecode libxml-simple-<strong>perl<\/strong> \\\nlibcompress-zlib-<strong>perl<\/strong> openssl libnet-ip-<strong>perl<\/strong> libwww-<strong>perl<\/strong> libdigest-md5-<strong>perl<\/strong> \\\nlibdata-uuid-<strong>perl<\/strong> libcrypt-ssleay-<strong>perl<\/strong> libnet-snmp-<strong>perl<\/strong> libproc-pid-<strong>file<\/strong>-<strong>perl<\/strong> \\\nlibproc-daemon-<strong>perl<\/strong> net-tools libsys-syslog-<strong>perl<\/strong> pciutils smartmontools <strong>read<\/strong>-edid \\\n<strong>nmap<\/strong> libnet-netmask-<strong>perl<\/strong> sudo<\/pre>\n\n\n\n<p>To install a newer version of OCS Agent, navigate to the <a aria-label=\"OCS Inventory downloads (opens in a new tab)\" href=\"https:\/\/ocsinventory-ng.org\/?page_id=1548&amp;lang=en\" target=\"_blank\" rel=\"noreferrer noopener\">OCS Inventory downloads<\/a> page and grab the source file for the new version.<\/p>\n\n\n\n<p>For example, this guide uses OCS Agent v2.10.0 and can be downloaded as follows;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">wget https:\/\/github.com\/OCSInventory-NG\/UnixAgent\/releases\/download\/v2.10.0\/Ocsinventory-Unix-Agent-2.10.0.tar.gz<\/pre>\n\n\n\n<p>Once the download is done, extract the source code.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tar xzf Ocsinventory-Unix-Agent-2.10.0.tar.gz<\/pre>\n\n\n\n<h5 class=\"wp-block-heading\" id=\"installing-ocs-inventory-agent-from-source\">Installing OCS Inventory Agent from Source<\/h5>\n\n\n\n<p>Navigate to OCS Inventory agent source directory<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd Ocsinventory-Unix-Agent-2.10.0<\/pre>\n\n\n\n<p>OCS Agent can be installed interactively or non-interactively.<\/p>\n\n\n\n<p>To install OCS agent non-interactively, simply run the commands below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo env PERL_AUTOINSTALL=1 perl Makefile.PL<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo make<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo make install<\/pre>\n\n\n\n<p>Then you can configure it;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>perl postinst.pl --nowizard --server=https:\/\/asset-mgr.kifarunix-demo.com\/ocsinventory --crontab --nossl --verbose --now<\/code><\/pre>\n\n\n\n<p>To install OCS agent interactively, simply run the commands below;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo perl Makefile.PL<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo make<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">sudo make install<\/pre>\n\n\n\n<p>While setting up the address of your ocs server, if you are using hostname, ensure that it is resolvable.<\/p>\n\n\n\n<pre class=\"scroll-box\"><code>\n...\nDo you want to configure the agent\nPlease enter 'y' or 'n'?&gt; [y] y\nWhere do you want to write the configuration file?\n 0 -&gt; \/etc\/ocsinventory\n 1 -&gt; \/usr\/local\/etc\/ocsinventory\n 2 -&gt; \/etc\/ocsinventory-agent\n?&gt;  2\nDo you want to create the directory \/etc\/ocsinventory-agent?\nPlease enter 'y' or 'n'?&gt; [y] y\nShould the old unix_agent settings be imported ?\nPlease enter 'y' or 'n'?&gt; [y] y\n[info] The config file will be written in \/etc\/ocsinventory-agent\/ocsinventory-agent.cfg,\nWhat is the address of your ocs server?&gt;  https:\/\/asset-mgr.kifarunix-demo\/ocsinventory        \nDo you need credential for the server? (You probably don't)\nPlease enter 'y' or 'n'?&gt; [n] n\nDo you want to apply an administrative tag on this machine\nPlease enter 'y' or 'n'?&gt; [y] y\ntag?&gt;  test-deb10  \nDo yo want to install the cron task in \/etc\/cron.d\nPlease enter 'y' or 'n'?&gt; [y] y\nWhere do you want the agent to store its files? (You probably don't need to change it)?&gt; [\/var\/lib\/ocsinventory-agent] \nDo you want to create the \/var\/lib\/ocsinventory-agent directory?\n\nPlease enter 'y' or 'n'?&gt; [y] y\nShould I remove the old unix_agent\nPlease enter 'y' or 'n'?&gt; [n] y\nDo you want to activate debug configuration option ?\nPlease enter 'y' or 'n'?&gt; [y] n\nDo you want to use OCS Inventory NG UNix Unified agent log file ?\nPlease enter 'y' or 'n'?&gt; [y] y\nSpecify log file path you want to use?&gt;  \/var\/log\/ocs-agent.log\nDo you want disable SSL CA verification configuration option (not recommended) ?\nPlease enter 'y' or 'n'?&gt; [n] \nDo you want to set CA certificate chain file path ?\nPlease enter 'y' or 'n'?&gt; [y] \nSpecify CA certificate chain file path?&gt;  \/etc\/ocsinventory-agent\/cacert.pem              \nDo you want to use OCS-Inventory software deployment feature?\nPlease enter 'y' or 'n'?&gt; [y]  \nDo you want to use OCS-Inventory SNMP scans feature?\nPlease enter 'y' or 'n'?&gt; [y] \nDo you want to send an inventory of this machine?\nPlease enter 'y' or 'n'?&gt; [y]\n...\n<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"ocs-inventory-agent-server-communication\">OCS Inventory Agent-Server Communication<\/h4>\n\n\n\n<p>By default, OCS inventory agent is set to communicate with the server once a day via the daily cron job, <strong>\/etc\/cron.d\/ocsinventory-agent<\/strong>.<\/p>\n\n\n\n<p>To force the agent to communicate to the server immediately, you can run;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ocsinventory-agent<\/pre>\n\n\n\n<p>Or specify address of the server;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ocsinventory-agent --server http:\/\/ocsinv.example.com\/ocsinventory<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"verify-assets-details-on-ocs-inventory-servery\">Verify Assets Details on OCS Inventory Servery<\/h3>\n\n\n\n<p>You can now login to your OCS Inventory server and verify that the assets have been inventoried.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-dashboard-assets.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1463\" height=\"784\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-dashboard-assets.png\" alt=\"Install OCS Inventory Agent on Debian\" class=\"wp-image-18049\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-dashboard-assets.png?v=1689979120 1463w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/ocs-inventory-dashboard-assets-768x412.png?v=1689979120 768w\" sizes=\"(max-width: 1463px) 100vw, 1463px\" \/><\/a><\/figure>\n\n\n\n<p>Click on <strong>All Computers<\/strong> tab to see a list your assets.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/inventories-assets.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1471\" height=\"568\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/inventories-assets.png\" alt=\"\" class=\"wp-image-18050\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/inventories-assets.png?v=1689979126 1471w, https:\/\/kifarunix.com\/wp-content\/uploads\/2023\/07\/inventories-assets-768x297.png?v=1689979126 768w\" sizes=\"(max-width: 1471px) 100vw, 1471px\" \/><\/a><\/figure>\n\n\n\n<p>You can also configure OCS Agent to inventory the system hourly via the cron job.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mv \/etc\/cron.daily\/ocsinventory-agent \/etc\/cron.hourly<\/pre>\n\n\n\n<p>Well, that is just it on how to install OCS Agent on Debian 12\/Debian 11\/Debian 10. Feel free to explore this tool further.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"reference\">Reference;<\/h3>\n\n\n\n<p><a aria-label=\"OCS Inventory NG Agent (opens in a new tab)\" href=\"https:\/\/wiki.ocsinventory-ng.org\/03.Basic-documentation\/Setting-up-the-UNIX-agent-on-client-computers\/\" target=\"_blank\" rel=\"noreferrer noopener\">OCS Inventory NG Agent<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>How can I install OCS Inventory Agent on Debian 12\/Debian 11\/Debian 10. This is a step by step guide to take you through this process.<\/p>\n","protected":false},"author":1,"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":[1039,7096,1098,1096,7097],"class_list":["post-4092","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","category-asset-management","category-ocs-inventory","tag-debian-10-buster","tag-install-ocs-inventory-agent-on-debian","tag-ocs-agent","tag-ocs-inventory","tag-ocs-inventory-agent-apt","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\/4092"}],"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\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=4092"}],"version-history":[{"count":10,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4092\/revisions"}],"predecessor-version":[{"id":21117,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/4092\/revisions\/21117"}],"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=4092"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=4092"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=4092"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}