quarta-feira, 23 de março de 2022

Instalação OCS Inventory 2.9.2 no Debian11 Netinstall SSH

apt-get update
apt install sudo wget apache2 mariadb-server make gcc build-essential build-essential nmap net-tools smartmontools read-edid -y
apt install php7.4-gd php-pclzip php7.4 php-mbstring php-soap php-mysql php-curl php-xml php-zip dmidecode -y
apt install libnet-netmask-perl libsys-syslog-perl libproc-daemon-perl libproc-pid-file-perl libcrypt-ssleay-perl libdigest-md5-perl libwww-perl libcompress-zlib-perl libmodule-install-perl libnet-snmp-perl libnet-ip-perl libapache-dbi-perl libnet-ip-perl libsoap-lite-perl libarchive-zip-perl libdbd-mysql-perl libxml-simple-perl libdbi-perl libswitch-perl libmojolicious-perl libplack-perl -y

export PERL_MM_USE_DEFAULT=1
cpan -i 'Text::Levenshtein::XS'
cpan -i 'Text::Levenshtein::Damerau::XS'
cpan -i 'Text::Levenshtein'
cpan -i 'Text::Levenshtein::Damerau::PP'
cpan -i 'DBI'
cpan -i 'Apache::DBI'
cpan -i 'Apache::DBI'
cpan -i 'Compress::Zlib'
cpan -i 'Archive::Zip'
cpan -i 'XML::Entities'
cpan -i 'XML::Simple'
cpan -i 'Net::IP'
cpan -i 'DBD::Mysql'
cpan -i 'SOAP::Lite'
unset PERL_MM_USE_DEFAULT

wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.9.2/OCSNG_UNIX_SERVER-2.9.2.tar.gz
tar xvf OCSNG_UNIX_SERVER-2.9.2.tar.gz
cd OCSNG_UNIX_SERVER-2.9.2
./setup.sh

/usr/sbin/apache2ctl

sudo /usr/sbin/a2enconf ocsinventory-reports

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

mysql
CREATE DATABASE ocs_DB_NAME;
CREATE USER 'ocs_DB_USER'@'localhost' IDENTIFIED BY 'ocs_DB_PASSWORD';
GRANT ALL ON ocs_DB_NAME.* TO 'ocs_DB_USER'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

nano /etc/php/7.4/apache2/php.ini

memory_limit = 256M
post_max_size = 100M
upload_max_filesize = 100M
max_execution_time = 360
date.timezone = America/Sao_Paulo

mv /etc/apache2/conf-available/ocsinventory-reports.conf /etc/apache2/sites-enabled/
mv /etc/apache2/conf-available/z-ocsinventory-server.conf /etc/apache2/sites-enabled/

## ATENÇÃO - ATUALIZAR SENHA DO BANCO DE DADOS OCS PARA COMUNICAÇÂO DOS AGENTES WINDOWS E LINUX PERL

nano /etc/apache2/sites-enabled/z-ocsinventory-server.conf

systemctl restart apache2.service

sudo reboot

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


---------------------------------------------------------------------------------------------------------------

Configuração do OCS_Agent

http://IP_OCS:Port_OCS/ocsinventory

Not Login
unchecked Cert
Checked Verbose

## http://wiki.ocsinventory-ng.org/06.Network-Discovery-with-OCS-Inventory-NG/Using-IP-discovery-feature/

Scan on server

Você pode iniciar uma varredura do servidor com a opção -rede Você pode definir o tipo de digitalização com a opção -scantype

Note: If you want to scan with ping, make sure fping is installed.


Examples :


Este comando irá digitalizar a sub-rede e adicionar todos os ip no banco de dados:


perl ipdiscover-util.pl -network=10.1.1.0/24 -scantype=ping

Este comando irá digitalizar a sub-rede e adicionar todos os ip no banco de dados que são agrupados pelo TAG:


perl ipdiscover-util.pl -network=10.1.1.0/24 -scantype=ping -tag=MYTAG

Você também pode definir várias redes no comando:


perl ipdiscover-util.pl -network=10.1.1.0/24 -network=10.1.2.0/24 -scantype=nmap

Desta forma, o script irá digitalizar ambas as redes e adicionar todo o IP encontrado ao banco de dados.


## Em resumo, as ações padrões da instalação são:

## – Continue = y
## – Database server (localhost) = enter
## – Database server Port (3306) = enter
## – Apache daemon binary (/usr/sbin/apache2ctl) = enter
## – Apache main config (/etc/apache2/apache2.conf) = enter
## – User Apache web server (www-data) = enter
## – Group Apache web server (www-data) = enter
## – Apache include config directory (/etc/apache2/conf-available) = enter
## – PERL interpreter (/usr/bin/perl) = enter
## – Communication server = y
## – Communication server log (/var/log/ocsinventory-server) = enter
## – Communication server plugins config (/etc/ocsinventory-server/plugins) = enter
## – Communication server plugins Perl (/etc/ocsinventory-server/perl) = enter


## Atenção: caso algum módulo PERL não esteja instalado o OCS Install informará, como por exemplo:  Warning: PERL module Apache2::SOAP is not installed! This module is only required by OCS Inventory NG SOAP Web Service. Neste caso, tecle y (Yes) para autorizar e aguarde pela instalação dos módulos faltantes, ou tecle n (No) para interromper a instalação e repita a operação depois de instalar as dependências.

## – Rest API server = no
## – Communication server Apache config file “z-ocsinventory-server.conf” = y
## – Administration Web Server = y
## – Install Console on /var/lib/ocsinventory-reports = y
## – Administration Server static files for PHP (/usr/share/ocsinventory-reports) = enter
## – Directories for packages, IPDiscovery and SNMP (/var/lib/ocsinventory-reports) = enter

## Feito isso a alteração da senha do usuário do OCS do Mysql, edite os arquivos:
## nano /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php
## nano /etc/apache2/conf-available/z-ocsinventory-server.conf.
## Altere o parâmetro “password” de cada arquivo, qual contém a senha de acesso do usuário ocs ao banco de dados ocsweb.

## Após, faça login no sistema usando as credenciais padrões (acima): http://ip-do-servidor/ocsreports
## Note as mensagens de alerta de segurança no topo do sistema como sobre o arquivo install.php existente no diretório de instalação do sistema.
## Use o comando abaixo para removê-lo:

## Diretórios e arquivos de configuração do OCS:

## /etc/ocsinventory-server – PERL e Plugins
## /etc/apache2/conf-available/z-ocsinventory-server.conf – Configs PERL / MySQL
## /etc/apache2/conf-available/ocsinventory-reports.conf – Configs do OCS Server / PHP
## /etc/apache2/conf.d/z-ocsinventory-server.conf  – Configs PERL / MySQL (Debian)
## /usr/share/ocsinventory-reports – Arquivos do OCS Reports Web
## /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php – MySQL Config
## /var/lib/ocsinventory-reports – Arquivos gerais
## /opt/OCSNG_UNIX_SERVER-2.X.Y/ocs_server_setup.log – Logs da instalação
## /usr/share/ocsinventory-reports/themes/OCS/banniere.png – Icone padrão do sistema
## /usr/share/ocsinventory-reports/themes/OCS/logo.png – Imagem da tela de login

## Arquivos de configuração do MySQL:
## Debian – /etc/mysql/my.conf
## Ubuntu – /etc/mysql/mysql.conf.d/mysqld.cnf
## *Para importar bases de tamanhos grandes, altere o parâmetro:
## max_allowed_packet = 16M para max_allowed_packet = 1024M, ou conforme sua necessidade.


export PERL_MM_USE_DEFAULT=1
cpan -i 'Text::Levenshtein::XS'
cpan -i 'Text::Levenshtein::Damerau::XS'
cpan -i 'Text::Levenshtein'
cpan -i 'Text::Levenshtein::Damerau::PP'
cpan -i 'Apache2::SOAP'
cpan -i 'LWP'
cpan -i 'DBI'
cpan -i 'Switch'
cpan -i 'Apache2::SOAP'
cpan -i 'Apache::DBI'
cpan -i 'XML::Entities'
cpan -i 'XML::Simple'
cpan -i 'Net::IP'
cpan -i 'Mojolicious'
cpan -i 'Mojolicious::Lite'
cpan -i 'Plack::Handler'
cpan -i 'Proc::PID::File'
cpan -i 'Proc::Daemon'
cpan -i 'Proc::ProcessTable'
cpan -i 'Nmap::Parser'
cpan -i 'Module::Install'
cpan -i 'IO::String'
cpan -i 'Test::Pod'
cpan -i 'Test::More'
cpan -i 'Test::Harness'
cpan -i 'Test::Harness::Switches'
cpan -i 'CPAN::DistnameInfo'
cpan -i 'Module::Install::AuthorTests'
cpan -i 'Module::Install::ExtraTests'
cpan -i 'File::HomeDir::FreeDesktop'
cpan -i 'Log::Log4perl'
cpan -i 'JSON::backportPP'
cpan -i 'MExtUtils::Command::MM'
cpan -i 'MTest::Harness'
unset PERL_MM_USE_DEFAULT


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 ...