How to Deploy Local LLMs with Ollama and Open WebUI on Ubuntu

Running large language models on your own hardware gives you total privacy and freedom from API fees or usage limits. If you have an Ubuntu machine sitting on your desk or running in a local closet, you can easily set up a private AI workspace. By combining Ollama for model management and Open WebUI for the user interface, you get a setup that feels very similar to commercial chatbot platforms, except everything runs entirely on your own machine.

This guide walks you through setting up both tools on Ubuntu.

You will learn how to prepare your system, install the runtime, configure a nice web interface, and download your first models.

Preparing Your Ubuntu Environment

Before you touch any AI software, you need to make sure your Ubuntu system is ready. Running local LLMs takes a toll on your hardware, specifically your GPU and RAM. While you can run small models on a standard CPU, it is painfully slow. If you want a smooth experience, a dedicated NVIDIA or AMD graphics card is essential.

Checking Your Hardware and Drivers

Open up your terminal and check what kind of hardware you are working with. Run the following command to see your CPU and RAM specifications:

lscpu | grep "Model name"
free -h

Next, check if you have a GPU installed. If you are using an NVIDIA card, you need to verify that your drivers and the CUDA toolkit are properly configured so Ollama can offload calculations to the GPU. Run this command to check your NVIDIA driver status:

nvidia-smi

If this command returns your GPU details, VRAM amount, and CUDA version, you are in good shape. If it fails or says command not found, you will need to install the proprietary NVIDIA drivers before proceeding. For Ubuntu, the easiest way to do this is through the Software & Updates utility or by running sudo ubuntu-drivers install in your terminal, followed by a system reboot.

Updating System Packages

It is always a good idea to start with an updated system to avoid dependency conflicts. Refresh your package lists and upgrade existing software with these commands:

sudo apt update && sudo apt upgrade -y

You will also want to make sure you have curl installed, as you will use it to download the installation scripts. If curl is missing, install it quickly:

sudo apt install curl -y

With your system updated and your hardware verified, you are ready to install the backend engine that will run your models.

In addition to learning how to deploy local LLMs with Ollama and Open WebUI on Ubuntu, you might find it beneficial to explore effective tools for managing your projects. A related article that provides insights into the best software for project management can be found at com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

Next, add the Docker repository to your apt sources:

echo "deb [arch=$(dpkg --arch) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

Update your package index again and install Docker Engine along with Docker Compose:

sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y

To avoid having to type sudo every time you run a docker command, add your current user to the docker group:

sudo usermod -aG docker $USER

You will need to log out and log back in, or run newgrp docker, for this group change to take effect.

Verify your installation by running a test container:

docker run hello-world

Launching the Open WebUI Container

With Docker ready, you can spin up Open WebUI with a single command. Because Ollama is running natively on your Ubuntu host, the web container needs to be able to talk to the host machine.

Run the following Docker command to start Open WebUI:

docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:main

Let’s break down what this command is doing:

  • -d runs the container in detached mode in the background.
  • -p 3000:8080 maps port 3000 on your Ubuntu host to port 8080 inside the container.
  • --add-host=host.docker.internal:host-gateway allows the container to reach services running directly on the host machine, which is how it connects to Ollama.
  • -v open-webui:/app/backend/data creates a persistent volume so your chat history and settings are saved even if you update the container.
  • --restart always ensures the interface boots back up if your server restarts.

Give it a minute to pull the image and start up. You can then open your web browser and navigate to http://localhost:3000 or http://your-server-ip:3000.

Connecting and Managing Your AI Workspace

When you open Open WebUI for the first time, you will be prompted to create an administrator account. The first person to sign up becomes the admin, allowing you to manage users, configure settings, and control model access later if you decide to share the server with friends or coworkers.

Verifying the Ollama Connection

Once you log in, look at the model selection dropdown at the top of the chat window. If everything is configured correctly, you should see the llama3 model you downloaded earlier.

If the dropdown is empty or you get a connection error, it usually means Open WebUI cannot reach Ollama. By default, Open WebUI looks for Ollama at http://localhost:11434. Because we used the host gateway flag, you can explicitly configure the connection in Open WebUI settings. Go to the Admin Panel, navigate to Settings, find the Connections tab, and ensure the Ollama API base URL points to http://host.docker.internal:11434.

Downloading Additional Models from the UI

One of the best features of Open WebUI is that you don’t always have to jump back into the terminal to download new models.

Go to your Admin Panel, select Settings, and look for the Models section. Here, you will find an input field where you can type the name of any model available on the Ollama library registry, such as mistral, gemma2, or phi3. Type the name and click download, and the web interface will trigger Ollama on the backend to fetch the model files while showing you a progress indicator.

If you’re exploring the deployment of local LLMs with Ollama and Open WebUI on Ubuntu, you might also find it beneficial to read about selecting the right VPS hosting provider. Understanding the nuances of VPS hosting can significantly enhance your deployment experience and ensure optimal performance. For more insights on this topic, check out this informative article on

  • 5G Innovations (13)
  • Wireless Communication Trends (13)
  • Article (343)
  • Augmented Reality & Virtual Reality (977)
  • Cybersecurity & Tech Ethics (846)
  • Drones, Robotics & Automation (526)
  • EdTech & Educational Innovations (385)
  • Emerging Technologies (2,185)
  • FinTech & Digital Finance (489)
  • Frontpage Article (1)
  • Gaming & Interactive Entertainment (423)
  • Health & Biotech Innovations (791)
  • News (97)
  • Reviews (129)
  • Smart Home & IoT (486)
  • Space & Aerospace Technologies (385)
  • Sustainable Technology (861)
  • Tech Careers & Jobs (380)
  • Tech Guides & Tutorials (1,262)
  • Uncategorized (146)