domingo, 30 de novembro de 2014

OCS Inventory no CentOS 7

Preparando o servidor 

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

Fonte: Maria DB

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


NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): <--ENTER
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] 
New password: <--yourmariadbpassword
Re-enter new password: <--yourmariadbpassword
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] <--ENTER
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] <--ENTER
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] <--ENTER
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] <--ENTER
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

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

Habilitando o Remi no CentOs 7

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

Verifique se o repositorio está funcionando.

yum repolist

Caso deseje desabilitar futuramento o repositorio abaixo comando utilize o comando abaixo.

yum repolist disabled

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

Concluindo 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