Run your own AI server with OllamaRode seu próprio servidor de IA com Ollama
One computer with a graphics card serves the models. Every other machine on the network, and even your phone, uses them through a private assistant. Documents and websites are indexed on your hardware and nothing is sent to a cloud service.Um computador com placa de vídeo serve os modelos. Todas as outras máquinas da rede, e até o seu celular, usam esses modelos por meio de um assistente privado. Documentos e sites são indexados no seu hardware e nada é enviado para a nuvem.
What you buildO que você monta
- An Ollama server running on the GPU, reachable by the whole networkUm servidor Ollama rodando na GPU, acessível por toda a rede
- A document assistant (AnythingLLM) that reads files and websitesUm assistente de documentos (AnythingLLM) que lê arquivos e sites
- Optional secure access from outside your home or officeAcesso externo seguro, opcional, de fora de casa ou do escritório
What you needO que você precisa
- A PC with an Nvidia GPU (8 GB of VRAM or more is comfortable)Um PC com GPU Nvidia (8 GB de VRAM ou mais é confortável)
- Windows, Linux or macOS; the steps are the sameWindows, Linux ou macOS; os passos são os mesmos
- Computers on the same local networkComputadores na mesma rede local
Ollama, Docker, AnythingLLM, ngrok
How the pieces fitComo as peças se encaixam
The server runs Ollama and exposes one HTTP API on port 11434. Clients never touch the model directly: they talk to that API, either from AnythingLLM on the LAN or through a tunnel from the internet.O servidor roda o Ollama e expõe uma API HTTP na porta 11434. Os clientes nunca acessam o modelo diretamente: eles falam com essa API, pelo AnythingLLM na rede local ou por um túnel vindo da internet.
1. Install Ollama1. Instale o Ollama
Ollama has a native installer for Windows, macOS and Linux, and that is the simplest route. Download it from ollama.com and it starts a background service on port 11434. Docker is a good choice if you want it isolated or already run other containers.O Ollama tem instalador nativo para Windows, macOS e Linux, e esse é o caminho mais simples. Baixe em ollama.com e ele inicia um serviço em segundo plano na porta 11434. O Docker é uma boa escolha se você quer isolar o serviço ou já usa outros contêineres.
Option A: Docker with GPUOpção A: Docker com GPU
Install Docker Desktop on Windows, or Docker Engine on Linux plus the NVIDIA Container Toolkit. Then start the server:Instale o Docker Desktop no Windows, ou o Docker Engine no Linux com o NVIDIA Container Toolkit. Depois, inicie o servidor:
# start Ollama with GPU access and a persistent volumeinicia o Ollama com acesso à GPU e volume persistente
docker run -d --gpus=all -v ollama:/root/.ollama \
-p 11434:11434 --name ollama ollama/ollamaOption B: native install on LinuxOpção B: instalação nativa no Linux
curl -fsSL https://ollama.com/install.sh | shLet other computers reach itLibere o acesso para outros computadores
By default Ollama listens only on localhost. Set the host variable so it accepts connections from the network, then restart the service. With Docker, the port mapping above already does this.Por padrão, o Ollama escuta apenas em localhost. Defina a variável de host para aceitar conexões da rede e reinicie o serviço. Com Docker, o mapeamento de porta acima já resolve isso.
# Linux (systemd): add the variable and restartLinux (systemd): adicione a variável e reinicie
sudo systemctl edit ollama # add: Environment="OLLAMA_HOST=0.0.0.0"adicione: Environment="OLLAMA_HOST=0.0.0.0"
sudo systemctl restart ollama
# Windows (PowerShell): set it for your user, then quit and reopen OllamaWindows (PowerShell): defina para o seu usuário e reabra o Ollama
setx OLLAMA_HOST "0.0.0.0"2. Choose and download a model2. Escolha e baixe um modelo
The original version of this guide used Llama 3.1. It still works, but newer open models are better for the same memory. Pick by VRAM and try a couple; switching is one command.A versão original deste guia usava o Llama 3.1. Ele ainda funciona, mas modelos abertos mais novos rendem mais com a mesma memória. Escolha pela VRAM e teste alguns; trocar de modelo é um comando.
# general chat, good starting point on 8 to 12 GB of VRAMchat geral, bom ponto de partida com 8 a 12 GB de VRAM
docker exec -it ollama ollama pull qwen3:8b
# alternatives: gemma3:12b, llama3.3, gpt-oss:20b (needs about 16 GB)alternativas: gemma3:12b, llama3.3, gpt-oss:20b (precisa de cerca de 16 GB)
# embedding model for document search (used by AnythingLLM)modelo de embeddings para busca em documentos (usado pelo AnythingLLM)
docker exec -it ollama ollama pull nomic-embed-text
# confirm the GPU is being used while a model is loadedconfirme que a GPU está em uso com um modelo carregado
docker exec -it ollama ollama ps
nvidia-smiWithout Docker, drop the docker exec -it ollama prefix. In ollama ps, the Processor column should say 100% GPU. If it shows CPU, update the Nvidia driver and restart the service.Sem Docker, remova o prefixo docker exec -it ollama. No ollama ps, a coluna Processor deve mostrar 100% GPU. Se mostrar CPU, atualize o driver da Nvidia e reinicie o serviço.
Test the API from another computer, replacing the address with your server’s IP:Teste a API a partir de outro computador, trocando o endereço pelo IP do seu servidor:
curl http://192.168.1.50:11434/api/generate -d '{
"model": "qwen3:8b", "prompt": "Say hello in one sentence.", "stream": false }'3. Build the assistant with AnythingLLM3. Monte o assistente com o AnythingLLM
AnythingLLM is now a ready-made desktop app (Windows, macOS, Linux) and also runs in Docker, so no Python setup is needed. Install it on a client computer, or run it once on the server and open it from any browser.O AnythingLLM agora é um aplicativo de desktop pronto (Windows, macOS, Linux) e também roda em Docker, então não precisa configurar Python. Instale em um computador cliente, ou rode uma vez no servidor e abra de qualquer navegador.
- In the first-run setup choose Ollama as the LLM provider.Na configuração inicial, escolha Ollama como provedor de LLM.
- Set the base URL to
http://SERVER-IP:11434and select the chat model you pulled.Defina a URL base comohttp://IP-DO-SERVIDOR:11434e selecione o modelo de chat que você baixou. - For embeddings, choose Ollama again with
nomic-embed-text.Para embeddings, escolha o Ollama de novo com onomic-embed-text. - Leave the vector database on the built-in default, which stores everything on local disk.Deixe o banco vetorial no padrão embutido, que guarda tudo no disco local.
Teach it your documents and websitesEnsine seus documentos e sites
- Create a workspace for one subject, such as “Contracts” or “Home lab”.Crie um workspace para cada assunto, como “Contratos” ou “Home lab”.
- Upload PDFs, Word, text or spreadsheets, or paste a website URL for the built-in scraper.Envie PDFs, arquivos Word, texto ou planilhas, ou cole a URL de um site para o coletor embutido.
- Move the items into the workspace and click Save and embed.Mova os itens para o workspace e clique em Save and embed.
- Ask questions. Answers cite the passages they used, so you can check them.Faça perguntas. As respostas citam os trechos usados, para você poder conferir.
Everything is stored on disk, so the knowledge is still there after a restart. For scripts or your own interface, AnythingLLM also offers a developer API, or you can call Ollama directly.Tudo fica salvo em disco, então o conhecimento continua lá depois de reiniciar. Para scripts ou para a sua própria interface, o AnythingLLM também oferece uma API de desenvolvedor, ou você pode chamar o Ollama diretamente.
4. Reach it from outside4. Acesse de fora da rede
A tunnel gives your server a public address without opening ports on the router. ngrok is the quickest to try:Um túnel dá ao servidor um endereço público sem abrir portas no roteador. O ngrok é o mais rápido para testar:
ngrok config add-authtoken YOUR_TOKEN
ngrok http 11434 --host-header="localhost:11434"ngrok prints an https://….ngrok-free.app address. Use it anywhere you would use the local URL, including in AnythingLLM on another network. The --host-header flag is needed because Ollama rejects requests whose host name it does not recognise.O ngrok mostra um endereço https://….ngrok-free.app. Use-o onde você usaria a URL local, inclusive no AnythingLLM em outra rede. O parâmetro --host-header é necessário porque o Ollama rejeita requisições com um nome de host que ele não reconhece.
ConclusionConclusão
You now have a private AI stack: Ollama serves the models on your GPU, AnythingLLM turns them into an assistant that learns from your documents and sites, and a tunnel lets you use it away from home. The data stays on your hardware, and you can swap in a better model whenever one is released.Agora você tem uma pilha de IA privada: o Ollama serve os modelos na sua GPU, o AnythingLLM os transforma em um assistente que aprende com seus documentos e sites, e um túnel permite usar tudo longe de casa. Os dados ficam no seu hardware, e você pode trocar por um modelo melhor sempre que sair um.
This setup is the base for my own assistant. See Aura, which uses Ollama for local conversation.Esta configuração é a base do meu próprio assistente. Veja a Aura, que usa o Ollama para conversar localmente.
Want a private AI server like this?Quer um servidor de IA privado como este?
Tell me what you want to build or automate. I answer with questions, not a sales pitch.Conte o que você quer construir ou automatizar. Eu respondo com perguntas, não com proposta de vendas.
me@rcjr.online