|
1 |
| -# Ollama-Android |
2 |
| -Run Ollama Android using Termux and Ollama for fast, private, on-device AI, no cloud needed. |
| 1 | +# Ollama on Android using Termux |
| 2 | + |
| 3 | +This guide explains how to install and run the **Ollama language model** on an Android device using **Termux**. By following this tutorial, you can leverage **LLMs (Large Language Models)** directly on your mobile device without needing a desktop environment. |
| 4 | + |
| 5 | +## 📌 Prerequisites |
| 6 | + |
| 7 | +Before starting, ensure you have the following: |
| 8 | + |
| 9 | +- An Android device with sufficient storage and RAM. |
| 10 | +- A stable internet connection. |
| 11 | +- Basic familiarity with Termux commands. |
| 12 | + |
| 13 | +## 🚀 Installation Steps |
| 14 | + |
| 15 | +### Step 1: Install F-Droid |
| 16 | + |
| 17 | +F-Droid is an open-source app store for Android. Download and install it from: |
| 18 | +🔗 [https://f-droid.org/](https://f-droid.org/) |
| 19 | + |
| 20 | +### Step 2: Install Termux |
| 21 | + |
| 22 | +1. Open **F-Droid**. |
| 23 | +2. Search for **Termux** and install it. |
| 24 | + |
| 25 | +### Step 3: Update and Upgrade Termux Packages |
| 26 | + |
| 27 | +Open Termux and run the following command: |
| 28 | + |
| 29 | +```bash |
| 30 | +pkg update && pkg upgrade |
| 31 | +``` |
| 32 | + |
| 33 | +### Step 4: Install Proot-Distro |
| 34 | + |
| 35 | +Proot-Distro allows you to run Linux distributions inside Termux. Install it with: |
| 36 | + |
| 37 | +```bash |
| 38 | +pkg install proot-distro |
| 39 | +``` |
| 40 | + |
| 41 | +Now, install **Debian**: |
| 42 | + |
| 43 | +```bash |
| 44 | +pd install debian |
| 45 | +``` |
| 46 | + |
| 47 | +### Step 5: Log in to Debian |
| 48 | + |
| 49 | +Start your Debian environment: |
| 50 | + |
| 51 | +```bash |
| 52 | +pd login debian |
| 53 | +``` |
| 54 | + |
| 55 | +### Step 6: Install Tmux |
| 56 | + |
| 57 | +Tmux allows you to run multiple terminal sessions. Install it with: |
| 58 | + |
| 59 | +```bash |
| 60 | +apt update && apt upgrade |
| 61 | +apt install tmux |
| 62 | +``` |
| 63 | + |
| 64 | +### Step 7: Install Ollama |
| 65 | + |
| 66 | +Download and install Ollama inside Debian: |
| 67 | + |
| 68 | +```bash |
| 69 | +curl -fsSL https://ollama.com/install.sh | sh |
| 70 | +``` |
| 71 | + |
| 72 | +### Step 8: Create a New Tmux Session |
| 73 | + |
| 74 | +Start a new session for running Ollama: |
| 75 | + |
| 76 | +```bash |
| 77 | +tmux new -s llm |
| 78 | +``` |
| 79 | + |
| 80 | +### Step 9: Start the Ollama Server |
| 81 | + |
| 82 | +Inside the Tmux session, run: |
| 83 | + |
| 84 | +```bash |
| 85 | +ollama serve |
| 86 | +``` |
| 87 | + |
| 88 | +### Step 10: Create a New Pane in Tmux |
| 89 | + |
| 90 | +Split the Tmux window by pressing `Ctrl+b` and then `"`. |
| 91 | + |
| 92 | +### Step 11: Run an Ollama Model |
| 93 | + |
| 94 | +To run the **Gemma 2B** model: |
| 95 | + |
| 96 | +```bash |
| 97 | +ollama run gemma:2b |
| 98 | +``` |
| 99 | + |
| 100 | +To run the **Phi-3** model: |
| 101 | + |
| 102 | +```bash |
| 103 | +ollama run phi3 |
| 104 | +``` |
| 105 | + |
| 106 | +### Step 12: Test the Model |
| 107 | + |
| 108 | +Interact with the model by entering prompts directly in the terminal. |
| 109 | + |
| 110 | + |
| 111 | +## 🎯 Conclusion |
| 112 | + |
| 113 | +With this setup, you can now run **Ollama** on your Android device, unlocking the potential of **on-device AI** for development and experimentation. |
| 114 | + |
| 115 | +## 📜 License |
| 116 | + |
| 117 | +This project is licensed under the **MIT License**. |
| 118 | + |
| 119 | +## 👨💻 Contributions & Issues |
| 120 | + |
| 121 | +Feel free to contribute or report issues in the repository. Your feedback and contributions are highly appreciated. |
| 122 | + |
| 123 | +Enjoy exploring the capabilities of **on-device AI** with Ollama on your Android device. 🚀 |
0 commit comments