sexta-feira, 3 de julho de 2020

Instalação Completa do OCS Inventory via git no debian 10 buster + Instalação dos agents Windows e Linux

Open Computer and Software Inventory Next Generation é um software livre que permite aos usuários inventariar ativos de TI. O OCS-NG coleta informações sobre o hardware e o software das máquinas conectadas, executando um programa cliente do OCS. O OCS pode visualizar o inventário por meio de uma interface web.

Ambiente Virtual

Hyper-V Server 2019

Baixar ISO: turnkey-core-16.0-buster-amd64.iso
Putty: Putty.exe


1. Criar Máquina Virtual:

Memória:            1GB
Disco:                 32GB
Processador:       2 Core
Nome da VM:    VMOCS

2. Instalar turnkey-core-16.0-buster-amd64:

** Aceite  todas as opções padrões de instalação **

** Verifique o IP no final da instalação **

** Recomendável configurar como IP estático **

3. Execute o Aplicativo Putty.exe e acesse via SSH o IP da VMOCS:

** Atualize a lista de repositórios do Linux **

$ nano /etc/apt/sources.list.d/sources.list

deb [signed-by=/usr/share/keyrings/tkl-buster-main.gpg] http://archive.turnkeylinux.org/debian buster main
deb http://deb.debian.org/debian buster main
deb http://deb.debian.org/debian buster contrib
deb http://deb.debian.org/debian buster non-free
#others updates
deb http://ftp.us.debian.org/debian stretch-proposed-updates main contrib non-free
deb-src http://security.debian.org/ stretch/updates main contrib non-free
deb http://ftp.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.debian.org/debian/ stretch main contrib non-free
deb http://packages.dotdeb.org wheezy-php56 all
deb-src http://packages.dotdeb.org wheezy-php56 all
deb http://mirrors.digitalocean.com/debian stretch main contrib non-free
deb-src http://mirrors.digitalocean.com/debian stretch main contrib non-free
deb http://packages.dotdeb.org stretch all
deb-src http://packages.dotdeb.org stretch all#altera senha do mariadb

4. Atualize as chaves dos repositorios:

$ wget -q https://packages.sury.org/php/apt.gpg -O- | apt-key add - && gpg --keyserver keys.gnupg.net --recv-key 89DF5277 && gpg -a --export 89DF5277 | apt-key add -

5. Atualize e instale todas dependências do sistema:

$ apt-get update && apt-get upgrade -y && apt-get install make cmake gcc make aptitude dirmngr apt-transport-https software-properties-common build-essential snmp nmap sudo -y && apt-get install libgdbm-dev libxml-simple-perl perl libperl5.28 libdbi-perl libdbd-mysql-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl libswitch-perl php-pclzip php7.3 php7.3-soap php7.3-xml php7.3-gd  php7.3-curl php7.3-mysql php7.3-zip php7.3-common libxml-parser-perl build-essential git curl libconfig-yaml-perl php7.3-mbstring libapache2-mod-php7.3 apache2 mariadb-server -y && apt-get install apache2-dev libio-compress-perl libcompress-raw-bzip2-perl libcompress-raw-zlib-perl libarchive-zip-perl libapache2-mod-php php-pear php7.3-cli php7.3-ldap zip unzip php-gd php-curl php-xml php-soap php-mysql php-zip php-mbstring -y && cpan -i 'Apache2::SOAP' && cpan -i 'XML::Entities' && cpan -i 'Net::IP' && cpan -i 'Apache::DBI' && cpan -i 'Mojolicious::Lite' && cpan -i 'Mojolicious' && cpan -i 'Switch' && cpan -i 'Plack::Handler' && cpan -i 'Proc::PID::File' && cpan -i 'DBI' && cpan -i 'XML::Simple' && cpan -i 'Nmap::Parser'

** Aceite todas as opções padrões de instalação **

6. Altere a senha do Mariadb:

$ mysql_secure_installation

7. Crie o usuário e banco, altere os campos em VERMELHO de acordo com seus configurações:

$ mysql -u root -p
$ create database NOME_DO_BANCO_OCS;
$ create user 'NOME_DO_USUARIO_OCS'@'localhost' identified by 'SENHA_DO_USUARIO_OCS';
$ grant all on ocs.* TO 'NOME_DO_USUARIO_OCS'@'localhost' with grant option;
$ flush privileges;
$ exit;

8. Instalando o OCSInventory:


$ cd /tmp
$ git clone https://github.com/OCSInventory-NG/OCSInventory-Server.git
$ cd OCSInventory-Server
$ git clone https://github.com/OCSInventory-NG/OCSInventory-ocsreports.git ocsreports
$ cd /tmp/OCSInventory-Server/ocsreports
$ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
$ sudo composer install
$ cd ..


A) Edite o setup.sh de acordo com as configurações do seu OCS

$ nano setup.sh

   DB_SERVER_HOST="localhost"
   DB_SERVER_PORT="3306"
   DB_SERVER_USER="NOME_DO_USUARIO_OCS"
   DB_SERVER_PWD="SENHA_DO_USUARIO_OCS"

B) Instale:

$ sudo ./setup.sh

** Aceite todas as opções padrões de instalação **

10. Atualize as permissões da pasta onde ocs foi instalado:

$ chown -R www-data:www-data /var/lib/ocsinventory-reports/

11.) Atualize o apache para carregar o OCSInventory:

$ a2enconf ocsinventory-reports
$ a2enconf z-ocsinventory-server
$ ln -s /etc/apache2/conf-available/z-ocsinventory-restapi.conf /etc/apache2/conf-enabled/z-ocsinventory-restapi.conf

12) Configure o PHP para configurações de desempenho do OCS:

$ nano /etc/php/7.3/apache2/php.ini

Linha 192: short_open_tag = Off
Linha 380: max_execution_time = 200
Linha 390: max_input_time = 200
Linha 401: memory_limit = 256M
Linha 689: post_max_size = 300M
Linha 832: file_uploads = On
Linha 841: upload_max_filesize = 256M
Linha 852: allow_url_fopen = On
Linha 956: date.timezone = CONTINENTE/SUA CIDADE

13. Verifique se as configurações estão corretas:

$ nano /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php

   ('DB_NAME','NOME_DO_BANCO_OCS');
   ('SERVER_READ','localhost');
   ('SERVER_WRITE','localhost');
   ('COMPTE_BASE','NOME_DO_BANCO_OCS');
   ('PSWD_BASE','SENHA_DO_USUARIO_OCS');

14. Verifique se ambos os arquivos estão corretos nas configurações de instalação:

$ nano /etc/apache2/conf-available/z-ocsinventory-server.conf
$ nano /etc/apache2/conf-enabled/z-ocsinventory-server.conf

---------------------------------------------------------------------------------------
   PerlSetEnv OCS_DB_NAME NOME_DO_BANCO_OCS
   PerlSetEnv OCS_DB_LOCAL NOME_DO_BANCO_OCS
   # User allowed to connect to database
   PerlSetEnv OCS_DB_USER NOME_DO_USUARIO_OCS
   # Password for user
   PerlSetVar OCS_DB_PWD SENHA_DO_USUARIO_OCS
---------------------------------------------------------------------------------------

15. Atualize o tamanho para carregamento de arquivos de inventário:

$ nano /etc/apache2/conf-enabled/ocsinventory-reports.conf

   php_value post_max_size 300M
   php_value upload_max_filesize 300M

$ systemctl restart apache2.service

16. Remover a opção de "install.php" para proteção do sistema, volte ao PUTTY.exe e execute o comando:

$ mv /usr/share/ocsinventory-reports/ocsreports/install.php \/usr/share/ocsinventory-reports/ocsreports/install.php.bak
$ exit

17. Para acessar

http://IP_DO_VMOCS/ocsreports/install.php

   MySQL login: NOME_DO_USUARIO_OCS
   MySQL password: SENHA_DO_USUARIO_OCS
   Name of Database: NOME_DO_BANCO_OCS
   MySQL HostName: localhost
   MySQL Port : 3306
   Enable SSL: NO

------------------------------------------------------------------------
** Clique em "SEND" para enviar as informações **
------------------------------------------------------------------------

18. Siga as etapas:

1ª Etapa:
OCS-NG Inventory Installation
Installation finished you can log in index.php with login=admin and password=admin
"Click here to enter OCS-NG GUI"

------------------------------------------------------------------------
** Clique em "OCS-NG GUI" **
------------------------------------------------------------------------

2ª Etapa:
Existing database updated
Current version:7017=>Expected version:7028
Perform the Update
------------------------------------------------------------------------
** Clique em "Perform the Update" **
------------------------------------------------------------------------

3ª Etapa:
Existing database updated
Current version:7017=>Expected version:7028
Update done

------------------------------------------------------------------------
** Clique em "Update done" **
------------------------------------------------------------------------

4ª Etapa:
Click here to enter OCS-NG GUI
------------------------------------------------------------------------
** Clique em "OCS-NG GUI" **
------------------------------------------------------------------------


** Seu sistema de Inventario esta instalado corretamente **

http://IP_DO_VMOCS/ocsreports/index.php

user:admin
password:admin



>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Instalação OCSInventory Agent Linux

aptitude install libmodule-install-perl dmidecode libxml-simple-perl libcompress-zlib-perl libnet-ip-perl libwww-perl libdigest-md5-perl libdata-uuid-perl ibcrypt-ssleay-perl libnet-snmp-perl libproc-pid-file-perl libproc-daemon-perl net-tools libsys-syslog-perl pciutils smartmontools read-edid nmap libnet-netmask-perl ocsinventory-agent -y

Selecione: http
Informe o endereço completo: http://IP_DO_VMOCS/ocsinventory

execute: ocsinventory-agent


Nenhum comentário:

Postar um comentário

Como mostrar a versão do Linux Debian

 Para mostrar a versão do Linux do Debian, rode o seguinte comando: $ cat /etc/*release* | grep CODENAME | cut -d "=" -f 2 Debian ...