Skip to main content

Upgrade

Upgrading Ollama requires careful planning to preserve existing models and configurations. The upgrade process is generally straightforward but varies depending on the installation method.

Pre-upgrade Preparation

  1. Before upgrading, backup your model directory and configuration:

Bash

sudo systemctl stop ollama
tar -czf ollama-backup-$(date +%Y%m%d).tar.gz ~/.ollama/

2.Note your current version and installed models:

Bash
ollama --version
ollama list > models-backup.txt

Ubuntu Upgrade Process

  1. For installations using the install script, simply re-run the installer:

Bash

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

4.For manual installations, download the latest binary:


Bash

wget https://github.com/ollama/ollama/releases/latest/download/ollama-linux-amd64
sudo systemctl stop ollama
sudo mv ollama-linux-amd64 /usr/local/bin/ollama
sudo chmod +x /usr/local/bin/ollama
sudo systemctl start ollama

RHEL8 Upgrade Process

Stop the service and backup configuration:


Bash

sudo systemctl stop ollama
sudo cp /etc/systemd/system/ollama.service /etc/systemd/system/ollama.service.backup

5.Download and install the new version:

Bash

curl -L https://ollama.ai/download/ollama-linux-amd64 -o ollama
sudo mv ollama /usr/local/bin/
sudo chmod +x /usr/local/bin/ollama

6.Restart the service:


Bash

sudo systemctl daemon-reload
sudo systemctl start ollama

Post-upgrade Verification

1.Verify the upgrade was successful:


Bash
ollama --version
sudo systemctl status ollama

2.Test model functionality:


Bash

ollama list
ollama run llama2 "Test message after upgrade"

3.Check API endpoints:


Bash

curl http://localhost:11434/api/version

Monitor the service for the first few hours after upgrade to ensure stability and performance. Re-download any models that may have compatibility issues with the new version, and update any custom integrations that might be affected by API changes.