New and updated version for Debian Stretch and OCS Inventory NG server 2.5 can be found here!


In our previous part we have successfully installed an RC version of OCS-NG server. Now it’s time to install a stable version of 2.2. There isn’t much many differences between installation of the RC1 and Stable, thus this guide will be much shorter

Table of contents:

  1. Requirements for this tutorial
  2. Installation
  3. Install OCS Windows Agent and collect some data
  4. Finish!

 1. Requirements for this tutorial


In this tutorial we will need following peaces of software:

I strongly recommend running this install inside of virtual machine since wiping it, reformatting or restarting is much faster than on standalone server:)

I performed all steps few times inside virutal environment (Vsphere 5.5 hypervisor aka esxi) but this should apply for any other environment.

Hardware/vm requirements

Our machine should have at least:

  • 1 (v)CPU with 2 cores
  • 2Gigs of RAM
  • 1 Gigabit Ethernet
  • 16GB of storage

Once again, I assume installing it in virtual environment so things like vm-tools will not be necessary to install on standalone servers. I will not cover how to install ESXi or VMWare Player since it’s a material (especially ESXi) for complete series of guides:)

2. Installation

To be honest installation is quite simple since all packages are available for Debian 8.x (Jessie). We don’t need to compile anything from sources and manually register or install dependencies. That saves us quite a bit of work. I know that on some other Linux distros installation might go more straightforward but I’m used to Debian and feel quite comfortable in this environment.

Installation consists of three main steps:

  1. Installation of Debian OS
  2. Installation of required packages
  3. Installation of OCS-NG

Installation of Debian OS

  1. Burn Debian ISO to disk or mount is as cd/dvd in VM
  2. Boot from above
  3. Select to install Debian in 64bit version with minimum options: SSH Server, system utilities. Do not install WWW, DB or other services.
  4. Rest of the options like language or partitioning leave with their default settings.
  5. Reboot and login to shell
  6. Now, we need to install required packages in order to be able to perform rest of the steps. Of course all installs must be performed with root privileges.
  7. Lets type some commands, at last!:

Installation of required packages

Update repositories:

apt-get update -y
apt-get upgrade -y

Install Open VM Tools – they simply work better than original VM-tools from VMWARE.

apt-get install open-vm-tools sudo make -y

After above it’s good to restart the VM. Good old Windows school :)

Be sure to execute the following commands as root

Install Apache2:

apt-get install apache2 -y

Now, packages for it:

apt-get install -y php5-common libapache2-mod-php5 php-pear php5-cli php5-ldap

Restart Apache with the following command:

service apache2 restart

Now, we have a running instance of apache:

Continue with installation of packages:

apt-get install -y libxml-simple-perl libio-compress-perl libdbi-perl libdbd-mysql-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl libarchive-zip-perl

Configure CPAN:

cpan -i XML::Entities

press “yes” to autoconfigure cpan, then install

Install Zip package for perl:

apt-get install -y libphp-pclzip php5-gd

Now, install MySQL:

apt-get install -y mysql-server php5-mysql

After typing above command you will have to specify root and admin password for MySQL server. Note them somewhere.
As addition to MySQL I like to have visual representation of databases so lets install phpMyAdmin:

apt-get install -y phpmyadmin

Select apache2 as www deamon:

Provide a password for MySQL database root, then password for phpmy admin and press ok:

one more thing is to create a symlink to phpmyadmin and restart apache2:

ln -s /etc/phpmyadmin/apache.conf /etc/apache2/mods-enabled/phpmyadmin.conf
service apache2 restart

Now, you should be able to access your new server at:

  • http://localhost – default apache landing page
  • http://localhost/phpmyadmin – MySQL phpMyAdmin management suite

Installation of OCS-NG Server

Installation of server itself is quite simple. OCS team provided us a nice install script that does pretty much of everything for us. If all required packages are available and running user has root privileges all should go hassle free.

First of all we need to download latest build:

cd /tmp

Then extract it somewhere. Might be your current dir if you are in for example in /home/ or /tmp/:

tar -xf OCSNG_UNIX_SERVER-2.2.tar.gz

Enter new directory and execute:


Now install script should configure pretty much for you. At one point you will have to answer non default way:

  • When script will ask about main apache conf file. If you didn’t change anything paste this:/etc/apache2/apache2.conf*
  • When script checks: Checking for Apache Include configuration directory…, paste this: /etc/apache2/sites-enabled*
  • Script will ask if you want to use SOAP extensions and more likely report that libraries are missing. Just continue.

*this might be found in info.php results :)

Script should finish with a message that apache service needs to be restarted. We will do it in few moments.

Now it’s good time to fix some permissions:

chown -R www-data:www-data /var/www/html
chown -R www-data:www-data /usr/share/ocsinventory-reports/

Now, restart apache:

service apache2 restart

After this there is OCS server is almost ready.
Navigate to:
You should get install screen for OCS like this:

Type in:

  • root user for mySql
  • root pass for mySql
  • name of database: I use default: ocsweb
  • hostname of mySql: localhost (since it all runs on one server)

Now you will get screen, that DB needs to updated:

Press Perform the update. After upgrade you will be presented with a screen:

Now, you are able to login to OCS server by typing admin as user and password:

and Volia!

Ok, back to command line. Installer sets default user and pass for ocsweb DB as ocs/ocs. It’s ok for test environment, but in production we need to change it.

  1. Login to phpMyAdmin with DB root login and pass
  2. Find users TAB in main windows
  3. Note, that there will be two ocs users, click on ocs@localhost (or whatever the host is)
  4. Click Edit Permissions
  5. Click Change password
  6. Change password and submit changes.

Now, OCS will stop working. It’s ok. Now we need to change password in OCS config:

nano /usr/share/ocsinventory-reports/ocsreports/
replace "ocs" in line:
with password you just set

Now, we need to edit z-ocsinventory-service.conf as well:

nano /etc/apache2/sites-enabled/z-ocsinventory-server.conf

Find line:

PerlSetVar OCS_DB_PWD ocs

replace “ocs” with DB password you have set and restart apache2 deamon

If something is wrong, check you logs with command:

tail /var/log/apache2/error.log

tail /var/log/apache2/access.log

Now OCS reports should be running again.
Now, just delete install script by typing following command:

rm /usr/share/ocsinventory-reports/ocsreports/install.php

Base OCS is now installed and running:)

Install OCS Windows Agent and collect some data

Recently there was an update to the Windows agent. New version is numbered as which is compatible with our server. I assume that new version of agent, numbered 2.2 will be available soon:)

Agent can be downloaded here:

Launch setup and check following options:

Since we didn’t enable SSL nor we have generated any certificates do not enable this option during installation.

Moreover if you do not have a valid DNS service in your local network, enter IP of the management server instead of FQDN or NetBios name.

Most certainly we do not need to specify any proxy server to access ocsinventory server:

Finally, select to perform immediate inventory after installation, press “next” two times and wait till finish.

After few minutes you can see that computer is listed in our ocs inventory server:


4. Finish!

That’s all, It is a bit simpler comparing to OCS2.2RC1 and 2.1 to install it. Enjoy new look and feel. New agent works pretty much the same as old one. I will try to enable SSL and LDAP next, so stay tuned. As always, I encourage you to leave a replay on how it went on your server:)