# Solução OCR em OVA

### Introdução

Este documento visa a orientação sobre as configurações aplicadas na máquina virtual (VM) da solução OCR versão 1.2.1 Serão apresentadas as configurações de sistema, particionamento, rede, usuários e particularidades da solução OCR.

As CGTIs devem alterar configurações para satisfazer suas necessidades locais. A DADT entrega uma versão simplificada e funcional, com exemplos, demonstrando o serviço. À partir da entrega da VM, a CGTI fica responsável por sua manutenção e uso. Não se responsabilizando a DADT por eventuais problemas decorridos de alterações realizadas pelas coordenações locais de TI dos campi.

### Características da VM

- <span style="font-weight: 400;">VM Version: 8</span>
- <span style="font-weight: 400;">CPU: 2 vCPU</span>
- <span style="font-weight: 400;">Memória: 1024 MB</span>
- Disco provisionado: 5 GB

<p class="callout warning"><span style="font-weight: 400;">O tamanho do disco é pequeno para facilitar o download e implantação da solução. Recomenda-se fortemente que **o disco seja expandido** para evitar falta de espaço em algumas partições.</span></p>

- <span style="font-weight: 400;">Sistema operacional: Debian 9.1, 64 Bits</span>
- <span style="font-weight: 400;">Sistema de armazenamento: LVM (Logical Volume Management). Utilizado por permitir flexibilidade na extensão das partições – útil para quando os discos ficam cheios e for necessário expandi-lo.</span>

<span style="font-weight: 400;">O volume físico está em </span>*<span style="font-weight: 400;">/dev/sda5</span>*<span style="font-weight: 400;">:</span>

<table id="bkmrk-%24-sudo-pvs-pv-%C2%A0%C2%A0%C2%A0" style="width: 600px; height: 97px;"><tbody><tr><td style="width: 605px;"><span style="font-weight: 400;">$ sudo pvs</span>

</td></tr><tr><td style="width: 605px;"><span style="font-weight: 400;">PV VG Fmt Attr PSize PFree</span>

<span style="font-weight: 400;">/dev/sda5 linux lvm2 a-- 4,52g 0</span>

</td></tr></tbody></table>

<span style="font-weight: 400;">Apresenta grupo de volumes (</span>*<span style="font-weight: 400;">linux</span>*<span style="font-weight: 400;">) com um volume físico e três volumes lógicos:</span>

<table id="bkmrk-%24-sudo-vgs-%C2%A0vg-%C2%A0%C2%A0" style="height: 89px;" width="600"><tbody><tr><td style="width: 599px;"><span style="font-weight: 400;">$ sudo vgs</span>

</td></tr><tr><td style="width: 599px;"><span style="font-weight: 400;"> VG #PV #LV #SN Attr VSize VFree</span>

<span style="font-weight: 400;"> linux 1 3 0 wz--n- 4,52g 0</span>

</td></tr></tbody></table>

<span style="font-weight: 400;">Volumes lógicos são </span>*<span style="font-weight: 400;">root</span>*<span style="font-weight: 400;">, </span>*<span style="font-weight: 400;">srv</span>*<span style="font-weight: 400;"> e </span>*<span style="font-weight: 400;">swap</span>*<span style="font-weight: 400;">:</span>

<table id="bkmrk-%24-sudo-lvs-%C2%A0lv-%C2%A0%C2%A0" style="height: 150px;" width="600"><tbody><tr><td style="width: 599px;"><span style="font-weight: 400;">$ sudo lvs</span>

</td></tr><tr><td style="width: 599px;"><span style="font-weight: 400;"> LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert</span>

<span style="font-weight: 400;"> root linux -wi-ao---- 3,11g</span>

<span style="font-weight: 400;"> srv linux -wi-ao---- 956,00m</span>

<span style="font-weight: 400;"> swap linux -wi-ao---- 488,00m</span>

</td></tr></tbody></table>

<span style="font-weight: 400;">Visão geral do sistema de arquivos:</span>

<table id="bkmrk-%24-df--hp-sist.-arq.-" style="height: 290px;" width="600"><tbody><tr><td style="width: 599px;"><span style="font-weight: 400;">$ df -hP</span>

</td></tr><tr><td style="width: 599px;"><span style="font-weight: 400;">Sist. Arq. Tam. Usado Disp. Uso% Montado em</span>

<span style="font-weight: 400;">udev 487M 0 487M 0% /dev</span>

<span style="font-weight: 400;">tmpfs 100M 4,6M 96M 5% /run</span>

<span style="font-weight: 400;">/dev/mapper/linux-root 3,0G 2,2G 725M 75% /</span>

<span style="font-weight: 400;">tmpfs 499M 0 499M 0% /dev/shm</span>

<span style="font-weight: 400;">tmpfs 5,0M 0 5,0M 0% /run/lock</span>

<span style="font-weight: 400;">tmpfs 499M 0 499M 0% /sys/fs/cgroup</span>

**/dev/mapper/linux-srv 925M 2,4M 859M 1% /srv**

<span style="font-weight: 400;">/dev/sda1 472M 37M 411M 9% /boot</span>

<span style="font-weight: 400;">tmpfs 100M 0 100M 0% /run/user/1000</span>

</td></tr></tbody></table>

- <span style="font-weight: 400;">Configurações de rede. Os IPs devem ser trocados de acordo com a rede de cada campi:</span>

<table id="bkmrk-%24-nano-%2Fetc%2Fnetwork%2F" style="height: 316px;" width="350"><tbody><tr><td style="width: 349px;"><span style="font-weight: 400;">$ nano /etc/network/interfaces</span>

</td></tr><tr><td style="width: 349px;"><span style="font-weight: 400;">\# A interface de loopback</span>

<span style="font-weight: 400;">auto lo</span>

<span style="font-weight: 400;">iface lo inet loopback</span>

<span style="font-weight: 400;">\# A interface de rede primaria</span>

<span style="font-weight: 400;">auto ens33</span>

<span style="font-weight: 400;">allow-hotplug ens33</span>

<span style="font-weight: 400;">iface ens33 inet static</span>

<span style="font-weight: 400;"> address 172.16.1.10/24</span>

<span style="font-weight: 400;"> gateway 172.16.1.1</span>

<span style="font-weight: 400;"> dns-nameservers 172.16.1.6</span>

<span style="font-weight: 400;"> dns-search ifpe.edu.br</span>

</td></tr></tbody></table>

Informações das interfaces:

<table id="bkmrk-%24-ip-a-1%3A-lo%3A-%3Cloopb" style="height: 320px;" width="600"><tbody><tr><td style="width: 686px;"><span style="font-weight: 400;">$ ip a</span>

</td></tr><tr><td style="width: 686px;"><span style="font-weight: 400;">1: lo: &lt;LOOPBACK,UP,LOWER\_UP&gt; mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1</span>

<span style="font-weight: 400;"> link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00</span>

<span style="font-weight: 400;"> inet 127.0.0.1/8 scope host lo</span>

<span style="font-weight: 400;"> valid\_lft forever preferred\_lft forever</span>

<span style="font-weight: 400;"> inet6 ::1/128 scope host</span>

<span style="font-weight: 400;"> valid\_lft forever preferred\_lft forever</span>

<span style="font-weight: 400;">2: ens33: &lt;BROADCAST,MULTICAST,UP,LOWER\_UP&gt; mtu 1500 qdisc pfifo\_fast state UP group default qlen 1000</span>

<span style="font-weight: 400;"> link/ether </span>**00:0c:29:94:08:8d**<span style="font-weight: 400;"> brd ff:ff:ff:ff:ff:ff</span>

<span style="font-weight: 400;"> inet 172.16.1.10/24 brd 172.16.1.255 scope global ens33</span>

<span style="font-weight: 400;"> valid\_lft forever preferred\_lft forever</span>

</td></tr></tbody></table>

- <span style="font-weight: 400;">Usuários ativos. Sugere-se a troca das senhas:</span>

<table id="bkmrk-usu%C3%A1rio-%C2%A0senha-cgt" style="width: 350px; height: 118px;"><tbody><tr><td style="width: 174.5px;"><span style="font-weight: 400;">Usuário</span>

</td><td style="width: 174.5px;"><span style="font-weight: 400;"> Senha</span>

</td></tr><tr><td style="width: 174.5px;"><span style="font-weight: 400;">cgti</span>

</td><td style="width: 174.5px;"><span style="font-weight: 400;">\*@tif0cr</span>

</td></tr><tr><td style="width: 174.5px;"><span style="font-weight: 400;">root</span>

</td><td style="width: 174.5px;"><span style="font-weight: 400;">&amp;\_p0i3TJ</span>

</td></tr></tbody></table>

<span style="font-weight: 400;">Grupos ativos:</span>

<table id="bkmrk-grupo-usu%C3%A1rio-membr" style="height: 153px;" width="350"><tbody><tr><td style="width: 174px;"><span style="font-weight: 400;">Grupo</span>

</td><td style="width: 175px;"><span style="font-weight: 400;">Usuário membro</span>

</td></tr><tr><td style="width: 174px;"><span style="font-weight: 400;">cgti</span>

</td><td style="width: 175px;"><span style="font-weight: 400;">cgti</span>

</td></tr><tr><td style="width: 174px;"><span style="font-weight: 400;">root</span>

</td><td style="width: 175px;"><span style="font-weight: 400;">root, cgti</span>

</td></tr><tr><td style="width: 174px;"><span style="font-weight: 400;">sudo</span>

</td><td style="width: 175px;"><span style="font-weight: 400;">root, cgti</span>

</td></tr></tbody></table>

- <span style="font-weight: 400;">O diretório mapeado como exemplo para OCR é </span><span style="font-weight: 400;">/srv/shares/cgti/ocr/entrada/</span><span style="font-weight: 400;">. A CGTI deve criar os novos diretórios e mapeamentos de acordo com a sua necessidade. </span>

<span style="font-weight: 400;">A estrutura dos diretórios:</span>

<table id="bkmrk-%24-tree-%2Fsrv-%2Fsrv-%E2%94%94" style="height: 220px;" width="350"><tbody><tr><td style="width: 349px;"><span style="font-weight: 400;">$ tree /srv</span>

</td></tr><tr><td style="width: 349px;"><span style="font-weight: 400;">/srv</span>

<span style="font-weight: 400;">└── shares</span>

<span style="font-weight: 400;"> ├── cgti</span>

<span style="font-weight: 400;"> └── ocr</span>

<span style="font-weight: 400;"> ├── </span>**entrada**

<span style="font-weight: 400;"> ├── originais</span>

<span style="font-weight: 400;"> └── saida</span>

</td></tr></tbody></table>

*<span style="font-weight: 400;">Trigger</span>*<span style="font-weight: 400;"> do Watchman criada para o diretório em questão:</span>

<table id="bkmrk-%24-cat-%2Fusr%2Flocal%2Fvar" style="height: 817px;" width="349"><tbody><tr><td style="width: 348px;"><span style="font-weight: 400;">$ cat /usr/local/var/run/watchman/root-state/state</span>

</td></tr><tr><td style="width: 348px;"><span style="font-weight: 400;">{</span>

<span style="font-weight: 400;"> "watched": \[</span>

<span style="font-weight: 400;"> {</span>

<span style="font-weight: 400;"> "triggers": \[</span>

<span style="font-weight: 400;"> </span>**{**

 **"command": \[**

 **"/srv/doOcr.sh"**

 **\],**

<span style="font-weight: 400;"> "expression": \[</span>

<span style="font-weight: 400;"> "anyof",</span>

<span style="font-weight: 400;"> \[</span>

<span style="font-weight: 400;"> "match",</span>

<span style="font-weight: 400;"> </span> **"\*.pdf",**

<span style="font-weight: 400;"> "wholename"</span>

<span style="font-weight: 400;"> \]</span>

<span style="font-weight: 400;"> \],</span>

<span style="font-weight: 400;"> "stdin": \[</span>

<span style="font-weight: 400;"> "name",</span>

<span style="font-weight: 400;"> "exists",</span>

<span style="font-weight: 400;"> "new",</span>

<span style="font-weight: 400;"> "size",</span>

<span style="font-weight: 400;"> "mode"</span>

<span style="font-weight: 400;"> \],</span>

<span style="font-weight: 400;"> "name": "ocrTrigCgti",</span>

<span style="font-weight: 400;"> "append\_files": true</span>

<span style="font-weight: 400;"> }</span>

<span style="font-weight: 400;"> \],</span>

<span style="font-weight: 400;"> </span>**"path": "/srv/shares/cgti/ocr/entrada"**

<span style="font-weight: 400;"> }</span>

<span style="font-weight: 400;"> \],</span>

<span style="font-weight: 400;"> "version": "4.9.0"</span>

<span style="font-weight: 400;">}</span>

</td></tr></tbody></table>

<span style="font-weight: 400;">Arquivo do Watchman para configuração presente de forma obrigatória no diretório “entrada”:</span>

<table id="bkmrk-%24-cat-%2Fsrv%2Fshares%2Fcg" style="height: 73px;" width="350"><tbody><tr><td style="width: 349px;"><span style="font-weight: 400;">$ cat /srv/shares/cgti/ocr/entrada/.watchmanconfig</span>

</td></tr><tr><td style="width: 349px;"><span style="font-weight: 400;">{"settle": 10000} </span>

</td></tr></tbody></table>

### Como importar a VM no ambiente VMWARE

Neste método de importação será utilizado o ambiente vSphere Client versão 6.0.0, disponível em [https://kb.vmware.com/s/article/2089791](https://kb.vmware.com/s/article/2089791). O ESXi utilizado é da versão 6.5.0. Certifique-se de ter instalado o vSphere Client na sua máquina para ter sucesso neste método.

Baixe a OVA: [https://drive.google.com/file/d/1E20S31VW41\_Pu9jc\_MTfURKJRmmmmi2C/view?usp=sharing](https://drive.google.com/file/d/1E20S31VW41_Pu9jc_MTfURKJRmmmmi2C/view?usp=sharing)

<span style="font-weight: 400;">Realize o </span>*<span style="font-weight: 400;">login</span>*<span style="font-weight: 400;"> no ambiente com suas credenciais:</span>

 [![image7.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image7.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image7.png)

<span style="font-weight: 400;">Após logar, clique em </span>*<span style="font-weight: 400;">File</span>*<span style="font-weight: 400;"> e em seguida, clique </span>*<span style="font-weight: 400;">Deploy OVF Template</span>*<span style="font-weight: 400;">:</span>

<span style="font-weight: 400;">[![image2.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image2.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image2.png)</span>

Na próxima janela, clique em Browse para procurar o arquivo OVA:

[![image9.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image9.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image9.png)&lt;&gt;

<span style="font-weight: 400;">Selecione o arquivo e clique em Abrir:</span>

<span style="font-weight: 400;">[![image1.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image1.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image1.png)</span>

<span style="font-weight: 400;">Na próxima janela clique em </span>*<span style="font-weight: 400;">Next</span>*<span style="font-weight: 400;">, e observe os detalhes da VM:</span>

<span style="font-weight: 400;">[![image4.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image4.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image4.png)</span>

<span style="font-weight: 400;">Selecione o nome desejado para VM e clique em </span>*<span style="font-weight: 400;">Next</span>*<span style="font-weight: 400;">.</span>

<span style="font-weight: 400;">[![image5.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image5.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image5.png)</span>

<span style="font-weight: 400;">Selecione o </span>*<span style="font-weight: 400;">storage</span>*<span style="font-weight: 400;"> do ESXi no qual os arquivos do objeto da VM serão armazenados e clique </span>*<span style="font-weight: 400;">Next</span>*<span style="font-weight: 400;">. Na janela seguinte, clique </span>*<span style="font-weight: 400;">Next</span>*<span style="font-weight: 400;"> mais uma vez.</span>

<span style="font-weight: 400;">[![image11.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image11.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image11.png)</span>

<span style="font-weight: 400;">Agora realize o mapeamento da rede interna criada no ESXi. Na coluna </span>*<span style="font-weight: 400;">Destination Networks</span>*<span style="font-weight: 400;"> deverá existir o nome da rede aplicada no ESXi local, selecione apropriadamente de acordo com o seu ambiente. No caso em tela, a rede de destino possui o mesmo nome.</span>

<span style="font-weight: 400;">[![image3.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image3.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image3.png)</span>

<span style="font-weight: 400;">Estamos quase lá, agora observe as configurações selecionadas. Clique em </span>*<span style="font-weight: 400;">Finish</span>*<span style="font-weight: 400;"> quando tiver certeza do que será aplicado.</span>

<span style="font-weight: 400;">[![image10.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image10.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image10.png)</span>

<span style="font-weight: 400;">A VM começará a ser importada:</span>

<span style="font-weight: 400;">[![image12.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image12.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image12.png)</span>

<span style="font-weight: 400;">A operação pode levar algum tempo. A seguinte tela surge quando concluído.</span>

<span style="font-weight: 400;">[![image6.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image6.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image6.png)</span>

<span style="font-weight: 400;">Pronto, a VM está pronta para uso.</span>

<span style="font-weight: 400;">[![image8.png](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/scaled-840-0/image8.png)](https://wiki.ifpe.edu.br/uploads/images/gallery/2018-04-Apr/image8.png)</span>