Offline LLM Deployment on a Personal Computer: From Environment Setup to First Inference
A practical guide to running a large language model locally on a personal computer without network inference. It covers hardware and model-size checks, installing Ollama, configuring the listening address and firewall rules, downloading and loading a model, running three verification tests, and troubleshooting common issues.
1. Define What This Deployment Needs to Do
Run the model locally so that inference does not go through the network. This is suitable for processing text containing private information, writing in offline environments, and debugging prompts or running integration tests. The goal of this article is to complete a full deployment on a personal computer and confirm that it works with commands.
The process has five steps: check hardware and system, install the inference service, configure the listening address and security policy, download and load the model, and finally verify and troubleshoot. This article uses Ollama as the inference service. It supports Windows, macOS, and Linux and provides a local HTTP interface.
2. Check Hardware and System
2.1 Hardware Checklist
Local inference mainly consumes memory (or GPU VRAM), and model files also take up disk space. Before starting, check each item in the table below.
| Item | Minimum recommendation | Recommended configuration | How to check |
|---|---|---|---|
| Memory | 16GB | 32GB or more | On Windows, open Task Manager; on macOS, choose Apple menu > About This Mac; on Linux, run free -h |
| GPU VRAM | No discrete GPU is also usable via CPU, but slower | 8GB or more | For NVIDIA GPUs, run nvidia-smi |
| Free disk space | 20GB | 50GB or more | On Linux or macOS, run df -h; on Windows, check This PC |
| Operating system | Windows 10/11, macOS, Ubuntu 22.04 or later | Keep the system up to date | Refer to the system requirements listed on the official Ollama website |
2.2 How to Choose Model Size
Model size is expressed by parameter count. For example, 7B means about 7 billion parameters. More parameters usually mean better answer quality, but also more resource usage. Quantization stores parameters as lower-precision values, which can significantly reduce memory usage at the cost of a slight loss in precision.
The estimate is: number of parameters (in hundreds of millions) × quantization bits ÷ 8, then multiply by about 1.2 as runtime headroom. The table below gives rough estimates based on 4-bit quantization (Q4).
| Parameter count | Approximate memory or VRAM usage | Suitable computer | Typical use |
|---|---|---|---|
| 1.5B to 3B | About 2GB | Old laptop, CPU only | Simple Q&A, text rewriting |
| 7B to 8B | About 5GB | Ordinary computer with 16GB RAM | Daily writing, information organization |
| 14B | About 9GB | 32GB RAM or 12GB VRAM | More complex reasoning and long-form writing |
| 32B | About 20GB | High-end workstation | Professional scenarios requiring higher quality |
These numbers depend on context length, quantization method, and runtime framework, so they are only for reference. For actual usage, check the result of ollama ps after deployment. Beginners should start with a 7B or 8B model.
3. Install the Inference Service
3.1 Install Ollama
Windows users can open PowerShell and run:
winget install Ollama.Ollama
macOS users can download the installer from the official Ollama website or use Homebrew:
brew install ollamabrew services start ollama
Linux users should first confirm the installation script address on the official Ollama website, then run the official installation command. After installation, run the following command to check the version:
ollama --version
If the version number is displayed normally, the installation is successful.
3.2 Start the Service
After installation on Windows and macOS, Ollama runs automatically in the background, and an Ollama icon appears in the taskbar tray or menu bar. The Linux installation script usually registers it as a system service. You can check the status with:
systemctl status ollama
If you need to start it manually in the foreground, run:
ollama serve
By default, the service listens on 127.0.0.1:11434, which can only be accessed from the local machine. This is the recommended initial state.
4. Configure the Listening Address and Security Policy
4.1 Allow Only Local Access by Default
After deployment, keep the default settings first. Modify the listening address only when other devices on the LAN really need to call the service.
Changing the listening address changes the access scope, not the model capability. If you set the address to 0.0.0.0:11434, devices on the same LAN may be able to connect to the service.
4.2 Steps to Open LAN Access
First, set the environment variable OLLAMA_HOST=0.0.0.0:11434, then restart the service. On Linux, you can run sudo systemctl edit ollama.service and add the following to the opened file:
[Service]Environment="OLLAMA_HOST=0.0.0.0:11434"
After saving, run sudo systemctl restart ollama.
Second, allow only trusted network segments to access port 11434. Suppose your LAN segment is 192.168.1.0/24. Windows users can run the following in an administrator PowerShell:
New-NetFirewallRule -DisplayName "Ollama LAN" -Direction Inbound -Protocol TCP -LocalPort 11434 -RemoteAddress 192.168.1.0/24 -Action Allow
Linux users can use ufw:
sudo ufw allow from 192.168.1.0/24 to any port 11434 proto tcp
4.3 Security Notes
Ollama itself has no login authentication. After LAN access is opened, any device that can connect may call the model and consume your computing resources. Therefore, follow these rules:
- Do not configure port mapping on the router, and do not expose port 11434 to the public internet.
- When cross-network access is needed, prefer a VPN or SSH tunnel.
- If multiple users really need access, add a reverse proxy with authentication in front, such as Nginx with an account password or client certificate.
- After use, restore the address to
127.0.0.1and delete firewall rules that are no longer needed.
5. Download and Load the Model
5.1 Pull the Model
This article uses qwen2.5:7b as an example. Run:
ollama pull qwen2.5:7b
After the download is complete, run ollama list to see the model name, size, and update time. The part after the colon in the model name is the version tag, which determines the parameter scale and quantization level. Pull only from the official model library, and keep the summary information in the download output for later verification.
5.2 Model Storage Location
By default, models are stored in .ollama/models under the user directory. If the system disk is short on space, you can set the environment variable OLLAMA_MODELS to point to a directory on another disk. After changing it, restart the service and confirm that the directory has enough free space.
5.3 What to Do When VRAM or Memory Is Insufficient
If the model fails to load, or becomes noticeably slow after running, you can take the following steps:
- Switch to a model with fewer parameters, for example from 14B to 7B.
- Choose a lower-precision quantization version; the tag usually contains
q4orq3. - Close other programs that consume memory, especially browsers and video software.
- Shorten the length of a single input.
6. Three Types of Tests to Verify the Deployment
You can use the following three types of tests to determine whether the deployment is successful.
6.1 Service Connectivity Test
Run:
curl http://127.0.0.1:11434/
The expected output is Ollama is running. If the connection is refused, the service has not started.
6.2 Model List Test
Run:
curl http://127.0.0.1:11434/api/tags
The returned JSON should contain qwen2.5:7b. If the list is empty, go back to Section 5 and pull the model again.
6.3 First Inference Test
Run:
curl http://127.0.0.1:11434/api/generate -d '{"model":"qwen2.5:7b","prompt":"用一句话介绍你自己","stream":false}'
A response in Chinese is expected within seconds to tens of seconds, depending on the hardware. Then run ollama ps to see that the model is loaded. If the PROCESSOR column shows GPU, the GPU is being used; if it shows CPU, only the processor is being used.
For LAN verification, run the same command on another device after replacing 127.0.0.1 with the LAN IP address of the service computer. If the connection fails, first check the firewall rules and the OLLAMA_HOST setting.
7. Troubleshooting Common Issues
| Symptom | Possible cause | Handling | |
|---|---|---|---|
| Connection refused | Service is not running | On Linux, run systemctl status ollama; on Windows and macOS, check the tray or menu bar icon |
|
| Startup fails, port in use | Another program is using port 11434 | On Windows, run `netstat -ano \ | findstr 11434; on Linux and macOS, runlsof -i :11434` |
| Works locally, but LAN devices cannot connect | The listening address is still 127.0.0.1, or the firewall is blocking access | Check the OLLAMA_HOST setting and confirm that the firewall rule uses the correct source subnet |
|
| Out of memory during loading | The model exceeds the hardware capacity | Use a smaller model or a lower quantization version | |
| Model not found | The model name or tag is wrong, or the model has not been downloaded | Run ollama list to check, and run ollama pull again if necessary |
|
| Very slow responses | The model is running only on CPU, or memory shortage causes frequent swapping | Run ollama ps to check the PROCESSOR column, and use a smaller model |
|
| Download fails midway | Unstable network or insufficient disk space | Check free disk space and run ollama pull again; already downloaded parts will be reused |
When troubleshooting, check the service logs. On Linux, run journalctl -u ollama -n 100; on macOS, check ~/.ollama/logs/server.log; on Windows, check %LOCALAPPDATA%\Ollama\server.log. The logs usually state the cause of the failure, such as a port conflict or insufficient VRAM.
8. Stop the Service and Release Resources
If you only want to release the memory occupied by the model, run ollama stop qwen2.5:7b. The service itself remains running.
If you need to stop the service completely, on Linux run sudo systemctl stop ollama; on Windows and macOS, exit Ollama from the tray or menu bar. After stopping, remember to clean up the firewall rules added for LAN access and restore OLLAMA_HOST to the default value.
Summary
Following the order in this article, you can first check memory and hardware against the recommended configurations, then install the inference service, configure the listening address and security policy, download and load a model, and finally run the three verification tests and use the troubleshooting table if needed.
