Usando Linux para muchas cosas y disfrutando de videojuegos, en dispositivos moviles, consolas y pc. Using Linux for many things and enjoying video games, mobile devices, consoles and pc

La guia FINAL de OCS Inventory en Centos 7

DriveMeca instalando paso a paso OCS Inventory NG en Linux Centos 7
La cafeína ya no alcanza a bajar tu nivel de stress y cada vez son mas y mas equipos que a su vez llegan con licencias de software o necesitan que se les coloque una. No explotes, no pierdas la calma, para eso lo ideal es tener un sistema de inventario de software y hardware como OCSInventory el cual hoy te mostrare paso a paso como instalarlo en un servidor Linux Centos 7. Como siempre, este manual sera en español para que lo implementes sin problemas.

OCSinventory, como funciona?

Ocsinventory es un sistema que cuenta con un servidor recopilando información y varios clientes que se activan en los equipos a controlar (Windows, Linux, Mac, Android, etc). El servidor se maneja a través de una consola web de donde podemos sacar reportes, escanear redes buscando nuevos equipos, automatizar la instalación de software en equipos y mas. Ya entrados en el tema, comencemos entonces con este tutorial paso a paso en español.

Requerimientos para OCSInventory en Linux Centos 7


Artículos recomendadosConfigurando servicios en Linux Centos / RedHat
                                           Como cambiar zona horaria Linux paso a paso
                                           Como instalar Perl en Linux Centos 7 paso a paso


Instalamos dependencias de OCSInventory en Linux Centos 7

-Instalamos dependencias, las primeras son de los repositorios base de Centos y las ultimas de Epel
yum install gcc make mariadb-server httpd php php-mysql php-gd wget perl-CPAN which perl-Digest-SHA1
yum install epel-release
yum --enablerepo=epel install mod_perl perl-XML-Simple mod_perl-devel php-pclzip php-mbstring php-soap perl-Net-IP perl-Archive-Zip perl-XML-Entities

-Instalamos módulos Perl requeridos (en un articulo recomendado mas arriba te enseño a instalar Perl en Linux Centos 7 paso a paso)
SOAP::Lite
XML::Entities
Apache::DBI
BSD::Resource
Apache2::SOAP

Configuramos MariaDB en Linux Centos para OCSInventory

-Activamos el servicio de MariaDB para su inicio automático al hacer boot el equipo y lo ejecutamos
systemctl enable mariadb
systemctl start mariadb

-Aseguramos la configuracion de MariaDB y de paso le colocamos contraseña a la cuenta root de mariadb. Todas las preguntas (menos la de la nueva contraseña) van bien con su valor por lo que damos Enter para continuar

/usr/bin/mysql_secure_installation
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):
OK, successfully used password, moving on...

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

Set root password? [Y/n]
New password:
Re-enter new password:
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]
 ... 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]
 ... 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]
 - 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]
 ... 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!

-Entramos a MariaDB a crear la base de datos ocsweb usada por ocsinventory mas adelante
mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database ocsweb;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> exit;
Bye

Configuramos Apache en Linux Centos para OCSInventory

-Activamos y ejecutamos el servicio de Apache
systemctl enable httpd
systemctl start httpd

Configuramos OCS en Linux Centos 7

-Descargamos la ultima versión de OCSInventory, en este momento es la 2.3.1
wget -c https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.3.1/OCSNG_UNIX_SERVER-2.3.1.tar.gz

-Descomprimimos el archivo y entramos a su directorio
tar xzvf OCSNG_UNIX_SERVER-2.3.1.tar.gz
cd OCSNG_UNIX_SERVER-2.3.1

-Ejecutamos el script de instalación. Todas las preguntas van bien con su respuesta por default a lo cual respondemos con Enter

./setup.sh

+----------------------------------------------------------+
|                                                          |
|  Welcome to OCS Inventory NG Management server setup !   |
|                                                          |
+----------------------------------------------------------+

Trying to determine whitch 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)?
Assuming Communication server 1.0 RC2 or previous is not installed
on this computer.

Starting OCS Inventory NG Management server setup from folder /root/OCSNG_UNIX_SERVER-2.3.1
Storing log in file /root/OCSNG_UNIX_SERVER-2.3.1/ocs_server_setup.log

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

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

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

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


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

Where is Apache daemon binary [/usr/sbin/httpd] ?
OK, using Apache daemon /usr/sbin/httpd ;-)


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

Where is Apache main configuration file [/etc/httpd/conf/httpd.conf] ?
OK, using Apache main configuration file /etc/httpd/conf/httpd.conf ;-)


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

Which user account is running Apache web server [apache] ?
OK, Apache is running under user account apache ;-)


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

Which user group is running Apache web server [apache] ?
OK, Apache is running under users group apache ;-)


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

Setup found Apache Include configuration directory in
/etc/httpd/conf.d.
Setup will put OCS Inventory NG Apache configuration in this directory.
Where is Apache Include configuration directory [/etc/httpd/conf.d] ?
OK, Apache Include configuration directory /etc/httpd/conf.d found ;-)


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

Found PERL Intrepreter at </usr/bin/perl> ;-)
Where is PERL Intrepreter binary [/usr/bin/perl] ?
OK, using PERL Intrepreter /usr/bin/perl ;-)


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


+----------------------------------------------------------+
|             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] ?
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] ?
OK, Communication server will put plugins configuration files into directory /etc/ocsinventory-server/plugins ;-)

+-------------------------------------------------------------------+
|   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] ?
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.


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

Checking if your kit is complete...
Looks good
Writing Makefile for Apache::Ocsinventory
Writing MYMETA.yml and MYMETA.json

+----------------------------------------------------------+
|                 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) ?
OK, using 'z-ocsinventory-server.conf' as Communication Server Apache configuration file
Removing old communication server configuration to file /etc/httpd/conf.d/ocsinventory.conf
Writing communication server configuration to file /etc/httpd/conf.d/z-ocsinventory-server.conf

+----------------------------------------------------------------------+
|       OK, Communication server setup successfully finished ;-)       |
|                                                                      |
| Please, review /etc/httpd/conf.d/z-ocsinventory-server.conf |
|         to ensure all is good. Then restart Apache daemon.           |
+----------------------------------------------------------------------+


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

+----------------------------------------------------------+
|    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)?

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] ?
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] ?
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/httpd/conf.d/ocsinventory-reports.conf

+----------------------------------------------------------------------+
|        OK, Administration server installation finished ;-)           |
|                                                                      |
| Please, review /etc/httpd/conf.d/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 /root/OCSNG_UNIX_SERVER-2.3.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 ;-)


Modificamos PHP para OCS en Linux Centos

-Modificamos php.ini para aumentar el tamaño maximo permitido de archivos a manejarse desde la consola web
vi /etc/php.ini
post_max_size = 1024M
upload_max_filesize = 1024M

-Activamos permisos de apache y reiniciamos el servicio de apache
chown -R apache.apache /usr/share/ocsinventory-reports
systemctl restart httpd

Configuramos la consola web OCS-NG en Linux Centos 7

-Abrimos un browser en otro equipo y navegamos a al servidor http://ocsinventory-ip/ocsreports donde nos pedirán los datos MySQL login (root), MySQL password (contraseña root de mariadb), Name of Database (ocsweb), MySQL hostname (localhost) y damos click al botón Send
Configurando la consola web de OCSInventory

-Se crean las tablas en la db y se nos alerta de que podemos ingresar como usuario admin y contraseña admin. Damos click al botón Click here to enter OCS-NG GUI
Configurando la consola web de OCSInventory

-Eliminamos via consola el instalador web
rm /usr/share/ocsinventory-reports/ocsreports/install.php

-Nos devolvemos al browser y ya tenemos la pagina de ingreso. Por default es en Ingles pero podemos dar click a la bandera española y así cambiara a Español. Ingresamos con la cuenta admin y contraseña admin
Configurando la consola web de OCSInventory

-La pagina principal nos aparece, por el momento no tenemos ningún equipo, entonces es normal que todos los contadores estén en 0
Configurando la consola web de OCSInventory

-Primer paso, cambiar la contraseña de admin y para eso nos vamos al botón superior derecho, le damos click y de ahí damos click a My account
Configurando la consola web de OCSInventory

-Escribimos una nueva contraseña en el campo Contraseña y damos click al botón Ok
Configurando la consola web de OCSInventory

-Ya podemos curiosear las opciones de OCSInventory, aun en ceros
Configurando la consola web de OCSInventory

Artículos recomendadosComo instalar un agente linux para OCSInventory NG
                                           Como agregar un cliente Windows 8 en OCSInventory paso a paso

Una buena política empresarial es tener el control de todo activo sea de software (licencias) como de hardware (tarjetas, teclados, monitores, etc) y con OCSInventory es muy sencillo manejarlo.

Quieres apoyarme? Puedes donarme dinero por medio de PayPal.



Aun tienes dudas y quieres preguntarme algo que por email no crees posible? ahora puedes agendar una cita virtual conmigo, haz click aquí para agendar cita conmigo. Bien, hazme un favor, compártelo en tus redes sociales (compartir es sexy). Escríbeme en los comentarios aquí debajo y pasa la voz compartiendo el tweet.
Sígueme en twitter google+facebook o email y podrás estar enterado de todas mis publicaciones.
Disfrútenlo.

Share/Bookmark

No hay comentarios:

Publicar un comentario

Dejame un comentario, aprecio la retroalimentacion. Leave me a comment, I appreciate the feedback.