Install OCS Inventory Agent on Debian 10/Ubuntu 18.04

0
255

Once you have setup your OCS Inventory server, you can now add agents for managing. In this guide, we are going to learn how to Install OCS-NG Inventory Agent on Debian 10/Ubuntu 18.04.

Learn how to setup OCS Inventory server on Fedora 30/Fedora 29 by following the link below;

Install OCS Inventory on Fedora 30/Fedora 29

Install OCS Inventory Agent on Debian 10/Ubuntu 18.04

Run system update

apt update
apt upgrade

Install Required Libraries

To install OCS Inventory agent will all the required packages, run the command below;

apt install libmodule-install-perl dmidecode libxml-simple-perl libcompress-zlib-perl libnet-ip-perl libwww-perl libdigest-md5-perl libdata-uuid-perl

Install OCS Inventory Agent from APT

Run the command below to install OCS agent.

apt install ocsinventory-agent

During the installation, you are prompted to choose how the OCS agent will communicate with OCS server. Since we already setup the OCS server, select the http method and proceed.

OCS agent method

Next, set the OCS server URL. The syntax is http[s]://ocsinventory-ng-server[:port]/ocsinventory usually for http(s) methods.

OCS Inventory agent Server URL

This will be written to /etc/ocsinventory/ocsinventory-agent.cfg configuration file.

Install OCS Agent from Source

Note that OCS agent installed from default system packages might be older. Also, installing OCS agent from source requires that some build tools and dependencies be installed first.

apt install make gcc libmodule-install-perl dmidecode libxml-simple-perl libcompress-zlib-perl openssl libnet-ip-perl libwww-perl libdigest-md5-perl libdata-uuid-perl libcrypt-ssleay-perl libnet-snmp-perl libproc-pid-file-perl libproc-daemon-perl net-tools libsys-syslog-perl pciutils smartmontools read-edid nmap libnet-netmask-perl

To install a newer version of OCS Agent, navigate to the OCS Inventory downloads page and grab the source file for the new version. For example, this guide uses OCS Agent v2.4.2 and can be downloaded as follows;

wget https://github.com/OCSInventory-NG/UnixAgent/releases/download/v2.4.2/Ocsinventory-Unix-Agent-2.4.2.tar.gz

Once the download is done, extract the source code.

tar xzf Ocsinventory-Unix-Agent-2.4.2.tar.gz

Navigate to OCS Inventory agent source directory

cd Ocsinventory-Unix-Agent-2.4.2

OCS Agent can be installed interactively or non-interactively.

To install OCS agent non-interactively, simply run the commands below;

sudo env PERL_AUTOINSTALL=1 perl Makefile.PL
sudo make
sudo make install

To install OCS agent interactively, simply run the commands below;

sudo perl Makefile.PL
sudo make
sudo make install

While setting up the address of your ocs server, if you are using hostname, ensure that it is resolvable.

...
Do you want to configure the agent
Please enter 'y' or 'n'?> [y] y
Where do you want to write the configuration file?
 0 -> /etc/ocsinventory
 1 -> /usr/local/etc/ocsinventory
 2 -> /etc/ocsinventory-agent
?>  2
Do you want to create the directory /etc/ocsinventory-agent?
Please enter 'y' or 'n'?> [y] y
Should the old unix_agent settings be imported ?
Please enter 'y' or 'n'?> [y] y
[info] The config file will be written in /etc/ocsinventory-agent/ocsinventory-agent.cfg,
What is the address of your ocs server?>  https://ocs.kifarunix-demo/ocsinventory        
Do you need credential for the server? (You probably don't)
Please enter 'y' or 'n'?> [n] n
Do you want to apply an administrative tag on this machine
Please enter 'y' or 'n'?> [y] y
tag?>  test-deb10  
Do yo want to install the cron task in /etc/cron.d
Please enter 'y' or 'n'?> [y] y
Where do you want the agent to store its files? (You probably don't need to change it)?> [/var/lib/ocsinventory-agent] 
Do you want to create the /var/lib/ocsinventory-agent directory?

Please enter 'y' or 'n'?> [y] y
Should I remove the old unix_agent
Please enter 'y' or 'n'?> [n] y
Do you want to activate debug configuration option ?
Please enter 'y' or 'n'?> [y] n
Do you want to use OCS Inventory NG UNix Unified agent log file ?
Please enter 'y' or 'n'?> [y] y
Specify log file path you want to use?>  /var/log/ocs-agent.log
Do you want disable SSL CA verification configuration option (not recommended) ?
Please enter 'y' or 'n'?> [n] 
Do you want to set CA certificate chain file path ?
Please enter 'y' or 'n'?> [y] 
Specify CA certificate chain file path?>  /etc/ocsinventory-agent/cacert.pem              
Do you want to use OCS-Inventory software deployment feature?
Please enter 'y' or 'n'?> [y]  
Do you want to use OCS-Inventory SNMP scans feature?
Please enter 'y' or 'n'?> [y] 
Do you want to send an inventory of this machine?
Please enter 'y' or 'n'?> [y]
...

OCS Agent-Server Communication

By default, OCS agent is set to communicate with the server once a day via the daily cron job, /etc/cron.daily/ocsinventory-agent.

To force the agent to communicate to the server immediately, you can run;

ocsinventory-agent --server http://OCS-ADDRESS[:port]/ocsinventory

For example in my case;

ocsinventory-agent --server http://ocsinv.example.com/ocsinventory

You can now login to your OCS Inventory server and verify that the assets have been inventoried.

Install OCS Inventory Agent on Debian 10/Ubuntu 18.04

Click on All Computers tab to see a list your assets.

OCS Inventory Agent

You can also configure OCS Agent to inventory the system hourly via the cron job.

mv /etc/cron.daily/ocsinventory-agent /etc/cron.hourly

Well, that is just it on how to install OCS Agent on Debian 10/Ubuntu 18.04. Feel free to explore this tool further.

Reference;

OCS Inventory NG Agent

Related Tutorials

Install Snipe-IT on Debian 10/Ubuntu 18.04

Install Automad CMS on Debian 10/Ubuntu 18.04

Install GoAccess on Ubuntu 18.04/Debian 10 Buster

Install and Setup Chrome Remote Desktop on Ubuntu 18.04

LEAVE A REPLY

Please enter your comment!
Please enter your name here