OCS: Instalacion Debian 9

  • Lo primero es asígnale una IP fija
nano /etc/network/interfaces
  • Modificamos
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens18
iface ens18 inet static
address 10.20.200.21
netmask 255.255.255.0
broadcast 10.20.200.255
gateway 10.20.200.1
dns-nameservers 10.20.200.1

  • Actualizamos el sistema
apt-get update && apt-get upgrade -y  && apt-get dist-upgrade -y
  • Ahora vamos instalar dependencias
apt-get install build-essential make apache2 nmap mysql-server php php-mysql php-gd php7.0-dev php-mbstring php-soap php-curl perl libapache2-mod-perl2 libapache2-mod-php libxml-simple-perl libcompress-zlib-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl libio-compress-perl libdbi-perl libdbd-mysql-perl libc6-dev php-pclzip   ZipArchive snmp
  • Otras
  • cpan -i XML::Entities cpan -i Archive::Zip mkdir /usr/include/apache2 cpan -i Apache2::SOAP
  • Instalamos «Mojolicious»
apt install cpanminus
cpanm Plack
cpan Mojolicious
  • Vamos a configurar MariaDB
mysql_secure_installation
  • RESULTADO:
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): root
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] Y

New password: HB3
Re-enter new password: HB3
Password updated successfully!
Reloading privilege tables..
... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y

... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y

... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!



  • Ingesamos a mysql
mysql -p
  • Le otorgamos permisos
GRANT ALL PRIVILEGES ON `ocsweb` .* TO 'remoto'@'localhost' IDENTIFIED BY 'RB0' WITH GRANT OPTION;GRANT ALL PRIVILEGES ON `ocsweb` .* TO 'ocs'@'localhost' IDENTIFIED BY 'Remoto_BAS_0' WITH GRANT OPTION;
  • Descargamos el software
wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.4.1/OCSNG_UNIX_SERVER_2.4.1.tar.gz
  • Lo descomprimimos
tar -xvzf OCSNG_UNIX_SERVER_2.4.1.tar.gz
  • Ingresamos a la carpeta
cd OCSNG_UNIX_SERVER_2.4.1
  • Podemos listar las dependencias para ver si nos falta alguna
cat INSTALL 
  • Ahora vamos hacer unas modificaciones al archivo de configuración de apache
nano /etc/php/7.0/apache2/php.ini 
  • Modificamos
post_max_size = 8M
X
post_max_size = 150M

upload_max_filesize = 2M
X
upload_max_filesize = 150M

  • Abrimos
nano /etc/apache2/apache2.conf
  • Añadimos al final
ServerName localhost
  • Reiniciamos apache
service apache2 restart
  • Ahora podemos ejecutar el instalador
sh setup.sh
  • RESULTADO:
+----------------------------------------------------------+
| |
| Welcome to OCS Inventory NG Management server setup ! |
| |
+----------------------------------------------------------+

Trying to determine which OS or Linux distribution you use
+----------------------------------------------------------+
| Checking for Apache web server binaries ! |
+----------------------------------------------------------+

CAUTION: If upgrading Communication server from OCS Inventory NG 1.0 RC2 and
previous, please remove any Apache configuration for Communication Server!

Do you wish to continue ([y]/n)? y
Assuming Communication server 1.0 RC2 or previous is not installed
on this computer.

Starting OCS Inventory NG Management server setup from folder /home/ugit/OCSNG_UNIX_SERVER_2.4.1
Storing log in file /home/ugit/OCSNG_UNIX_SERVER_2.4.1/ocs_server_setup.log

+----------------------------------------------------------+
| Checking for database server properties... |
+----------------------------------------------------------+

Your MySQL client seems to be part of MySQL version 10.1.
Your computer seems to be running MySQL 4.1 or higher, good ;-)

Which host is running database server [localhost] ? ENTER
OK, database server is running on host localhost ;-)

On which port is running database server [3306] ? ENTER
OK, database server is running on port 3306 ;-)


+----------------------------------------------------------+
| Checking for Apache web server daemon... |
+----------------------------------------------------------+

Where is Apache daemon binary [/usr/sbin/apache2ctl] ? ENTER

OK, using Apache daemon /usr/sbin/apache2ctl ;-)


+----------------------------------------------------------+
| Checking for Apache main configuration file... |
+----------------------------------------------------------+

Where is Apache main configuration file [/etc/apache2/apache2.conf] ? ENTER

OK, using Apache main configuration file /etc/apache2/apache2.conf ;-)


+----------------------------------------------------------+
| Checking for Apache user account... |
+----------------------------------------------------------+

Which user account is running Apache web server [www-data] ? ENTER

OK, Apache is running under user account www-data ;-)


+----------------------------------------------------------+
| Checking for Apache group... |
+----------------------------------------------------------+

Which user group is running Apache web server [www-data] ? ENTER

OK, Apache is running under users group www-data ;-)


+----------------------------------------------------------+
| Checking for Apache Include configuration directory... |
+----------------------------------------------------------+

Setup found Apache Include configuration directory in
/etc/apache2/conf-available.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [/etc/apache2/conf-available] ? /etc/apache2/conf-enabled

OK, Apache Include configuration directory /etc/apache2/conf-enabled found ;-)


+----------------------------------------------------------+
| Checking for PERL Interpreter... |
+----------------------------------------------------------+

Found PERL interpreter at </usr/bin/perl> ;-)
Where is PERL interpreter binary [/usr/bin/perl] ? ENTER

OK, using PERL interpreter /usr/bin/perl ;-)


Do you wish to setup Communication server on this computer ([y]/n)? ENTER
+----------------------------------------------------------+
| Checking for Make utility... |
+----------------------------------------------------------+

OK, Make utility found at </usr/bin/make> ;-)

+----------------------------------------------------------+
| Checking for Apache mod_perl version... |
+----------------------------------------------------------+

Checking for Apache mod_perl version 1.99_22 or higher
Found that mod_perl version 1.99_22 or higher is available.
OK, Apache is using mod_perl version 1.99_22 or higher ;-)

+----------------------------------------------------------+
| Checking for Communication server log directory... |
+----------------------------------------------------------+

Communication server can create detailed logs. This logs can be enabled
by setting integer value of LOGLEVEL to 1 in Administration console
menu Configuration.
Where to put Communication server log directory [/var/log/ocsinventory-server] ? ENTER

OK, Communication server will put logs into directory /var/log/ocsinventory-server ;-)

+----------------------------------------------------------------------------+
| Checking for Communication server plugins configuration directory... |
+----------------------------------------------------------------------------+

Communication server need a directory for plugins configuration files.
Where to put Communication server plugins configuration files [/etc/ocsinventory-server/plugins] ? ENTER


+-------------------------------------------------------------------+
| Checking for Communication server plugins perl directory... |
+-------------------------------------------------------------------+

Communication server need a directory for plugins Perl modules files.
Where to put Communication server plugins Perl modules files [/etc/ocsinventory-server/perl] ? ENTER


OK, Communication server will put plugins Perl modules files into directory /etc/ocsinventory-server/perl ;-)


+----------------------------------------------------------+
| Checking for required Perl Modules... |
+----------------------------------------------------------+

Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for Apache::DBI PERL module...
Found that PERL module Apache::DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for Compress::Zlib PERL module...
Found that PERL module Compress::Zlib is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.
Checking for SOAP::Lite Perl module...
Found that PERL module SOAP::Lite is available.
Checking for Archive::Zip Perl module...
Found that PERL module Archive::Zip is available.

+----------------------------------------------------------+
| Checking for optional Perl Modules... |
+----------------------------------------------------------+

Checking for Apache2::SOAP PERL module...
Found that PERL module SOAP::Apache2 is available.
Checking for XML::Entities PERL module...
Found that PERL module XML::Entities is available.


Do you wish to setup Rest API server on this computer ([y]/n)? ENTER


+----------------------------------------------------------+
| Checking for REST API Dependencies ... |
+----------------------------------------------------------+

Found that PERL module Mojolicious::Lite is available.
Found that PERL module Switch is available.
Found that PERL module Plack::Handler is available.

+----------------------------------------------------------+
| Configuring REST API Server files ... |
+----------------------------------------------------------+

Where do you want the API code to be store [/usr/local/share/perl/5.24.1] ? ENTER


Copying files to /usr/local/share/perl/5.24.1

+----------------------------------------------------------+
| Configuring REST API Server configuration files ... |
+----------------------------------------------------------+

+----------------------------------------------------------+
| OK, looks good ;-) |
| |
| Configuring Communication server Perl modules... |
+----------------------------------------------------------+


+----------------------------------------------------------+
| OK, looks good ;-) |
| |
| Preparing Communication server Perl modules... |
+----------------------------------------------------------+


+----------------------------------------------------------+
| OK, prepare finshed ;-) |
| |
| Installing Communication server Perl modules... |
+----------------------------------------------------------+


+----------------------------------------------------------+
| OK, Communication server Perl modules install finished;-)|
| |
| Creating Communication server log directory... |
+----------------------------------------------------------+
Creating Communication server log directory /var/log/ocsinventory-server.

Fixing Communication server log directory files permissions.
Configuring logrotate for Communication server.

Removing old communication server logrotate file /etc/logrotate.d/ocsinventory-NG
Writing communication server logrotate to file /etc/logrotate.d/ocsinventory-server

+----------------------------------------------------------------------+
| OK, Communication server log directory created ;-) |
| |
| Creating Communication server plugins configuration directory... |
+----------------------------------------------------------------------+

Creating Communication server plugins configuration directory /etc/ocsinventory-server/plugins.


+----------------------------------------------------------------------+
| OK, Communication server plugins configuration directory created ;-) |
| |
| Creating Communication server plugins Perl directory... |
+----------------------------------------------------------------------+

Creating Communication server plugins Perl directory /etc/ocsinventory-server/perl.


+----------------------------------------------------------------------+
| OK, Communication server plugins Perl directory created ;-) |
| |
| Now configuring Apache web server... |
+----------------------------------------------------------------------+
To ensure Apache loads mod_perl before OCS Inventory NG Communication Server,
Setup can name Communication Server Apache configuration file
'z-ocsinventory-server.conf' instead of 'ocsinventory-server.conf'.
Do you allow Setup renaming Communication Server Apache configuration file
to 'z-ocsinventory-server.conf' ([y]/n) ? ENTER


OK, using 'z-ocsinventory-server.conf' as Communication Server Apache configuration file

Removing old communication server configuration to file /etc/apache2/conf-enabled/ocsinventory.conf
Writing communication server configuration to file /etc/apache2/conf-enabled/z-ocsinventory-server.conf

+----------------------------------------------------------------------+
| OK, Communication server setup successfully finished ;-) |
| |
| Please, review /etc/apache2/conf-enabled/z-ocsinventory-server.conf |
| to ensure all is good. Then restart Apache daemon. |OCS: Instalacion Debian 9
+----------------------------------------------------------------------+


Do you wish to setup Administration Server (Web Administration Console)
on this computer ([y]/n)? ENTER


+----------------------------------------------------------+
| Checking for Administration Server directories... |
+----------------------------------------------------------+

CAUTION: Setup now install files in accordance with Filesystem Hierarchy
Standard. So, no file is installed under Apache root document directory
(Refer to Apache configuration files to locate it).
If you're upgrading from OCS Inventory NG Server 1.01 and previous, YOU
MUST REMOVE (or move) directories 'ocsreports' and 'download' from Apache
root document directory.
If you choose to move directory, YOU MUST MOVE 'download' directory to
Administration Server writable/cache directory (by default
/var/lib/ocsinventory-reports), especially if you use deployment feature.

Do you wish to continue ([y]/n)? ENTER
Assuming directories 'ocsreports' and 'download' removed from
Apache root document directory.

Where to copy Administration Server static files for PHP Web Console
[/usr/share/ocsinventory-reports] ? ENTER

OK, using directory /usr/share/ocsinventory-reports to install static files ;-)

Where to create writable/cache directories for deployment packages,
administration console logs, IPDiscover and SNMP [/var/lib/ocsinventory-reports] ? ENTER

OK, writable/cache directory is /var/lib/ocsinventory-reports ;-)


+----------------------------------------------------------+
| Checking for required Perl Modules... |
+----------------------------------------------------------+

Checking for DBI PERL module...
Found that PERL module DBI is available.
Checking for DBD::mysql PERL module...
Found that PERL module DBD::mysql is available.
Checking for XML::Simple PERL module...
Found that PERL module XML::Simple is available.
Checking for Net::IP PERL module...
Found that PERL module Net::IP is available.

+----------------------------------------------------------+
| Installing files for Administration server... |
+----------------------------------------------------------+

Creating PHP directory /usr/share/ocsinventory-reports/ocsreports.
Copying PHP files to /usr/share/ocsinventory-reports/ocsreports.
Fixing permissions on directory /usr/share/ocsinventory-reports/ocsreports.
Creating database configuration file /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php.
Creating IPDiscover directory /var/lib/ocsinventory-reports/ipd.
Fixing permissions on directory /var/lib/ocsinventory-reports/ipd.
Creating packages directory /var/lib/ocsinventory-reports/download.
Fixing permissions on directory /var/lib/ocsinventory-reports/download.
Creating snmp mibs directory /var/lib/ocsinventory-reports/snmp.
Fixing permissions on directory /var/lib/ocsinventory-reports/snmp.
Creating Administration server log files directory /var/lib/ocsinventory-reports/logs.
Fixing permissions on directory /var/lib/ocsinventory-reports/logs.
Creating Administration server scripts log files directory /var/lib/ocsinventory-reports/scripts.
Fixing permissions on directory /var/lib/ocsinventory-reports/scripts.
Configuring IPDISCOVER-UTIL Perl script.
Installing IPDISCOVER-UTIL Perl script.
Fixing permissions on IPDISCOVER-UTIL Perl script.
Writing Administration server configuration to file /etc/apache2/conf-enabled/ocsinventory-reports.conf

+----------------------------------------------------------------------+
| OK, Administration server installation finished ;-) |
| |
| Please, review /etc/apache2/conf-enabled/ocsinventory-reports.conf
| to ensure all is good and restart Apache daemon. |
| |
| Then, point your browser to http://server//ocsreports
| to configure database server and create/update schema. |
+----------------------------------------------------------------------+


Setup has created a log file /home/ugit/OCSNG_UNIX_SERVER_2.4.1/ocs_server_setup.log. Please, save this file.
If you encounter error while running OCS Inventory NG Management server,
we can ask you to show us his content !

DON'T FORGET TO RESTART APACHE DAEMON !

Enjoy OCS Inventory NG ;-)


  • Reinciamos apache
systemctl restart apache2.service
  • Ingresamos al sitio
http://10.20.200.21/ocsreports/
  • Nos aparece la siguiente ventana
undefined
  • Le damos permisos de escritura a la carpeta
chmod 777 -R /var/lib/ocsinventory-reports
  • Completamos los datos de conexión:
    • ocs
    • RB0
    • ocsweb
    • localhost
  • Inicia la instalación
undefined
  • Finaliza ya podemos ingresar con «login=admin and password=admin»
undefined
  • Seleccionamos el idioma
undefined
  • Ingresamos y nos indica que debemos borrar el archivo de instalación
rm /usr/share/ocsinventory-reports/ocsreports/install.php
  • Dentro del sistema ingresamos a «Mi cuenta» y cambiamos los datos pass AC2
undefined
  • Abrimos
nano /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php
  • Modificamos
<?php
define("DB_NAME", "ocsweb");
define("SERVER_READ","localhost");
define("SERVER_WRITE","localhost");
define("COMPTE_BASE","ocs");
define("PSWD_BASE","RB0");
?>
  • Abrimos
nano /etc/apache2/conf-enabled/z-ocsinventory-server.conf
  • Buscamos y modificamos a
 PerlSetEnv OCS_DB_USER ocs
  # Password for user
  PerlSetVar OCS_DB_PWD RB0
  • Reiniciamos apache
 service apache2 restart