March 12, 2025

Install and Run Google Gemma 3 on Linux Ubuntu

In this machine learning and large language model tutorial, we explain how to install and run Google’s Gemma 3 AI Model on Linux Ubuntu. This tutorial explains all the steps you need to perform in order to install and run Gemma 3 on a local Linux Ubuntu computer. The YouTube tutorial with the installation steps is given below.

Install Gemma 3 on Linux Ubuntu

To install Gemma 3, the first step is to install Ollama. Before we install Ollama, we need to install Curl. Open a Linux Ubuntu terminal and type

sudo apt update && sudo apt upgrade

sudo apt install curl

curl --version

To install Ollama, go to the website

https://www.ollama.com

and click on Download, and then select Linux. As a result, the following installation command will be generated

curl -fsSL https://ollama.com/install.sh | sh

Then, execute this command in a Linux terminal. This will install Ollama. To verify the Ollama installation, open a web browser, and type this

http://localhost:11434/

If Ollama is properly installed, the message shown in the figure below will be generated.

The next step is to download the 12B and 27B models. To do that, run the following two commands in the terminal

ollama pull gemma3:12b

and

ollama pull gemma3:27b

These commands are generated by visiting the Ollama repository of Gemma 2.

To run these models, you need to type the following

ollama run gemma3:12b

and

ollama run gemma3:27b

The models will be executed in a Linux terminal. The next step is to learn how to interact with models by using a Graphics User Interface (GUI). We will generate a GUI by using Open WebUI.

Interact with Gemma 3 Model by Using Open WebUI

First, we need to install Open WebUI. To do that, open a terminal and type

cd ~
mkdir testWebUI
cd testWebUI

Then, check if Python is installed and check your Python version.

which Python 
python3 --version 

In our case, the Python version is 3.12. The next step is to create a Python virtual environment

sudo apt install python3.12-venv
python3 -m venv env1
source env1/bin/activate

In the command above, we specified our Python version, which is Python 3.12. Next, to install Open WebUI, type the following in the active Python virtual environment:

pip install open-webui

It is going to take 2-5 minutes to install Open WebUI. Once Open WebUI is installed, we can run it as follows:

open-webui serve

After this command is executed and all the packages are loaded, enter the following address in your web browser

http://localhost:8080

After you register your username and password, the Open WebUI GUI will open and you will be able to interact with the model as shown in the figure below. In the top left corner of the screen you can use the drop-down menu to select the model.