Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.12.3 available

The official documentation can be found on https://wiki.ocsinventory-ng.org. Read it before asking your question.

Install Agent on Rocky 9

Hello Folks,

I want to install the OCS Agent on Rocky9.
I wasn't able to build it myself, but the install through the sources work. I just don't get how I can run it as a daemon and deploy it to our servers in a good and central way.

Did anyone encouter the same problem and what was your solution?
in OCS Inventory NG agent for Unix by (160 points)

1 Answer

0 votes
perhaps this helps, if you want to install the agent via rpm packages. Afterwards you have to schedule the agent via cronjob

What exactly do you mean with "run it as a daemon"?

I think it is enough if it is installed and scheduled

try this full automated script on client to install .just edit the line IN the script where you must define your server name

#here the script starts
#!/bin/bash

# Check if the ocs-inventory agent package is installed
if rpm -q ocsinventory-agent &> /dev/null; then
  echo "ocs-inventory package is installed."
  exit 0
else
  echo "ocs-inventory package is not installed."
fi

# Rest of the script
echo "Continuing with the rest of the script..."

server_name="your.ocsserver.name/ocsinventory"

cd /tmp
 dnf -y install wget

 dnf -y install epel-release

 dnf -y install yum-utils

 yum-config-manager -y --enable crb
 dnf -y install ocsinventory-agent
#autoedit your existing config file
config_file="/etc/ocsinventory/ocsinventory-agent.cfg"

# check if config file changed allready changed
if ! grep -q "server = $server_name" "$config_file"; then
    # line with "local = /var/lib/ocsinventory-agent" comment out existing line
    sed -i 's/^local = \/var\/lib\/ocsinventory-agent/#&/' "$config_file"

# insert new line under "# server = your.ocsserver.name"
    sed -i '/^# server = your\.ocsserver\.name/a server = '"$server_name"'' "$config_file"

echo "changes done."
else
    echo "$server_name no changes made"
fi

# exeute client onetime
ocsinventory-agent
by (24.4k points)
edited by
 
Powered by Question2Answer
...