LM Studio is a graphical, llama.cpp-based desktop app for running LLMs locally — GGUF models from Hugging Face, browsable and downloadable right from the UI (Llama, DeepSeek-R1, Mistral, Gemma, Granite, Phi, and more). This guide installs it on Linux, runs it as a system service, downloads and chats with a model, enables API access, and puts it behind Nginx with TLS.
Prerequisites: a GUI-capable Linux instance with a GPU (or a desktop with x86 + AVX2), a domain if you want remote TLS access (this guide uses Ubuntu 24.04 and
example.com).
Install LM Studio
$ wget https://installers.lmstudio.ai/linux/x64/0.3.15-11/LM-Studio-0.3.15-11-x64.AppImage
$ sudo apt install libatk1.0-0 libatk-bridge2.0-0 libcups2 libgdk-pixbuf2.0-0 libgtk-3-0 libpango-1.0-0 libcairo2 libxcomposite1 libxdamage1 libasound2t64 libatspi2.0-0
$ cd ~/Downloads
$ sudo chmod +x LM-Studio-0.3.15-11-x64.AppImage
$ ./LM-Studio-0.3.15-11-x64.AppImage --appimage-extract
$ cd squashfs-root
$ sudo chown root:root chrome-sandbox
$ sudo chmod 4755 chrome-sandbox
$ ./lm-studio
On a remote server with no GUI, use X11 forwarding (ssh -X linuxuser@hostname) or you'll hit an error trying to launch it.
Run LM Studio as a System Service
Gives you auto-start at boot and consistent management via systemd.
$ sudo mv ~/Downloads/squashfs-root/ /opt/lm-studio
$ echo $DISPLAY
Note the output (e.g. :1).
$ sudo nano /etc/systemd/system/lmstudio.service
[Unit]
Description=LM Studio Service
After=network.target
[Service]
Type=simple
ExecStart=/opt/lm-studio/lm-studio --run-as-a-service
Restart=always
User=<user>
Group=<group>
Environment=DISPLAY=:1
Environment=XDG_RUNTIME_DIR=/run/user/$(id -u <user>)
[Install]
WantedBy=multi-user.target
Replace <user>/<group> with your account, and match DISPLAY to the value from echo $DISPLAY above.
$ sudo systemctl daemon-reload
$ sudo systemctl start lmstudio
$ sudo systemctl status lmstudio
Stop it with sudo systemctl stop lmstudio.service when needed.
First-Run Configuration
- Get your first LLM → Download for the default model.
-
Start New Chat → Select a model to load → pick the downloaded model (e.g.
deepseek-r1-distill-qwen-7b). - Enter a prompt (e.g.
Add 3 random numbers divisible by 10), check token count, Enter to send. - Power User / Developer on the bottom nav for advanced options.
- Discover → Model Search to find more models, Runtime for runtime packs, Hardware to check system specs, App Settings for interface options, Check for updates.
Download and Run Models
- Discover → Model Search, search by name.
- Browse LM Studio Staff Picks or Hugging Face listings.
- Download to fetch it; monitor progress under Downloads.
- Models to see everything downloaded (filter by LLMs or Text Embedding).
- Chat → select a model → type a prompt, Enter.
- Check processing time/token stats in the output. New Chat / New Folder to organize sessions.
Enable API Access
Runs LM Studio headless, serving an OpenAI-compatible API.
- Developer → Settings.
- Set a custom port (default
1234). - Serve on Local Network — only enable if you're not putting it behind a reverse proxy; keep off if Nginx will front it.
- Just-in-Time Model Loading — load models automatically on first request.
- Auto Unload unused JIT loaded models — set a max idle TTL.
- Flip server status to Running.
- Open the port in your firewall.
- Test it:
$ curl -X GET http://SERVER-IP:1234/v1/models
{
"data": [
{
"id": "deepseek-r1-distill-qwen-7b",
"object": "model",
"owned_by": "organization_owner"
},
{
"id": "text-embedding-nomic-embed-text-v1.5",
"object": "model",
"owned_by": "organization_owner"
}
],
"object": "list"
}
Put Nginx in Front with TLS
$ sudo apt update
$ sudo apt install nginx -y
$ sudo systemctl start nginx
$ sudo nano /etc/nginx/sites-available/lmstudio.conf
server {
listen 80;
server_name lmstudio.example.com;
location / {
proxy_pass http://127.0.0.1:1234;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
$ sudo ln -s /etc/nginx/sites-available/lmstudio.conf /etc/nginx/sites-enabled/
$ sudo nginx -t
$ sudo systemctl restart nginx
$ sudo apt install certbot python3-certbot-nginx -y
$ sudo ufw allow http
$ sudo ufw reload
$ sudo certbot --nginx -d lmstudio.example.com -m email@example.com --agree-tos
$ sudo systemctl restart nginx
$ sudo ufw allow https
$ sudo ufw reload
Confirm it works over HTTPS:
$ curl -X GET https://lmstudio.example.com/v1/models
$ curl https://lmstudio.example.com/api/v0/models/<model-name>
$ curl https://lmstudio.example.com/api/v0/completions \
-H "Content-Type: application/json" \
-d '{
"model": "<model-name>",
"prompt": "<prompt>",
"temperature": 0.7,
"max_tokens": 20,
"stream": false,
"stop": "\n"
}'
Next Steps
LM Studio is running as a service, serving models over an HTTPS API through Nginx. From here:
- Point application code at the OpenAI-compatible endpoint instead of a cloud API
- Load multiple models and switch between them per-request
- Use JIT loading + idle TTL to keep memory usage low when models aren't actively serving traffic
For the full guide, visit the original article on Vultr Docs.
Top comments (0)