segunda-feira, 27 de janeiro de 2020

Instalação OCS-Invetory no CentOS 7.7

OCS Inventory para CentOS 7.7

# Instalar repositório epel
yum -y install epel-release
yum update

# Instalar repositorio remi
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum update

# Instalar pacotes do yum
yum install yum-utils

# Configurar o yum para PHP 7.3
yum-config-manager --enable remi-php73 [Install PHP 7.3]

# Instalar pacotes
yum install net-tools vim wget mlocate

# Download do OCS Server 2.6 (baixar em /root)
wget https://github.com/OCSInventory-NG/OCSInventory-ocsreports/releases/download/2.6/OCSNG_UNIX_SERVER_2.6.tar.gz

# Instalar pacotes para o OCS
yum install httpd mariadb mariadb-server php php-common php-domxml php-gd php-imap php-ldap php-mbstring php-mysql php-opcache php-pdo php-pear-CAS php-pecl-apcu php-pecl-zip php-soap php-xmlrpc perl-Archive-Zip perl-Compress-Zlib perl-DBD-MySQL perl-DBI perl-Mojolicious perl-Net-IP perl-Plack perl-SOAP-Lite perl-Switch perl-XML-Entities perl-XML-Simple

# Verificar onde carrega o PHP.INI
php -i | grep "Loaded Configuration File"

# Abrir arquivo de conf do php.ini
vim /etc/php.ini

    max_execution_time = 600;   // not mandatory but advised
    register_globals = off;            // not mandatory but advised
    magic_quotes_sybase = off;
    session.auto_start = off ;
    session.use_trans_sid = 0 ;   // not mandatory but advised

# Configurar o Apache e MariaDB para start no boot
systemctl enable httpd
systemctl enable mariadb

# Iniciar o Apache e o MariaDB
systemctl start httpd
systemctl start mariadb

# Configurar o Mysql
mysql_secure_installation


# Criar o Banco para o OCS
mysql -u root -p

create database ocsweb;
CREATE USER 'ocs'@'localhost' IDENTIFIED BY 'ocs';
GRANT ALL PRIVILEGES ON ocsweb. * TO 'ocs'@'localhost' IDENTIFIED BY 'ocs';
FLUSH PRIVILEGES;


# Download do RPM do OCS Inventory
wget https://rpm.ocsinventory-ng.org/ocsinventory-release-latest.el7.ocs.noarch.rpm

# Instalar Pacote OCS Inventory
yum install ocsinventory-release-latest.el7.ocs.noarch.rpm

# Instalar Pacote OCS Inventory Server
yum install ocsinventory-server

# Descompactar o OCS NG Server que foi feito download
tar -xvzf OCSNG_UNIX_SERVER_2.6.tar.gz

# Acessar a pasta descompactada e executar a instalação
sh setup.sh

# Responda as perguntas conforme abaixo:

    Which host is running database server [localhost] ?     ## Enter ##
    On which port is running database server [3306] ?      ## Enter ##
    Where is Apache daemon binary [/usr/sbin/httpd] ?     ## Enter ##
    Where is Apache main configuration file [/etc/httpd/conf/httpd.conf] ?     ## Enter ##
    Which user account is running Apache web server [apache] ?     ## Enter ##
    Which user group is running Apache web server [apache] ?     ## Enter ##
    Where is PERL interpreter binary [/usr/bin/perl] ?     ## Enter ##
    Do you wish to setup Communication server on this computer ([y]/n)?     ## Y, 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)?     ## Y, Enter ##
    Where do you want the API code to be store [/usr/lib/perl5/vendor_perl] ?     ## Enter ##
    Do you allow Setup renaming Communication Server Apache configuration file to ‘z-ocsinventory-server.conf’ ([y]/n) ?      ## Y, Enter ##
    Checking for Administration Server directories: Do you wish to continue ([y] /n)?     ## Y, Enter ##
    Where to copy Administration Server static files for PHP Web Console [/usr/share/ocsinventory-reports]?     ## Enter ##
    Where to create writable/cache directories [/var/lib/ocsinventory-reports]?      ## Enter ##


# Reinicie o Apache
service httpd restart

# Ajustes de permissões

chmod -R 766 /usr/share/ocsinventory-reports
chown -R apache:apache /usr/share/ocsinventory-reports/
chown -R apache:apache /var/lib/ocsinventory-reports/
chcon -R -t httpd_sys_rw_content_t /usr/share/ocsinventory-reports/

# Acessar o OCS para concluir a instalação

http://IP_SERVER/ocsreports

# Inserir os dados de conexão com o banco
MySQL login: ocs
MySQL password: ocs
Name of Database: ocsweb
MySQL HostName: localhost

-> Clicar em: Send
-> Clicar em: Click here to enter OCS-NG GUI
-> Clicar em: Perform the update
-> Clicar em: Click here to enter OCS-NG GUI

# Logar na ferramenta
Login: admin
Senha: admin


# Remover script de instalação
mv /usr/share/ocsinventory-reports/ocsreports/install.php /usr/share/ocsinventory-reports/ocsreports/install.php.bck

# Ajustar senha do banco para não ficar a padrão
mysql -u root -p
update mysql.user set password = password ('chkdsk@1024') where user = 'ocs';
flush privileges;

# Edite os arquivos abaixo e ajuste a senha nova

vim /etc/httpd/conf.d/z-ocsinventory-server.conf
vim /usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php

# Reinicie o Apache

##############################################################################

CONFIGURANDO O AGENTE


 # Instalando o Agente do OCS via rede (GPO)
Crie uma GPO de Computador de Inicialização de Script...
Linha 1: \\servidor_ad\NETLOGON\OCS-Pacote\OcsPackage-estacoes.exe
Linha 2: /install /np

# Linha para o Command Line Options do OCS Packager
/S /NOW /SERVER=http://10.0.0.7/ocsinventory /NP /INSTALL /DEBUG /TAG="Computadores" /FORCE

Um comentário:

Anônimo disse...

Obrigado por complartilhar, muito me ajudou!