Install ocs ubuntu server

From OCS Inventory NG
Jump to: navigation, search

Installation guide of Ubuntu

A documentation is available in french here : http://doc.ubuntu-fr.org/ocs_inventory%7C

Install Apache

apt-get install apache2 apache2-doc

Add this at the last line of /etc/apache2/apache2.conf

ServerName $hostname_do_seu_servidor

On /etc/apache2/httpd.conf, add the following line to add UTF-8 support

AddDefaultCharset utf-8

Install MySQL

apt-get install mysql-server

Should you install the web and database servers in more than one machine, run the following command in order to allow a remote connection to MySQL.

GRANT ALL PRIVILEGES ON *.* TO $user@$$ip_servidor IDENTIFIED BY '$senha' WITH GRANT OPTION;

To allow for remote database access, you’ll also need to comment the following line in /etc/mysql/my.cnf

#bind-address           = 127.0.0.1

Install PHP

apt-get install php5 php5-mysql php5-gd

To do a simple PHP test, run the following commands then load http://$seu_servidor/info.php on your browser

echo "<?" > /var/www/info.php
echo "  phpinfo()" >> /var/www/info.php
echo "?>" >> /var/www/info.php
sudo /etc/init.d/apache2 restart

Install Perl

apt-get install libapache2-mod-perl2 libxml-simple-perl libcompress-zlib-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl

Install prerequisites for the IPDISCOVER feature

apt-get install libc6-dev

Install OCS Server version 2.0

Download the tarball

wget http://launchpad.net/ocsinventory-server/stable-2.0/2.0/+download/OCSNG_UNIX_SERVER-2.0.tar.gz

Decompress the tarball and run the installation script

tar -zxvf OCSNG_UNIX_SERVER-2.0.tar.gz
cd OCSNG_UNIX_SERVER-2.0
./setup.sh

Answer the installer questions

Do you wish to continue ([y]/n)? <ENTER>
Which host is running database server [localhost] ? <ENTER>
On which port is running database server [3306] ? <ENTER>
Where is Apache daemon binary [/usr/sbin/apache2] ? <ENTER>
Where is Apache main configuration file [/etc/apache2/apache2.conf] ? <ENTER>
Which user account is running Apache web server [www-data] ? <ENTER>
Which user group is running Apache web server [www-data] ? <ENTER>
Where is Apache Include configuration directory [1] ? <ENTER>
Where is PERL Intrepreter binary [/usr/bin/perl] ? <ENTER>
Do you wish to setup Communication server on this computer ([y]/n)? <ENTER>
Where to put Communication server log directory [/var/log/ocsinventory-server] ? <ENTER>

You can ignore the followinf error message, as per http://forums.ocsinventory-ng.org/viewtopic.php?id=2845

Checking for XML::Entities PERL module...
*** Warning: PERL module XML::Entities is not installed !
This module is only required by OCS Inventory NG SOAP Web Service.

Finish the installation by answering the following questions

Do you wish to continue ([y]/n] ? <ENTER>
Do you allow Setup renaming Communication Server Apache configuration file to 'z-ocsinventory-server.conf' ([y]/n) ? <ENTER>
Do you wish to setup Administration Server (Web Administration Console) on this computer ([y]/n)? <ENTER>
Do you wish to continue ([y]/n)? <ENTER>
Where to copy Administration Server static files for PHP Web Console [/usr/share/ocsinventory-reports] ? <ENTER>
Where to create writable/cache directories for deployement packages and IPDiscover [/var/lib/ocsinventory-reports] ? <ENTER>

Configure the servers

Create a VirtualHost for OCS. Add the following lines to the end of /etc/apache2/sites-available/default

Alias / "/usr/share/ocsinventory-reports/ocsreports/" 
   <Directory "/usr/share/ocsinventory-reports/ocsreports/"> 
       Options Indexes MultiViews FollowSymLinks 
       AllowOverride None 
       Order allow,deny 
       Allow from all 
   </Directory> 

Reboot the Apache server

/etc/init.d/apache2 restart

Edit /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php and add the name and password for the user created for MySQL

<?php
 $_SESSION["SERVEUR_SQL"]="localhost";
 $_SESSION["COMPTE_BASE"]="$user";
 $_SESSION["PSWD_BASE"]="$password";
?>

Open the following URL in your browser, check the information and click Send

http://$server_ip_address/install.php

For secutiry reasons, move the following to some web-inaccessible location

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

To make administrative TAGs updateable by the client edit /etc/apache2/conf.d/z-ocsinventory-server.conf and alter the following directive from 0 to 1

PerlSetEnv OCS_OPT_ACCEPT_TAG_UPDATE_FROM_CLIENT 1

Installation successful

Load the following URL and enter admin in both username and password fields

http://$server_ip_address