This repository contains scripts for installing and managing LM Studio as a systemd user service on Linux systems. LM Studio is downloaded and run as an AppImage with Xvfb (X Virtual Framebuffer) to provide a headless display environment.
Originally written for my DGX Spark, but works with Ubuntu 22+ and Arch-based systems.
After installation, you can control LM Studio with the lms cli.
These scripts assume this repository is downloaded to ~/lmstudio
cd .
git clone https://github.com/eleqtrizit/lmstudio-headless-dgx-spark-ubuntu24.git
mv lmstudio-headless-dgx-spark-ubuntu24 lmstudio
cd lmstudioThen:
./first_time_install.sh- never need to run this again../install_or_update_lmstudio.sh- run this as new versions arrive or just starting
This is a take on running headless LM Studio on Ubuntu
- Ubuntu-based Linux distribution (maybe Debian or more?)
- Systemd user services support
- Internet connection for downloading LM Studio
- Clone or download this repository to
~/lmstudio - Run the first-time installation script:
./first_time_install.sh
- Install or update LM Studio:
./install_or_update_lmstudio.sh
first_time_install.sh: Installs required packages (xvfb, xauth) and copies systemd service filesinstall_or_update_lmstudio.sh: Downloads the latest LM Studio AppImage, extracts it, and sets up the servicestart.sh: Starts the LM Studio servicestop.sh: Stops the LM Studio servicestatus.sh: Shows the status of the LM Studio service
This setup includes two systemd user services:
xvfb-user.service: Provides a virtual X server environment (required for LM Studio)lmstudio-user.service: Runs the LM Studio application
The lmstudio.env file contains environment variables:
DISPLAY: The virtual display number (default :99)LM_STUDIO: Path to the LM Studio executable
- LM Studio runs headlessly using Xvfb
- Services are managed as user services (not system-wide)
- The installation will automatically detect your system architecture (x86_64 or ARM64) and download the appropriate version
After installation, you can control LM Studio using:
# Start LM Studio
./start.sh
# Stop LM Studio
./stop.sh
# Check status
./status.sh
# Update to latest version of LM Studio
./install_or_update_lmstudio.shCheck service status:
systemctl --user status lmstudio-user.service
systemctl --user status xvfb-user.serviceView service logs:
journalctl --user -u lmstudio-user.service
journalctl --user -u xvfb-user.service