How to Run DeepSeek-R1 Safely on Your Local Machine
What is Deep Seek and why so much hype around it ? — When people say Deep Seek they mean LLM named deepseek-r1 made by a China based company Deep Seek . There is so much hype around it because deepseek-r1 model is on par with OpenAI’s ChatGPT-4o. But that’s not the fun part, fun part is they trained r1 model using way less resources as well as at the fraction of the cost of it took OpenAI to train GPT-4o.
The best part is that this model is open-source, allowing everyone to access all its features for free — features that would typically cost a fortune to use in GPT-4o.
So, why the controversy? — Since Deep Seek is a Chinese company, all its servers are located in China. This means that any data you enter as a prompt in DeepSeek-R1’s web chat is sent to their servers in China. While most companies collect user data, the concern arises from China’s cybersecurity laws, which require companies to comply if the government requests user data. This raises privacy concerns, as you may not know how your personal data is being used — pretty scary, right?
What's the solution? — Since, deepseek-r1 is opensource you can self host it on your local machine. That way you can run deep seek in offline mode and don’t have to worry about your data being stolen or misused.
Here are some simple ways anyone can accomplish that is few simple steps
First of all If you are a normal person who just want to use deepseek-r1 locally (offline) on your computer but not comfortable with CLI , this is for you :
Step 1: Go to lmstudio.ai and download LM Studio
You can choose installer based on your OS and Go ahead install it.
(Use Default setting no changes need )
Step 2: Install AI model
After installation run LM Studio you will see this screen click on Get your first LLM.
It is showing me deep seek by default for me you might see something different, lets just skip it for now . Even if you see same option as me just skip it , I’ll tell you why is a sec .
now you will se a GUI somewhat similar to ChatGPT or if you have ever used VS Code you might me familiar to this GUI.
Right now we don’t have any AI model installed on our local machine so lets install it. We are going to install Deep Seek but you have other options like Llama3 , Gemma2 , Qwen and much more.
Click on magnifying glass icon on left side of window , this will show a popup with all the LLM options you can choose from
Search for deep seek r1 in search bar and select the first option you will see these options.
Remember you need some sort of hardware to run any AI model , best thing about using LM studio , it will tell you which AI model might and might not run on you system, for now i am running this modal on a low end laptop to show you that you can smaller AI models on any machine.
But better hardware you have the bigger model you can run choose which ever model seems like it will run on your machine and avoid running any model which is too large for your machine .
Once you choose the model and click on download you will see a window popup showing download status.
once download is complete just click on load model
BOOM! Now you have deep seek running locally on your local machine:
On top you can see which model is being used right now , in similar way you can download different models and choose which AI model to use.
Go ahead ask AI any thing and see if it works
As you can see it took 2 minutes and 51 seconds to think and answer my question , obviously it will take less time with much powerful hardware.
That’s it, in few simple clicks you can run Deep seek locally on a GUI without having to worry about your data being sent to some remote server. To test this you can just turn off your internet and try asking it anything it should work without any issue.
Now if you are like me and have no problem using CLI, we can do much more crazy stuff make everything much secure and disconnected.
Now the problem with above approach is that LM Studio has access to our Network as well as our files thus Deep Seek also has access to everything on my system and knowing that makes me uncomfortable, so i would like to run it separately such that it is disconnected from my system and best way to do it is docker — it’s really great when you come to know it.
If you are on Windows or Linux this is fine but if you are on Mac — Docker on Mac does not support GPU acceleration.
Now if you are already using Linux its great but if you are on Windows lets run Linux on top of Windows using WSL (Windows Subsystem for Linux).
Step 1: Install WSL
Open cmd / Terminal on windows and type
wsl --install
This will download WSL on your windows.
Next lets run Linux > Type “wsl” in your windows terminal
wsl
When you run this command you will see this:
Now you are running Linux within your Windows terminal — pretty cool huh!
Step 2: Install docker
Set up Docker’s apt repository.
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
Install the Docker packages
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Verify that the installation is successful
sudo docker run hello-world
this will pull hello-world image and run it. You will see Hello from Docker! message in your terminal.
Step 3: Pull up Ollama docker image
If you have Nvidia GPU, first lets install Nvidia container toolkit using apt
but if you are going to use only your CPU for running AI models skip this step
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
This will install Nvidia toolkit so that docker can access your GPU’s full potential to run AI models.
If you have AMD GPU, you’ll need to install the AMD ROCm (Radeon Open Compute) software stack on your host system.
Now lets pull ollama docker image
sudo docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
For CPU Only
sudo docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
Check if its running : this will show all the images running on your system
sudo docker ps
Step 4: Download and run Deep Seek inside our docker container
Go to https://ollama.com/search here you can see all the models that you can run inside our container , here search for deepseek-r1
now here you can see these parameters right in simple words these are amount of data used to train the model. “b” in here means billion as in 1.5 billion parameters.
So, higher this number > higher the intelligence > higher the computation power required .
(don’t even try to go for 671b, you a lot of processing power and this is this model which can compete with OpenAI’s ChatGPT — this might tell you the hardware requirements to run this Model)
For our purpose we will go with 7b parameters, go to your Linux terminal
sudo docker exec -it ollama ollama run deepseek-r1:7b
This will complete the download and run deepseek-r1
Now you can ask it anything you want
Here you go now you are running deepseek-r1 with 7b parameters on your local system and best thing about this approach is, it’s running inside a docker container so it doesn't have any access to your personal files or network.
This is the only way you should run any AI model or other scripts — completely isolated from your system , that you are not sure if it is accessing your personal data or not.
Bonus Section: I ask Deep Seek to write intro of this blog , lets see how well it works. ( this is with only 1.5b parameters)
Try it yourself, its fun.