Instalar OCS Inventory en Ubuntu 18

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Instalar OCS

Inventory en ubuntu
18.04
Como Instalar OCS Inventory en ubunto 18.04
Instalación de OCS Inventory NG Server en Ubuntu 18.04
Instalación de OCS Inventory NG Server en Ubuntu 18.04
Se realiza instalación de las dependencias necesarias para la ejecución del servicio,
para realizar la instalación de los paquetes necesarios se debe contar con ingreso
como usuario root.
1. Se instala Apache
# apt install apache2 apache2-doc

2. Se agrega la siguiente línea al final de /etc/apache2/apache2.conf


ServerName localhost

3. Se des-comenta la siguiente opción en /etc/apache2/conf-enabled/charset.conf


AddDefaultCharset utf-8

4. Se instala MySQL
Step 1 — Installing MySQL
$ sudo apt install mysql-server

This will install MySQL, but will not prompt you to set a password or
make any other configuration changes. Because this leaves your
installation of MySQL insecure, we will address this next.
Step 2 — Configuring MySQL
For fresh installations, you'll want to run the included security script. This changes some of
the less secure default options for things like remote root logins and sample users. On older
versions of MySQL, you needed to initialize the data directory manually as well, but this is
done automatically now.
Run the security script:

$ sudo mysql_secure_installation

This will take you through a series of prompts where you can make some changes to your
MySQL installation’s security options. The first prompt will ask whether you’d like to set up
the Validate Password Plugin, which can be used to test the strength of your MySQL
password. Regardless of your choice, the next prompt will be to set a password for the
MySQL root user. Enter and then confirm a secure password of your choice.
From there, you can press Y and then ENTER to accept the defaults for all the subsequent
questions. This will remove some anonymous users and the test database, disable remote
root logins, and load these new rules so that MySQL immediately respects the changes you
have made.

Step 3 — (Optional) Adjusting User Authentication and Privileges


In Ubuntu systems running MySQL 5.7 (and later versions), the root MySQL user is set to
authenticate using the auth_socket plugin by default rather than with a password. This
allows for some greater security and usability in many cases, but it can also complicate things
when you need to allow an external program (e.g., phpMyAdmin) to access the user.

In order to use a password to connect to MySQL as root, you will need to switch its
authentication method from auth_socket to mysql_native_password. To do this, open up
the MySQL prompt from your terminal:

$ sudo mysql
Next, check which authentication method each of your MySQL user accounts
use with the following command:
mysql> SELECT user,authentication_string,plugin,host FROM mysql.user;

+------------------+-------------------------------------------+---------
-----------+-----------+
| user | authentication_string | plugin
| host |
+------------------+-------------------------------------------+---------
-----------+-----------+
| root | |
auth_socket | localhost |
| mysql.session |*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
mysql_native_password| localhost |
| mysql.sys |*THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
mysql_native_password| localhost |
| debian-sys-maint|*CC744277A401A7D25BE1CA89AFF17BF607F876FF |
mysql_native_password| localhost |
+------------------+-------------------------------------------+---------
-----------+-----------+
4 rows in set (0.00 sec)
n this example, you can see that the root user does in fact authenticate using
the auth_socket plugin. To configure the root account to authenticate with a password, run
the following ALTER USER command. Be sure to change password to a strong password of your
choosing, and note that this command will change the root password you set in Step 2:
Mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH
mysql_native_password BY 'password';

Then, run FLUSH PRIVILEGES which tells the server to reload the grant tables and put your
new changes into effect:

mysql> FLUSH PRIVILEGES;

+-----------------+------------------------------------------+-----------
-----------+----------+
| user | authentication_string | plugin
| host |
+-----------------+------------------------------------------+-----------
-----------+----------+
| root | *3636DACC8616D997782ADD0839F92C1571D6D78 |
mysql_native_password| localhost|
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHER |
mysql_native_password| localhost|
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHER |
mysql_native_password| localhost|
| debian-sys-maint| *CC744277A401A7D25BE1CA89AFF17BF607F876F |
mysql_native_password| localhost|
+-----------------+------------------------------------------+-----------
-----------+----------+
4 rows in set (0.00 sec)

You can see in this example output that the root MySQL user now authenticates
using a password. Once you confirm this on your own server, you can exit the
MySQL shell:
mysql> exit

5. Se permite el acceso a la base de datos desde equipos remotos, se modifica el


archivo /etc/mysql/mysql.conf.d/mysqld.cnf
se comenta la línea 42
## bind-address 127.0.0.1

6. Se instala PHP # apt install php php-mysql php-gd php-soap php-mbstring php-
curl php-xml

7. Se modifica /etc/php/7.2/cli/php.ini
Línea 671 post_max_size = 200M
Línea 824 upload_max_filesize = 200M

8. Se instala Perl
apt install libxml-simple-perl libcompress-zlib-perl libdbi-perl
libdbd-mysql-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl
libarchive-zip-perl make build-essential
cpan install XML::Entities

9. Se instalan módulos de perl necesarios


perl -MCPAN -e shell
 Would you like to configure as much as possible automatically? [yes] Enter
Cpan[1]> install Archive::Zip
Cpan[1]> install SOAP::Lite
Cpan[1]> install XML::Entities
Cpan[1]> install Mojolicious::Lite
Cpan[1]> install Switch
Cpan[1]> install Plack::Handler
Cpan[1]> exit
# cpan -f Archive::Zip
# wget http://www.cpan.org/authors/id/R/RK/RKOBES/Apache2-SOAP-0.73.tar.gz
# tar -zxvf Apache2-SOAP-0.73.tar.gz
# cd Apache2-SOAP-0.73
# mkdir /usr/include/apache2
# perl Makefile.PL
# make
# make install
# /etc/init.d/apache2 restart

10. Se instala pre-requisito para IPDiscover


# apt install libc6-dev

11. Se realiza descarga de la última versión de OCS Inventory NG disponible


# wget https://github.com/OCSInventory-NG/OCSInventory-
ocsreports/releases/download/2.6
/OCSNG_UNIX_SERVER_2.6.tar.gz
# tar -zxvf OCSNG_UNIX_SERVER_2.6.tar.gz
# cd OCSNG_UNIX_SERVER_2.6
# ./setup.sh

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/apache2ctl]? 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 [/etc/apache2/conf-
available]? Enter
 Where is PERL interpreter 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
 Where to put Communication server plugins configuration files [/etc/ocsinventory-
server/plugins]? Enter
 Where to put Communication server plugins Perl modules files [/etc/ocsinventory-
server/perl]? Enter
 Do you wish to setup Rest API server on this computer ([y]/n)? Enter
 Where do you want the API code to be store [/usr/local/share/perl/5.26.0]? 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 continue ([y]/n)? Enter
 Where to copy Administration Server Static files for PHP Web Console
[/usr/share/ocsinventory-reports]? Enter
 Where to créate writable/cache directories for deployment packages,
administration console logs, IPDiscover and SNMP [/var/lib/ocsinventory-
reports]? Enter

12. Se modifica archivo de configuración de OCS Inventory NG /etc/apache2/conf-


available/z-ocsinventory-server.conf
Línea 29 PerlSetEnv OCS_DB_USER root
Línea 31 PerlSetVar OCS_DB_PWD “Contraseña_root”
# a2enconf ocsinventory-reports
# /etc/init.d/apache2 restart

13. Se realiza ingreso por Browser de preferencia http://IP_Servidor/ocsreports

14. Se ingresan los datos de conexión a la base de datos donde se almacenará la


información de inventario
 MySQL Login: root
 MySQL password: “Contraseña asignada”
 Name of Database: ocsweb
 MySQL HostName: localhost

modificaremos la clave de el archivo de z-ocsinventory-servdr.conf


# Master Database settings
# Replace localhost by hostname or ip of MySQL server for WRITE
PerlSetEnv OCS_DB_HOST localhost
# Replace 3306 by port where running MySQL server, generally 3306
PerlSetEnv OCS_DB_PORT 3306
# Name of database
PerlSetEnv OCS_DB_NAME ocsweb
PerlSetEnv OCS_DB_LOCAL ocsweb
# User allowed to connect to database
PerlSetEnv OCS_DB_USER root
# Password for user
PerlSetVar OCS_DB_PWD contraseña

tambien modificaremos la clave de el archivo zz-ocsinventory-restapi.conf

<Perl>
$ENV{PLACK_ENV} = 'production';
$ENV{MOJO_HOME} = '/usr/local/share/perl/5.26.1';
$ENV{MOJO_MODE} = 'deployment';
$ENV{OCS_DB_HOST} = 'localhost';
$ENV{OCS_DB_PORT} = '3306';
$ENV{OCS_DB_LOCAL} = 'ocsweb';
$ENV{OCS_DB_USER} = 'root';
$ENV{OCS_DB_PWD} =contraseña

luego reiniciamos el apache2 con el siguiente comando


/etc/init.d/apache2 restart

15. Realizados estos pasos dará el acceso para ingreso a la aplicación, en el


browser dar clic en Click here to enter OCS-NG GUI
16. se realiza el ingreso con usuario predeterminado (user: admin, password:
admin)

17. Se mueve archivo install.php para un directorio diferente del actual


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

You might also like