Local LLM Deployment on a PC: Installation, LAN Access, and Validation

    Cloud-based large language model (LLM) APIs offer convenience but often raise concerns regarding data privacy, network latency, and long-term API costs. Running models locally mitigates these issues. This article provides a step-by-step guide to deploying a 7-billion-parameter (7B) model locally using the open-source tool Ollama. It covers pre-installation requirements, service setup, model execution, local area network (LAN) configuration, and functional validation to ensure a stable and secure local AI environment.

    Introduction

    Cloud-based LLM APIs are convenient but require uploading data to third-party servers, suffer from unstable network latency, and incur ongoing per-usage costs. Running a model on your own computer keeps sensitive text local and eliminates metered billing.

    This article uses the open-source tool Ollama as an example to deploy an approximately 7-billion-parameter (7B) model on a personal computer, including setting up LAN access and functional validation. This approach is suitable for daily Q&A, text processing, and local knowledge base prototyping. For high-concurrency services, long-running batch inference, or maximum model performance, professional servers or cloud services are recommended.

    1. Pre-installation Requirements

    Before installation, ensure your computer meets the following conditions:

    • Memory: At least 8GB of RAM for CPU-only execution; 16GB is recommended for stability.
    • GPU (Optional): NVIDIA, AMD, or Apple Silicon GPUs can accelerate inference. A GPU with 6GB or more of VRAM can hold the entire 7B model in memory.
    • Disk Space: Reserve at least 10GB of available space for the installer and model files.
    • OS: This article primarily uses a common Linux distribution as an example. macOS and Windows users can download the corresponding installation packages from the official website; the subsequent model commands are identical.

    2. Installing Ollama

    On Linux, you can download the installation script first, review its contents, and then execute it for better security:

    1. curl -fsSL https://ollama.com/install.sh -o install.sh
    2. less install.sh
    3. sh install.sh

    The installation script creates a system service named ollama. Once installed, run the following commands to verify the version and service status:

    1. ollama --version
    2. systemctl status ollama
    3. curl http://127.0.0.1:11434/api/version

    The third command should return a JSON response like {"version":"..."}, indicating that the service is running on local port 11434. macOS and Windows users can verify the service using the same address after installing the application.

    3. Pulling and Running the 7B Model

    This guide uses qwen2.5:7b, a general-purpose bilingual model available in the Ollama model library. Run the following command to download the model:

    1. ollama pull qwen2.5:7b
    2. ollama list

    This version utilizes 4-bit quantization, and the file size is approximately 4.7GB according to the model library. Quantization reduces precision to lower memory usage, which is acceptable for most daily tasks. Before downloading, verify the parameter count, file size, and license on the official Ollama model page, as this information may change with version updates.

    Start an interactive chat session:

    1. ollama run qwen2.5:7b

    Once in the interactive interface, type /bye to exit. After the model loads, you can run ollama ps to check its memory or VRAM usage and the CPU-to-GPU allocation ratio. If most computation is handled by the CPU, inference speeds will significantly decrease. In this case, consider switching to a smaller model, such as qwen2.5:3b.

    4. Configuring LAN Access

    By default, Ollama only listens on 127.0.0.1. While local programs can access it, other devices cannot connect. To allow access from a mobile phone or another computer, you need to modify the listening address.

    Ollama does not include built-in user authentication. Anyone who can reach this port can invoke the model and consume your computing resources. Therefore, it is not recommended to listen directly on 0.0.0.0. A safer approach is to bind only to your machine’s LAN IP and restrict accessible network segments using a firewall.

    First, find your machine’s LAN address (e.g., 192.168.1.50):

    1. hostname -I

    Next, create a systemd override configuration. This method avoids modifying the official service file:

    1. sudo systemctl edit ollama.service

    In the editor that opens, write the following content, replacing the IP with your own address:

    1. [Service]
    2. Environment="OLLAMA_HOST=192.168.1.50:11434"

    Save the file, reload the configuration, and restart the service:

    1. sudo systemctl daemon-reload
    2. sudo systemctl restart ollama
    3. sudo ss -tlnp | grep 11434

    The output of ss should show the listening address as 192.168.1.50:11434. Next, allow access only from trusted network segments. Using UFW as an example, replace the subnet with your actual LAN subnet:

    1. sudo ufw allow from 192.168.1.0/24 to any port 11434 proto tcp
    2. sudo ufw status

    If UFW is not yet enabled, run sudo ufw allow ssh first to prevent remote login disconnection when the firewall is enabled, and then run sudo ufw enable.

    Test the connection from another device on the same network segment:

    1. curl http://192.168.1.50:11434/api/tags

    A returned list of models indicates that LAN access is successfully configured.

    Security Reminder: If you need to provide external network access, share with multiple users, or expose a public service, you should place a reverse proxy (such as Nginx or Caddy) in front of Ollama. The reverse proxy should handle HTTPS encryption and authentication, while Ollama itself only listens on local or internal network addresses. Never map port 11434 directly to a public router.

    5. Functional Validation

    Once the model is loaded, use the following three tests to verify normal operation. Each test includes specific pass criteria to avoid subjective judgments.

    1. Instruction Following Test: Input “Please explain the benefits of locally deploying large models in three bullet points, with each point under 20 words.” Pass criteria: Outputs exactly three bullet points, and the word count of each meets the requirement.
    2. Chinese Language Test: Input “请用通俗的中文解释什么是过拟合。” (Explain what overfitting is in plain Chinese.) Pass criteria: Fluent phrasing, no garbled text, and a fundamentally correct explanation of the concept.
    3. Arithmetic Test: Input “Calculate 345 multiplied by 12, output only the result.” Expected result is 4140. Large models may make errors in multi-digit arithmetic; if the result is incorrect, try another problem.

    Identity-based questions (e.g., “Who are you?”) are not suitable for validation. Smaller models often contradict themselves, so this article does not include them in the validation criteria.