Sem resumo de edição
Linha 2: Linha 2:




= INSTALAÇÃO OCS INVENTORY CENTOS 7 =
= Instalação do OCS-Inventory server no Linux CentOS7 =


== 1º Instalação de repositórios extras ==
== 1º Instalação de repositórios extras ==
Linha 13: Linha 13:


Para habilitando o Remi no CentOs 7, execute:
Para habilitando o Remi no CentOs 7, execute:
  wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm  
  wget <nowiki>http://rpms.famillecollet.com/enterprise/remi-release-7.rpm</nowiki>
  sudo rpm -Uvh remi-release-7*.rpm
  sudo rpm -Uvh remi-release-7*.rpm
  sudo yum --enablerepo=remi install php-tcpdf
  sudo yum --enablerepo=remi install php-tcpdf
Linha 24: Linha 24:
  <nowiki>[remi]</nowiki>
  <nowiki>[remi]</nowiki>
  name=Les RPM de remi pour Enterprise Linux 7 - $basearch
  name=Les RPM de remi pour Enterprise Linux 7 - $basearch
  #baseurl=http://rpms.famillecollet.com/enterprise/7/remi/$basearch/
  #baseurl=<nowiki>http://rpms.famillecollet.com/enterprise/7/remi/$basearch/</nowiki>
  mirrorlist=http://rpms.famillecollet.com/enterprise/7/remi/mirror
  mirrorlist=<nowiki>http://rpms.famillecollet.com/enterprise/7/remi/mirror</nowiki>
  enabled=1
  enabled=1
  gpgcheck=1
  gpgcheck=1
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
  gpgkey=<nowiki>file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi</nowiki>
  gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
  gpgkey=<nowiki>file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi</nowiki>
  failovermethod=priority
  failovermethod=priority


Linha 50: Linha 50:
Adicione o conteúdo abaixo no arquivo e salve o arquivo Mariadb.repo  
Adicione o conteúdo abaixo no arquivo e salve o arquivo Mariadb.repo  
  # MariaDB 10.0 CentOS repository list - created 2014-11-30 22:51 UTC  
  # MariaDB 10.0 CentOS repository list - created 2014-11-30 22:51 UTC  
  # http://mariadb.org/mariadb/repositories/
  # <nowiki>http://mariadb.org/mariadb/repositories/</nowiki>
  <nowiki>[mariadb]</nowiki>  
  <nowiki>[mariadb]</nowiki>  
  name = MariaDB
  name = MariaDB
Linha 75: Linha 75:
      
      
  CREATE DATABASE ocs;
  CREATE DATABASE ocs;
  GRANT ALL PRIVILEGES ON ocs.* to ocs@localhost IDENTIFIED BY 'suasenha';
  GRANT ALL PRIVILEGES ON ocs.* to <nowiki>ocs@localhost</nowiki> IDENTIFIED BY 'suasenha';
  FLUSH PRIVILEGES;
  FLUSH PRIVILEGES;
  QUIT
  QUIT
Linha 110: Linha 110:
  systemctl restart httpd.service
  systemctl restart httpd.service


Caso abra, faça:
Caso abra, volte ao arquivo install.php e edite-o
Voltar ao arquivo install.php e editalo
  mv install.php install-.php
  mv install.php install-.php
  systemctl restart httpd.service
  systemctl restart httpd.service


Caso não abra, faça:
Caso não abra, reinstale o pacote do OCS Inventory
yum --enablerepo=remi install ocsinventory
 
Caso dê certo, Acompanhe os erros no log
tail -f /var/log/httpd/error_log
 
= Configuração do agente do OCS-Inventory no linux =
 
Faça o download do pacote OCSNG_UNIX_AGENT-1.02.tar.gz, a versão mais recente pode ser obtida em http://www.ocsinventory-ng.org.
wget <nowiki>http://downloads.sourceforge.net/project/ocsinventory/OCS%20Inventory%20NG/*/Ocsinventory-Unix-Agent-*.tar.gz</nowiki>


Reinstalar o pacote do OCS Inventory -> yum --enablerepo=remi install ocsinventory
Descompacte os arquivos:
tar xzvf Ocsinventory-Unix-Agent-*.tar.gz


Caso dê certo: Acompanhar no LOG do HTTPD
Entre no diretório Ocsinventory-Agent-*:
cd Ocsinventory-Unix-Agent-*/
 
Inicie a instalação:
perl Makefile.PL
 
Irá aparecer a seguinte mensagem:
Please install Crypt::SSLeay if you want to use SSL.
Checking if your kit is complete...
Looks good
Writing Makefile for Ocsinventory::Agent
 
Gerar Binários
make
 
Instalar Binários
make install
 
Surge o Assistente:
Do you want to configure the agent [Enter]
Please enter 'y' or 'n'?> [y]
Where do you want to write the configuration file?
0 -> /etc/ocsinventory
1 -> /usr/local/etc/ocsinventory
2 -> /etc/ocsinventory-agent
?> 1
 
Do you want to create the directory /usr/local/etc/ocsinventory?
Please enter 'y' or 'n'?> [y]
[info] The config file will be written in /etc/ocsinventory/ocsinventory-agent.cfg,
 
What is the address of your ocs server?> [ocsinventory-ng] IP_CONFIGURADO_O_OCS-INVENTORY_SERVER
 
Do you need credential for the server? (You probably don't)
Please enter 'y' or 'n'?> [n]
 
Do you want to apply an administrative tag on this machine
Please enter 'y' or 'n'?> [y] n
ocsinventory agent presents: /usr/bin/ocsinventory-agent
 
Do yo want to install the cron task in /etc/cron.d
Please enter 'y' or 'n'?> [y]
 
Where do you want the agent to store its files? (You probably don't need to change it)?> [/var/lib/ocsinventory-agent]
 
Do you want to create the /var/lib/ocsinventory-agent directory?
Please enter 'y' or 'n'?> [y]
New settings written! Thank you for using OCS Inventory
 
Should I remove the old linux_agent
Please enter 'y' or 'n'?> [n]
 
Do you want to use OCS-Inventory software deployment feature?
Please enter 'y' or 'n'?> [y]
 
Do you want to use OCS-Inventory SNMP scans feature?
Please enter 'y' or 'n'?> [y]
 
Do you want to send an inventory of this machine?
Please enter 'y' or 'n'?> [y]
[info] Accountinfo file doesn't exist. I create an empty one.


Acompanhe no log-> tail -f /var/log/httpd/error_log


= REFERÊNCIAS =
= REFERÊNCIAS =
[https://felliperocha.blogspot.com.br/2014/11/ocs-inventory-no-centos-7.html OCS-Inventory no CentOS 7]
[https://felliperocha.blogspot.com.br/2014/11/ocs-inventory-no-centos-7.html OCS-Inventory no CentOS 7] - Acessado em 4 de setembro/2017
 
[http://andredeo.blogspot.com.br/2009/08/instalando-agente-ocs-manualmente.html Instalando o agente manualmente no Linux] - Acessado em 4 de setembro/2017

Edição das 19h32min de 4 de setembro de 2017

O OCS Inventory é uma aplicação que promove um inventário de máquinas automático, onde as informações são coletadas em tempo real. Conta com suporte a outra aplicação chamada GLPI que faz o inventário offline, o que seria útil para máquinas e recursos (como memória RAM, CPU, discos, ...) que não estão ativas, ou que estão guardadas em algum almoxarifado ou depósito.


Instalação do OCS-Inventory server no Linux CentOS7

1º Instalação de repositórios extras

  • EPEL
  • REMI

EPEL

Para incluir os Pacotes Adicionais para Enterprise Linux (ou EPEL), é necessário executar o seguinte comando:

yum install epel

Para habilitando o Remi no CentOs 7, execute:

wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 
sudo rpm -Uvh remi-release-7*.rpm
sudo yum --enablerepo=remi install php-tcpdf

Acesse /etc/yum.repos.d/remi.repo

Em [remi] modifique enable=0 para enable=1 para ativar o repositorio. Abaixo como [remi] deve ficar.

[remi]
name=Les RPM de remi pour Enterprise Linux 7 - $basearch
#baseurl=http://rpms.famillecollet.com/enterprise/7/remi/$basearch/
mirrorlist=http://rpms.famillecollet.com/enterprise/7/remi/mirror
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
failovermethod=priority

Para verificar se o repositorio está funcionando, execute:

yum repolist

2º Preparando o servidor

Agora há a necessidade de instalar alguns pacotes que são pre-requisitos do OCS-Inventory:

yum update -y
yum install -y httpd httpd-devel mod_perl mod_php mod_ssl php-gd php-mysql php-mbstring php perl perl-XML-Simple perl-Compress-Zlib perl-DBI perl-DBD-MySQL  perl-Net-IP perl-SOAP-Lite perl-Apache-DBI perl-Apache2-SOAP perl-XML-Entities

Inicie o WebServer

systemctl start httpd.service
systemctl enable httpd.service

Adicione o repositorio do MariaDB

cd /etc/yum.repos.d/
vim MariaDB.repo

Adicione o conteúdo abaixo no arquivo e salve o arquivo Mariadb.repo

# MariaDB 10.0 CentOS repository list - created 2014-11-30 22:51 UTC 
# http://mariadb.org/mariadb/repositories/
[mariadb] 
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1 

Agora faça a instalação do MariaDB

sudo yum install MariaDB-server MariaDB-client

Inicie o Banco de Dados

/etc/init.d/mysql start

Execute o instalação segura do Mysql e atribui a senha para root

/usr/bin/mysql_secure_installation

Dê enter para todas as mensagens e escolha uma senha para o root do MySQL.

Opcional

Caso deseje criar a base de dados agora, segue abaixo o procedimento, porém é possivel criar na durante a instalação do OCS. Fazendo essa configuração agora quando acessar o OCS será necessário somente dar input das informações de conexão com o banco de dados.

# mysql -u root -p
   
CREATE DATABASE ocs;
GRANT ALL PRIVILEGES ON ocs.* to ocs@localhost IDENTIFIED BY 'suasenha';
FLUSH PRIVILEGES;
QUIT

3º Instalando o OCS-Inventory em si

Instalação do OCS NG através do Yum utilizando o Remi

yum --enablerepo=remi install ocsinventory

Libera acesso http e https

firewall-cmd --permanent --zone=public --add-service=http 
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

Altere no php.ini o tamanho maximo de post e upload

vim /etc/php.ini
post_max_size = 200M
upload_max_filesize = 200M

Concluida a instalação remova o arquivo install.php do diretorio /usr/share/ocsinventory-reports/ocsreports

cd /usr/share/ocsinventory-reports/ocsreports
rm install.php


Acesse a URL para configurar o OCS http://ipdoservidor/ocsreports


4º Caso haja página em branco, ao abrir no navegador, faça essa guia, senão pule!

Faça isso aqui e veja se dar certo:

Volte o install.php para o diretório que ele pertencia

/usr/share/ocsinventory-reports/ocsreports (TENTE ABRIR A PAGINA AGORA);

caso não abra, faça:

systemctl restart httpd.service

Caso abra, volte ao arquivo install.php e edite-o

mv install.php install-.php
systemctl restart httpd.service

Caso não abra, reinstale o pacote do OCS Inventory

yum --enablerepo=remi install ocsinventory

Caso dê certo, Acompanhe os erros no log

tail -f /var/log/httpd/error_log

Configuração do agente do OCS-Inventory no linux

Faça o download do pacote OCSNG_UNIX_AGENT-1.02.tar.gz, a versão mais recente pode ser obtida em http://www.ocsinventory-ng.org.

wget http://downloads.sourceforge.net/project/ocsinventory/OCS%20Inventory%20NG/*/Ocsinventory-Unix-Agent-*.tar.gz

Descompacte os arquivos:

tar xzvf Ocsinventory-Unix-Agent-*.tar.gz

Entre no diretório Ocsinventory-Agent-*:

cd Ocsinventory-Unix-Agent-*/

Inicie a instalação:

perl Makefile.PL

Irá aparecer a seguinte mensagem:

Please install Crypt::SSLeay if you want to use SSL.
Checking if your kit is complete...
Looks good
Writing Makefile for Ocsinventory::Agent

Gerar Binários

make

Instalar Binários

make install

Surge o Assistente:

Do you want to configure the agent [Enter]
Please enter 'y' or 'n'?> [y]
Where do you want to write the configuration file?
0 -> /etc/ocsinventory
1 -> /usr/local/etc/ocsinventory
2 -> /etc/ocsinventory-agent
?> 1
Do you want to create the directory /usr/local/etc/ocsinventory?
Please enter 'y' or 'n'?> [y]
[info] The config file will be written in /etc/ocsinventory/ocsinventory-agent.cfg,
What is the address of your ocs server?> [ocsinventory-ng] IP_CONFIGURADO_O_OCS-INVENTORY_SERVER
Do you need credential for the server? (You probably don't)
Please enter 'y' or 'n'?> [n]
Do you want to apply an administrative tag on this machine
Please enter 'y' or 'n'?> [y] n
ocsinventory agent presents: /usr/bin/ocsinventory-agent
Do yo want to install the cron task in /etc/cron.d
Please enter 'y' or 'n'?> [y]
Where do you want the agent to store its files? (You probably don't need to change it)?> [/var/lib/ocsinventory-agent]
Do you want to create the /var/lib/ocsinventory-agent directory?
Please enter 'y' or 'n'?> [y]
New settings written! Thank you for using OCS Inventory
Should I remove the old linux_agent
Please enter 'y' or 'n'?> [n]
Do you want to use OCS-Inventory software deployment feature?
Please enter 'y' or 'n'?> [y]
Do you want to use OCS-Inventory SNMP scans feature?
Please enter 'y' or 'n'?> [y]
Do you want to send an inventory of this machine?
Please enter 'y' or 'n'?> [y]
[info] Accountinfo file doesn't exist. I create an empty one.


REFERÊNCIAS

OCS-Inventory no CentOS 7 - Acessado em 4 de setembro/2017

Instalando o agente manualmente no Linux - Acessado em 4 de setembro/2017