### Run setup script Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Updating-the-server Execute the setup script to begin the installation process. ```bash sh setup.sh ``` -------------------------------- ### Administration Server Setup Prompts Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Interactive prompts displayed during the installation process to configure the Administration Server and file paths. ```text Do you wish to setup Administration Server (Web Administration Console) on this computer ([y]/n)? ``` ```text Where to copy Administration Server static files for PHP Web Console [/usr/share/ocsinventory-reports] ? ``` ```text Where to create writable/cache directories for deployment packages, administration console logs, IPDiscover and SNMP [/var/lib/ocsinventory-reports] ? ``` -------------------------------- ### Interactive agent configuration Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers Example of the interactive prompts provided during the agent setup process. ```text 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/ocsinventory Do you need credential for the server? (You probably don't) Please enter 'y' or 'n'?> [n] Do you want to apply an administrative tag on this machine Please enter 'y' or 'n'?> [y] tag?> Server Do yo want to install the cron task in /etc/cron.d Please enter 'y' or 'n'?> [y] Where do you want the agent to store its files? (You probably don't need to change it)?> [/var/lib/ocsinventory-agent] Should I remove the old unix_agent Please enter 'y' or 'n'?> [n] 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] 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] 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] ``` -------------------------------- ### Install Web Server and Database Client Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Install Apache and MariaDB client on supported Linux distributions. ```bash yum install httpd yum install mariadb-client ``` ```bash apt install apache2 apt install mariadb-client ``` -------------------------------- ### Compile and install the agent Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers Execute the make commands to compile the source code and install the agent on the system. ```bash $ sudo make $ sudo make install ``` -------------------------------- ### Configure and Run OCS Inventory Setup Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Create a configuration answers file and execute the setup script. ```bash echo 'OCS_DB_HOST=localhost' > setup.answers ``` ```bash sh setup.sh ``` -------------------------------- ### Install GreenIT Service via CLI Source: https://wiki.ocsinventory-ng.org/15.GreenIT/02.Agent/Agent-installation-and-configuration Commands to execute the GreenIT service installer from the terminal. ```bash GreenITService_Installer.exe ``` ```bash GreenITService_Installer.exe /silent /collectPeriod=1 /uploadPeriod=0 /savesPeriod=1 ``` -------------------------------- ### Enable and Start PHP-FPM Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server-with-rpm Commands to enable and start the PHP-FPM service on supported distributions. ```bash systemctl enable php-fpm systemctl start php-fpm ``` -------------------------------- ### Run OCS Inventory Windows Agent installer Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-Windows-Agent-2.x-on-client-computers Example command to perform a silent installation while specifying the OCS server address. ```bash OCS-NG-Windows-Agent-Setup.exe /S /SERVER=ocs_server_address ``` -------------------------------- ### Install Apache and MariaDB on Debian 9 Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Use apt to install the web server and database client packages. ```bash apt install apache2 apt install mariadb-client ``` -------------------------------- ### Start Container via setup.sh Source: https://wiki.ocsinventory-ng.org/14.Archive/OLD-Docker-documentation Automated startup script for the OCSInventory container. ```bash cd OCSInventory-Docker-Image sudo bash setup.sh ``` -------------------------------- ### Install Apache and MariaDB on Fedora/RHEL/CentOS 7 Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Use yum to install the web server and database client packages. ```bash yum install httpd yum install mariadb ``` -------------------------------- ### Install required packages Source: https://wiki.ocsinventory-ng.org/06.Network-Discovery-with-OCS-Inventory-NG/Using-IPDiscover-scanner Install the necessary dependencies for the scanner on Debian-based systems. ```bash apt install fping nmap ``` -------------------------------- ### Install MariaDB Server Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Deploying-database-server Commands to install the MariaDB server package on different Linux distributions. ```bash yum install mariadb-server ``` ```bash apt install mariadb-server mariadb-common mariadb-client ``` -------------------------------- ### Install Perl modules on Gentoo Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Install Perl dependencies using emerge and g-cpan. ```bash emerge dev-perl/XML-Simple perl-core/IO-Compress dev-perl/Apache-DBI dev-perl/Net-IP dev-perl/SOAP-Lite app-portage/g-cpan g-cpan -i XML::Entities ``` -------------------------------- ### Install OCS Inventory agent on Fedora Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-using-repository-on-client-computers Commands to detect Fedora version, install the repository, and install the agent. ```bash $ export FEDORA_VERSION=$(awk '{print $3}' /etc/fedora-release) $ sudo wget https://rpm.ocsinventory-ng.org/ocsinventory-release-latest.fc$FEDORA_VERSION.ocs.noarch.rpm ``` ```bash $ sudo dnf install ocsinventory-release-latest.fc$FEDORA_VERSION.ocs.noarch.rpm ``` ```bash $ sudo dnf install ocsinventory-agent ``` -------------------------------- ### Install PHP GD Support Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Install the GD graphics library support for PHP. ```bash yum install php-gd ``` ```bash apt install php-gd ``` -------------------------------- ### Install OCS Inventory Components via APT Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server-with-rpm Commands to install the full server, web console, or communication server packages. ```bash $ sudo apt install ocsinventory ``` ```bash $ sudo apt install ocsinventory-ocsreports ``` ```bash $ sudo apt install ocsinventory-server ``` -------------------------------- ### REST API Setup Prompt Source: https://wiki.ocsinventory-ng.org/11.Rest-API/Configuration The initial prompt during OCS Inventory setup to enable the REST API server. ```text Do you wish to setup Rest API server on this computer ([y]/n)? ``` -------------------------------- ### Install optional Perl modules on Fedora/Redhat/CentOS Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers Install additional recommended modules from the EPEL repository. ```bash $ sudo yum install perl-Crypt-SSLeay perl-Net-SNMP perl-Proc-Daemon perl-Proc-PID-File perl-Sys-Syslog pciutils smartmontools monitor-edid ``` -------------------------------- ### Enable and Start Apache Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server-with-rpm Commands to ensure the Apache HTTP server is enabled and running. ```bash systemctl enable httpd systemctl start httpd ``` -------------------------------- ### Install scp on RedHat-based systems Source: https://wiki.ocsinventory-ng.org/10.Plugin-engine/Using-plugins-installer Install the EPEL repository, Python 3, and the scp package using yum and pip. ```bash yum install epel-release yum update yum install python34 python34-pip sudo pip3 install scp ``` -------------------------------- ### Launch and Configure MariaDB Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Deploying-database-server Commands to enable, start, and secure the MariaDB service. ```bash systemctl enable mariadb systemctl start mariadb ``` ```bash mysql -u root ``` ```sql SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword'); ``` -------------------------------- ### Deploying the custom installer via command line Source: https://wiki.ocsinventory-ng.org/07.OCS-Tools/OCS-Packager-for-MacOSX Use the macOS installer command to deploy the generated package. Requires root privileges or sudo. ```bash installer -pkg ocspackage.pkg -target / ``` -------------------------------- ### Homebrew Installation Command Source: https://wiki.ocsinventory-ng.org/05.Deployment/Mac/Summary Default command used for installing applications via Homebrew on MacOS. ```bash username=$(last -1 | awk '{print $1}');su - $username -c 'brew install {custom application name} ``` -------------------------------- ### Enable and Start MariaDB Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server-with-rpm Commands to ensure the MariaDB service is enabled and running. ```bash systemctl enable mariadb systemctl start mariadb ``` -------------------------------- ### Sample agent configuration file Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers Example content for the ocsinventory-agent.cfg file. ```xml computer.domain.tld-2006-02-27-13-59-47 2.2 3 my_ocs_com_server.domain.tld:80 ``` -------------------------------- ### Install OCS Inventory agent via APT Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-using-repository-on-client-computers Command to install the agent package after repository configuration. ```bash $ sudo apt install ocsinventory-agent ``` -------------------------------- ### Install PHP Zip and Perl Dependencies Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Install necessary PHP extensions and Perl modules for OCS Inventory functionality. ```bash yum install php-pecl-zip yum install perl-XML-Simple perl-DBI perl-DBD-MySQL perl-Net-IP php-mbstring ``` ```bash yum install php-common ``` ```bash apt install php-pclzip make build-essential libdbd-mysql-perl libnet-ip-perl libxml-simple-perl php php-mbstring php-soap php-mysql php-curl php-xml php-zip ``` -------------------------------- ### Start Apache web server Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Updating-the-server Restart the Apache service after the update. ```bash service apache2 start ``` -------------------------------- ### Run OCSInventory Container Source: https://wiki.ocsinventory-ng.org/14.Archive/OLD-Docker-documentation Starts the container using default configuration values. ```bash sudo docker run \ -p 80:80 \ --name myocsinventory \ -e OCS_DBNAME=ocsweb \ -e OCS_DBSERVER_READ=localhost \ -e OCS_DBSERVER_WRITE=localhost \ -e OCS_DBUSER=ocs \ -e OCS_DBPASS=ocs \ -itd \ ocsinventory/ocsinventory-docker-image:latest \ bash ``` -------------------------------- ### Install OCS Inventory on Enterprise Linux 8 Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server-with-rpm Commands to configure repositories, set the PHP version, and install OCS Inventory on EL8. ```bash dnf install yum-utils yum-config-manager --enable remi dnf module reset php dnf module install php:remi-7.3 dnf install --enablerepo=powertools ocsinventory ``` -------------------------------- ### List Computers ID Source: https://wiki.ocsinventory-ng.org/11.Rest-API/GET-Routes Example response for retrieving a list of all computer IDs. ```json [ { "ID":1942 }, { "ID":1974 }, ... ] ``` -------------------------------- ### Restart Apache Service Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Command to apply configuration changes after the installation process is complete. ```bash systemctl restart apache2 ``` -------------------------------- ### Configure Persistent Volumes Source: https://wiki.ocsinventory-ng.org/15.Kubernetes/Helm-charts Example persistence configuration for OVH Cloud storage. ```yaml persistence: enabled: true size: 10Gi accessMode: ReadWriteOnce storageClass: "csi-cinder-classic" ``` -------------------------------- ### Install OCS Unix Unified agent in non-interactive mode Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers Example command to perform a non-interactive installation with specific configuration flags. ```bash $ sudo env PERL_AUTOINSTALL=1 perl Makefile.PL && make && make install && perl postinstl.pl --nowizard --server=`http://yourserver/ocsinventory` --crontab ``` -------------------------------- ### Prepare the build environment Source: https://wiki.ocsinventory-ng.org/12.Developers/HOWTO-package-OCS-Unix-agent-releases Clean existing manifests and initialize the Makefile. ```bash $ rm MANIFEST $ perl Makefile.PL ``` -------------------------------- ### Configure Database Backends Source: https://wiki.ocsinventory-ng.org/15.Kubernetes/Helm-charts Configuration examples for connecting to an existing database, creating a database on an existing server, or deploying a new MariaDB instance. ```yaml externalDatabase: enabled: true hostname: "mariadb-svc.namespace.svc.cluster.local" username: "ocsuser" password: "ocspassword" database: "ocsdb" ``` ```yaml database: create: true jobName: "createdb" hostname: "mariadb-svc.namespace.svc.cluster.local" username: "ocsuser" password: "ocspassword" database: "ocsdb" root_password: "RootDbPassword" ``` ```yaml mariadb: enabled: true jobName: "createmariadbserver" auth: rootPassword: "RootDbPassword" database: "ocsdb" username: "ocsuser" password: "ocspassword" ``` -------------------------------- ### Get CVE History JSON Response Source: https://wiki.ocsinventory-ng.org/11.Rest-API/GET-Routes Example JSON response for the /ocsapi/v1/cve/history endpoint. ```json [ { "CVE_NB": 0, "FLAG_DATE": "2023-06-01 14:37:59", "ID": 1, "PUBLISHER": "http://code.woong.org/wcwidth.js", "PUBLISHER_ID": 694 }, { "CVE_NB": 0, "FLAG_DATE": "2023-06-01 14:38:16", "ID": 2, "PUBLISHER": "http://dev.mysql.com/", "PUBLISHER_ID": 187 }, ... ] ``` -------------------------------- ### Deploy OCS Inventory NG Agent via PSEXEC Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-Windows-Agent-2.x-on-client-computers Various command-line configurations for silent agent installation using PSEXEC, assuming the setup file is located on a network share. ```bash psexec \\* -s \\Server\NetLogon\OCS-NG-Windows-Agent-Setup.exe /S /NOSPLASH /SERVER=http://my_ocs_server/ocsinventory ``` ```bash psexec \\COMPUTER_NAME -s \\Server\NetLogon\OCS-NG-Windows-Agent-Setup.exe /S /NOSPLASH /SERVER=http://my_ocs_server/ocsinventory ``` ```bash psexec \\* -s -u Domain\Administrator -p Password \\Server\NetLogon\OCS-NG-Windows-Agent-Setup.exe /S /NOSPLASH /SERVER=http://my_ocs_server/ocsinventory ``` ```bash psexec @ALL.TXT -s -u Domain\Administrator -p Password \\Server\NetLogon\OCS-NG-Windows-Agent-Setup.exe /S /NOSPLASH /SERVER=http://my_ocs_server/ocsinventory ``` -------------------------------- ### Install Perl modules on Debian 9 Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Install Perl dependencies via apt and the CPAN module installer. ```bash apt install libxml-simple-perl libdbi-perl libdbd-mysql-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl libarchive-zip-perl make build-essential cpan install XML::Entities ``` -------------------------------- ### Initialize OCS Inventory database via command line Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Alternative method to install.php for importing the database schema using the MySQL client. ```bash mysql -f -hlocalhost -uroot -p DBNAME < ocsbase.sql >log.log ``` -------------------------------- ### Install SSL Certificate Files Source: https://wiki.ocsinventory-ng.org/05.Deployment/Deploying-packages-or-executing-commands-on-client-hosts Move generated certificate and key files to the appropriate system directories. ```bash cp server.crt /etc/ssl/certs/ cp server.key /etc/ssl/private/ ``` -------------------------------- ### Install OCS Inventory on Fedora Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server-with-rpm Command to install OCS Inventory on Fedora systems. ```bash dnf install ocsinventory ``` -------------------------------- ### Initialize Database for Single-Server Setup Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Deploying-database-server SQL commands to create the OCS database and user for a single-server deployment. ```sql CREATE DATABASE ocsweb; ``` ```sql CREATE USER 'ocs'@'localhost' IDENTIFIED BY 'ocs'; ``` ```sql GRANT ALL PRIVILEGES ON ocsweb.* TO 'ocs'@'localhost' WITH GRANT OPTION; ``` ```sql FLUSH PRIVILEGES; ``` -------------------------------- ### Create working directory Source: https://wiki.ocsinventory-ng.org/12.Developers/HOWTO-package-OCS-Unix-server-releases Initialize the directory structure for the release package. ```bash $mkdir OCSNG_UNIX_SERVER-XXX $cd OCSNG_UNIX_SERVER-XXX ``` -------------------------------- ### Install optional Perl modules on Debian Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers Install additional recommended modules for enhanced functionality. ```bash $ sudo apt install 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 ``` -------------------------------- ### Install scp on Debian-based systems Source: https://wiki.ocsinventory-ng.org/10.Plugin-engine/Using-plugins-installer Use the apt package manager to install the required python3-scp package. ```bash sudo apt install python3-scp ``` -------------------------------- ### Initialize Database for Multi-Server Setup Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Deploying-database-server SQL commands to create the OCS database and users for distributed server deployments. ```sql CREATE DATABASE ocsweb; ``` ```sql CREATE USER 'ocs'@'CommunicationServerIP' IDENTIFIED BY 'ocs'; CREATE USER 'ocs'@'AdministrationConsoleIP' IDENTIFIED BY 'ocs'; ``` ```sql GRANT ALL PRIVILEGES ON ocsweb.* TO 'ocs'@'CommunicationServerIP' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON ocsweb.* TO 'ocs'@'AdministrationConsoleIP' WITH GRANT OPTION; ``` ```sql FLUSH PRIVILEGES; ``` -------------------------------- ### List Computers Details Source: https://wiki.ocsinventory-ng.org/11.Rest-API/GET-Routes Example response for retrieving detailed computer information with pagination parameters. ```json { "16": { "accountinfo": [ { "HARDWARE_ID":16, "TAG":"DEV-MACHINE" } ], "batteries":[], "bios": [ { "ASSETTAG":"", "BDATE":"04\/16\/2021", "BMANUFACTURER":"Dell Inc.", "BVERSION":"2.5.1", "HARDWARE_ID":16, "MMANUFACTURER":"Dell Inc.", "MMODEL":"045M96", "MSN":"", "SMANUFACTURER":"", "SMODEL":"PowerEdge R340", "SSN":"", "TYPE":"Rack Mount Chassis" } ], ... } ``` -------------------------------- ### Create backup directory Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Updating-the-server Create a dedicated directory to store configuration backups. ```bash mkdir /home/backup_ocs ``` -------------------------------- ### Install Perl modules on Fedora/RHEL/CentOS 7 Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server Install the required Perl dependencies using the yum package manager. ```bash yum install perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL perl-Net-IP perl-SOAP-Lite perl-Archive-Zip perl-Mojolicious perl-Plack perl-XML-Entities perl-Switch ``` -------------------------------- ### Apache SSL Configuration Sample Source: https://wiki.ocsinventory-ng.org/05.Deployment/Deploying-packages-or-executing-commands-on-client-hosts Minimalist configuration snippet for enabling the SSL module in Apache. ```apache # # This is the Apache server configuration file providing SSL support. # It contains the configuration directives to instruct the server how to # serve pages over an https connection. For detailing information about these # directives see # # For the moment, see for this info. # The documents are still being prepared from material donated by the # modssl project. # # Do NOT simply read the instructions in here without understanding # what they do. They're here only as hints or reminders. If you are unsure # consult the online docs. You have been warned. # LoadModule ssl_module modules/mod_ssl.so # Until documentation is completed, please check http://www.modssl.org/ # for additional config examples and module docmentation. Directives # and features of mod_ssl are largely unchanged from the mod_ssl project # for Apache 1.3. ``` -------------------------------- ### Connect to MySQL Source: https://wiki.ocsinventory-ng.org/09.Extras/Secure-your-OCS-Inventory-NG-Server Command to access the MySQL server as root. ```bash mysql -u root -p ``` -------------------------------- ### Run RDP Discovery Source: https://wiki.ocsinventory-ng.org/07.OCS-Tools/OCS-Ansible-Role-for-Unix-Packager Execute the RDP discovery playbook to identify Windows servers listening on RDP ports. ```bash ansible-playbook nmap_rdpdiscovery.yml -i nmap.inventory ``` -------------------------------- ### Copy configuration files to backup Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Updating-the-server Copy Apache and OCS configuration files to the backup directory. ```bash cp /etc/apache2/conf-available/z-ocsinventory-server.conf /etc/apache2/conf-available/zz-ocsinventory-restapi.conf /etc/apache2/conf-available/ocsinventory-reports.conf /home/backup_ocs/ && cp /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php /home/backup_ocs/ ``` -------------------------------- ### Install OCS Inventory on Enterprise Linux 9 Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server-with-rpm Commands to enable required repositories and install OCS Inventory on EL9. ```bash dnf install yum-utils yum-config-manager --enable remi yum-config-manager --enable crb dnf install ocsinventory ``` -------------------------------- ### Install OCS Inventory agent on Rocky/Alma/RHEL 9 Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-using-repository-on-client-computers Commands to set up repositories and install the agent on RHEL 9 derivatives. ```bash $ sudo wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm $ sudo wget https://rpm.ocsinventory-ng.org/ocsinventory-release-latest.el9.ocs.noarch.rpm ``` ```bash $ sudo dnf install ocsinventory-release-latest.el9.ocs.noarch.rpm epel-release-latest-9.noarch.rpm ``` ```bash $ sudo dnf install yum-utils $ sudo yum-config-manager --enable crb $ sudo dnf install ocsinventory-agent ``` -------------------------------- ### Install OCS Inventory agent on RHEL/CentOS 7 Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-using-repository-on-client-computers Commands to download and install repository files and the agent on CentOS 7. ```bash $ sudo wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm $ sudo wget https://rpm.ocsinventory-ng.org/ocsinventory-release-latest.el7.ocs.noarch.rpm ``` ```bash $ sudo yum install ocsinventory-release-latest.el7.ocs.noarch.rpm epel-release-latest-7.noarch.rpm ``` ```bash $ sudo yum install ocsinventory-agent ``` -------------------------------- ### Basic LDAP Filter Example Source: https://wiki.ocsinventory-ng.org/04.Management-console-and-its-advanced-features/Synchronization-between-OCS-and-LDAP A standard filter example requiring membership in a specific group and a matching login attribute. ```text (&(memberOf=CN=MyGroup,CN=Users,DC=MyDomain,DC=dc)(sAMAccountName=user.login)) ``` -------------------------------- ### Build OCS Inventory image locally Source: https://wiki.ocsinventory-ng.org/13.Docker-documentation/Using-the-docker-image Steps to clone the repository and build the Docker image from source. ```bash git clone https://github.com/OCSInventory-NG/OCSInventory-Docker-Image ``` ```bash docker build --rm -f "MY_TAG/Dockerfile" -t ocsinventory/ocsinventory-docker-image:MY_TAG "MY_TAG" ``` -------------------------------- ### Install OCS Inventory Agent on OpenBSD Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers This script installs necessary dependencies and compiles the OCS Inventory agent from source on OpenBSD. ```bash export PKG_PATH="http://ftp.arcane-networks.com/pub/OpenBSD/4.5/packages/i386/" export OCS_VERSION="1.1.2" mkdir /var/lib pkg_add nmap pkg_add dmidecode pkg_add pciutils pkg_add p5-libwww pkg_add p5-XML-Simple pkg_add p5-Net-IP pkg_add p5-Proc-Daemon cd mkdir ocs wget http://launchpad.net/ocsinventory-unix-agent/1.1.x/ocsinventory-unix-agent-$OCS_VERSION/+download/Ocsinventory-Agent-$OCS_VERSION.tar.gz tar xvzf Ocsinventory-Agent-$OCS_VERSION.tar.gz cd Ocsinventory-Agent-$OCS_VERSION perl Makefile.PL make make install ``` -------------------------------- ### Install required Perl modules on Debian Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers Use apt to install the mandatory Perl modules and system dependencies for the OCS agent. ```bash $ sudo apt install libmodule-install-perl dmidecode libxml-simple-perl libcompress-zlib-perl libnet-ip-perl libwww-perl libdigest-md5-perl libdata-uuid-perl ``` -------------------------------- ### Configure Ingress Source: https://wiki.ocsinventory-ng.org/15.Kubernetes/Helm-charts Example ingress configuration including host definitions, annotations for NGINX, and basic authentication settings. ```yaml ingress: enabled: true labels: {} hosts: - "ocs.domain.tld" annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/force-ssl-redirect: "true" nginx.ingress.kubernetes.io/proxy-body-size: 200M nginx.ingress.kubernetes.io/proxy-connect-timeout: 300s nginx.ingress.kubernetes.io/proxy-send-timeout: 300s nginx.ingress.kubernetes.io/proxy-read-timeout: 300s cert-manager.io/cluster-issuer: "letsencrypt-staging" nginx.ingress.kubernetes.io/app-root: /ocsreports/ basicauth: enabled: true username: "agent-user" password: "agent-password" authRealm: "Authentication Required" paths: - "/ocsapi" - "/ocsinventory" ``` -------------------------------- ### Install required Perl modules on Fedora/Redhat/CentOS Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-manually-on-client-computers Use yum to install the mandatory Perl modules and system dependencies for the OCS agent. ```bash $ sudo yum install perl-XML-Simple perl-devel perl-Compress-Zlib perl-Net-IP perl-LWP perl-Digest-MD5 perl-Net-SSLeay perl-Data-UUID ``` -------------------------------- ### Install OCS Inventory on Enterprise Linux 7 Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-a-OCS-Inventory-Server-with-rpm Commands to enable the Remi repository and install the OCS Inventory package on EL7. ```bash yum install yum-utils yum-config-manager --enable remi yum-config-manager --enable remi-php73 yum install ocsinventory ``` -------------------------------- ### Example Configuration File Structure Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-Android-Agent The configuration is stored in an XML file named org.ocsinventory.android.agent_preferences.xml within the ocs directory. ```xml 24 SONY ERICSSON 900000 30 https://ocsinventory-ng/ocsinventory ``` -------------------------------- ### Build OCSNG.app Source: https://wiki.ocsinventory-ng.org/12.Developers/HOWTO-package-OCS-MacOSX-agent-releases Navigate to the tools/macosx directory and execute the build script to generate the application. ```bash cd tools/macosx sh BUILDME.sh -release ``` -------------------------------- ### Configure APT repository on Ubuntu Source: https://wiki.ocsinventory-ng.org/03.Basic-documentation/Setting-up-the-UNIX-agent-using-repository-on-client-computers Commands to add the OCS Inventory GPG key and repository source to Ubuntu-based systems, including a modern GPG alternative for newer releases. ```bash $ curl -sS https://deb.ocsinventory-ng.org/pubkey.gpg | sudo apt-key add - ``` ```bash $ curl -fsSL https://deb.ocsinventory-ng.org/pubkey.gpg | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/ocs-archive-keyring.gpg ``` ```bash $ echo "deb http://deb.ocsinventory-ng.org/ubuntu/ main" | sudo tee /etc/apt/sources.list.d/ocsinventory.list $ sudo apt update ``` -------------------------------- ### Complex LDAP Filter Example Source: https://wiki.ocsinventory-ng.org/04.Management-console-and-its-advanced-features/Synchronization-between-OCS-and-LDAP An advanced filter example using OR logic to check for membership in multiple groups before validating the login attribute. ```text (&(|(memberOf=CN=MyGroup,CN=Users,DC=MyDomain,DC=dc)(memberOf=CN=MyGroup2,CN=Users,DC=MyDomain,DC=dc))(sAMAccountName=user.login)) ```