1080*80 ad

Installing OCS Inventory Server on Ubuntu 22.04 and 20.04

Installing OCS Inventory Server on Ubuntu distributions like 22.04 and 20.04 provides a powerful solution for managing your IT assets. This process involves setting up a web server environment, configuring a database, and deploying the OCS Inventory application itself. Here’s a comprehensive guide to getting your OCS Inventory server up and running smoothly.

Before you begin, ensure you have a fresh installation of Ubuntu Server 22.04 or 20.04, root or sudo privileges, and an active internet connection.

Prepare Your Server Environment

The first step is to update your system’s package list and upgrade existing packages to ensure you have the latest software and security patches.

sudo apt update
sudo apt upgrade -y

OCS Inventory Server requires a LAMP stack (Linux, Apache, MySQL/MariaDB, PHP). Install the necessary components:

sudo apt install apache2 mariadb-server php libapache2-mod-php php-mysql php-mbstring php-curl php-json php-gd php-xml php-zip php-common php-fpm php-cli -y

MariaDB is a popular drop-in replacement for MySQL and is often preferred on Ubuntu. Secure your MariaDB installation by running the security script:

sudo mysql_secure_installation

Follow the prompts to set a root password, remove anonymous users, disallow remote root login, and remove the test database.

Configure the Database

Log in to the MariaDB console as the root user:

sudo mysql -u root -p

Enter the root password you set. Inside the console, create a dedicated database and user for OCS Inventory. Replace ocsweb and your_password with your desired database name, username, and a strong password.

CREATE DATABASE ocsweb;
CREATE USER 'ocsweb'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON ocsweb.* TO 'ocsweb'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Download and Install OCS Inventory NG Server

Navigate to the /tmp directory or another suitable location to download the OCS Inventory Server archive. Download the latest stable version from the official OCS Inventory website. (Note: Specific version numbers may vary, check the official source for the current stable release).

cd /tmp
wget https://github.com/OCSInventory-NG/OCSInventory-NG/releases/download/2.10.1/OCSNG_UNIX_SERVER-2.10.1.tar.gz # Example URL, check for latest version
tar -xvf OCSNG_UNIX_SERVER-2.10.1.tar.gz # Extract the downloaded archive

Move the extracted directory to a suitable location, such as /opt:

sudo mv OCSNG_UNIX_SERVER-2.10.1 /opt/ocsinventory-server # Example directory name
cd /opt/ocsinventory-server

Run the OCS installation script. This script will guide you through the setup process, checking dependencies and configuring the basic server structure.

sudo perl setup.sh

During the script execution, you will be asked to confirm paths and database details. Provide the database name (ocsweb), username (ocsweb), and password (your_password) you created earlier. The script will also configure Apache and set up necessary permissions.

Configure Apache Web Server

The setup.sh script typically creates an Apache configuration file for OCS. You might need to enable this site and the required Apache modules if the script didn’t do it automatically.
Enable the OCS Inventory Apache configuration (if not already enabled by the script):

sudo a2ensite ocsinventory.conf # Or the name of the config file created by setup.sh, often found in /etc/apache2/sites-available/

Enable necessary Apache modules, if prompted by the setup script or if you encounter issues:

sudo a2enmod perl cgi alias

Restart Apache to apply the changes:

sudo systemctl restart apache2

Complete the Web Installation

Open your web browser and navigate to the OCS Inventory installation page. This is typically located at http://your_server_ip_or_hostname/ocsinstall.
Follow the on-screen instructions provided by the web installer. You will need to:

  • Confirm system requirements are met.
  • Enter the database connection details (hostname typically localhost, database name ocsweb, username ocsweb, password your_password).
  • Create an administrator user and password for the OCS Inventory web interface.

After completing the web installation, it is crucial to remove the installation directory from the web server root for security reasons. The web installer will usually instruct you on this or offer to do it automatically. If manual removal is needed, it’s often something like:

sudo rm -rf /usr/share/ocsinventory-reports/ocsinstall/ # Or the actual path to the web installer directory

Access the OCS Inventory Web Interface

Once the installation is complete and the installation directory is removed, you can access the OCS Inventory administration console by navigating to http://your_server_ip_or_hostname/ocsreports in your web browser.
Log in using the administrator credentials you created during the web installation.

Post-Installation Steps

Your OCS Inventory server is now ready to receive inventory data. The next crucial step is to deploy OCS Inventory agents on the machines you want to inventory. Agents are available for various operating systems and report information back to the server.

This detailed process covers the essential steps to install OCS Inventory Server on your Ubuntu 22.04 or 20.04 system, providing a robust foundation for your IT asset management needs.

Source: https://kifarunix.com/install-ocs-inventory-server-on-ubuntu/

900*80 ad

      1080*80 ad