Welcome to the Deepseek R1 model installation guide on Android devices.
This document will provide you with detailed instructions for installing and running the Deepseek R1 artificial intelligence model using Termux and Arch Linux.
So by following this guide you will have the ability to run this fascinating model on your device locally, which will also allow you to use it without an internet connection.
Before starting with the installation, make sure you have Termux installed on your device. This is an Android application that provides a Linux-based terminal environment.
My recommendation is that you download it from the F-Droid store, as a more advanced version can be accessed from the F-Droid store.
After installing Termux, you should follow the steps below to install Deepseek R1 on your Android device having full control of the whole process.
But if you want to perform the installation in automatic. I invite you to read how to use my installation script which I talk about almost at the end of the document.
To ensure that you have the latest versions of packages, run the following command in Termux:
pkg update
To allow Termux to access files on your device, run:
termux-setup-storage
Note that this is an optional step. So if you do not want to access your files from Termux, you can skip this step.
To improve the aesthetics and convenience of the environment. You can install neofetch and fish by running the following commands:
pkg install neofetch fish
Neofetch is a tool that displays information about your system, while fish is an interactive shell that offers an enhanced user experience.
Now we need to install Proot Distro on Termux.
pkg install proot-distro
Which is a tool that allows you to run Linux distributions on Android using Proot.
Through this command proot will install a version optimized for your processing, run:
proot-distro install archlinux
ARM is a 32-bit and 64-bit processor architecture used in mobile devices such as smartphones and tablets.
To log in as root to Arch Linux, use the following command:
proot-distro login archlinux
To install ollama and the artificial intelligence models on the mobile you need to be root.
To make sure you have the latest versions of Arch Linux packages, run:
pacman -Syu
In this case we do not use “sudo” as we are already superuser.
Ollama will be the means through which we will obtain the Deepseek R1 model image. So to install it, run:
curl -fsSL https://ollama.com/install.sh | sh
What is ollama? Ollama is an artificial intelligence model server that allows you to download and run AI models without an Internet connection.
Now that you have installed ollama. You need to start your server, run:
ollama serve &
If you fail to start the server with this command. Try without the ampersand “&”.
Finally, let's install and run the Deepseek R1 model with the following command:
ollama run deepseek-r1:1.5b
After a few seconds the model will have loaded and you will be able to start chatting with it.
Important: To perform the automated installation, your phone must be rooted.
To make the installation process simpler, I have created a script that automates all the steps. Follow these steps to download the script from GitHub and run it:
First, you need to install Git to clone the repository. Run the following command in Termux:
pkg install git
Next, clone the repository containing the installation script:
git clone https://github.com/mykeura/deepseek-r1-locally-for-android.git
Change to the directory where the script is located:
cd deepseek-r1-locally-for-android
To use the sudo
command, you need to install tsu
:
pkg install tsu
Make the script executable and run it with sudo
:
chmod +x install-deepseek.sh
sudo ./install-deepseek.sh
The script will take care of:
- Updating Termux.
- Installing the necessary tools.
- Configuring Arch Linux.
- Installing and running Ollama.
- Starting the Deepseek R1 model.
This option is perfect if you prefer a quick and hassle-free installation. The script will perform the entire process automatically, maintaining the same functionality as the manual installation.
Make the script executable and run it:
chmod +x install-deepseek.sh
./install-deepseek.sh
The script will take care of:
- Updating Termux.
- Installing the necessary tools.
- Configuring Arch Linux.
- Installing and running Ollama.
- Starting the Deepseek R1 model.
This option is perfect if you prefer a quick and hassle-free installation. The script will perform the entire process automatically, maintaining the same functionality as the manual installation.
The next time you start Termux, you will need to log into Arch Linux and start the Ollama server before running the model. Follow these steps:
- Log in to Arch Linux:
proot-distro login archlinux
- Start the Ollama server:
ollama serve &
- Run the Deepseek R1 model
ollama run deepseek-r1:1.5b
With these simple steps you will have access to a powerful artificial intelligence model locally and without the need of an internet connection.
The 1.5b parameter model has been chosen because of its balance between performance and efficiency.
This model is capable of delivering accurate and fast results, while its size allows it to run on resource-constrained devices such as a mobile device.
It should be added that the performance of the model will depend on the specifications of your device. So devices with more RAM and processor will provide better performance.
By way of conclusion, I can say that I love running Deepseek R1 locally using my favorite Gnu/Linux distribution.
And while the experience would not be as smooth as using it from the android app or its website. It's nice to be able to have this open source model, without the need to be connected to the internet.