---
# System prepended metadata

title: 'Module 2 (MCP & RAG): Basic AI Implementation with Ollama (2)'

---

# Module 2 (MCP & RAG): Basic AI Implementation with Ollama (2)
![Group 1171275599](https://hackmd.io/_uploads/Sk1R5FG6gx.png)
Author: **Ryan Safa Tjendana**
Line id: **ryansatj**
email: ryansaftje123@gmail.com

## Ollama Installation
To test the Ollama LLM runtime, you should have at least a Linux based Operating System machine, we are recommending using Ubuntu Server with minimum version of 20.04 LTS. You can run the ubuntu using VM (Virtual Machine) or WSL (Windows Subsystem for Linux), WSL is recommended to run the Ollama. Below is the video tutorial on how to install ubuntu on VM or WSL:

Ubuntu install on Windows/MacOS:
https://www.youtube.com/watch?v=wqm_DXh0PlQ

WSL ubuntu install (Windows Only):
https://www.youtube.com/watch?v=zZf4YH4WiZo

After the Linux environment is set up, lets get to install the Ollama LLM Runtime

## 1. System Requirements

### Minimum
| Component | Requirement |
|------------|--------------|
| OS | Ubuntu 20.04 / 22.04 (64-bit) |
| CPU | x86_64 or ARM64 |
| RAM | ≥ 8 GB (16 GB+ recommended) |
| Disk Space | ≥ 10 GB (for models) |
| GPU (optional) | NVIDIA GPU with CUDA 12+ for acceleration |

> Note: Ollama can run entirely on CPU, but GPU gives **much faster inference**.

## 2. Install Ollama

Run the following commands on your Ubuntu terminal:

```bash
sudo apt update
```
This command is to update your ubuntu package list

```bash
curl -fsSL https://ollama.com/install.sh | sh
```
This command downloads and installs Ollama directly from its official source.

After both commands finish successfully, Ollama should be installed on your system.
🎉 Easy, right?

## 3. Verify the installation
But before getting too excited, let’s make sure everything works properly. lets verify the installation by running these command below:

```bash=
ollama --version
```
Example Output:
![image](https://hackmd.io/_uploads/SJ4_AyV6ex.png)
If you see something like this, congratulations — Ollama is installed correctly!
If not, repeat the installation step carefully.

Ollama runs as a background service. To verify that it’s active, run:
```bash=
sudo systemctl status ollama
```
Example output:
![image](https://hackmd.io/_uploads/rkWp0yN6xe.png)
If it’s shown as active (running), you’re all set.
If not, start it manually using:
```bash=
sudo systemctl start ollama
```

## 4. Test the ollama with a simple model
This is the fun part, running our own large languange model on our own computer, no need to connect to the internet no more, just running it straightly to your computer. To see all the model available on ollama you can visit its website, there are a lot of information on there you should get use to it, there are also the hardware specification for the model. Please make sure your machine can handle the model you choose, unless... you want your computer to go BOOM.

Check the models on ollama **[here](https://ollama.com/search)**

Lets pull a light model from ollama, run this command on you command line
```bash=
ollama pull llama3.2:latest
```
This command downloads the latest version of LLaMA 3.2.
You can find it here: https://ollama.com/library/llama3.2 

If you want a smaller/lighter model we can try to pull the smaller one
```bash=
ollama pull llama3.2:1b
```
So what is the difference between pulling the llama3.2:latest and llama3.2:1b, okay lets get to the model naming in ollama. Ollama usually use this pattern:

```bash=
model_name:variant
```

**For example:**
- llama3.2:1b → LLaMA 3.2 with 1 billion parameters (lightweight, fast, less accurate)
- llama3.2:latest → Default recommended version (around 3 billion parameters)

The more parameters, the smarter (but also heavier) the model.

After successfully pulling/downloading the model to the system, we can try the model by using ollama. 
Run this command to test it:
```bash=
ollama run llama3.2:latest
```
or if you installed the smaller model:
```bash=
ollama run llama3.2:1b
```
Test Documentation:
![image](https://hackmd.io/_uploads/SkFRzeVaxe.png)

If the installation and pulling the model is successfull the model will immediately run and now you can freely test it and prompt anything to the model. Play with it, explore it while you still can...

## 5. Ollama API function
Ollama has a built in REST API Service that runs locally on the machine, usually the ollama runs on port 11434 which mean we can access it on http://localhost:11434. Why dont we give it a try? lets try the ollama test API, you can run this command to test it:
```bash=
curl http://localhost:11434/api/generate -d '{
  "model": "llama3",
  "prompt": "Hello"
}'
```
You can freely modify the prompt as you like.
Test documentation: 
![image](https://hackmd.io/_uploads/rJvx4lE6xe.png)

**You’ve reached the end of the Ollama installation and testing tutorial. Great job! 🎉**

Now for your hands-on assignment:

Task:
- Try to install Ollama yourself on your own machine.
- Document every step and result in a .md file.
- Upload your documentation to HackMD. 

We will check it next week