
LM Studio is a graphical desktop application based on llama.cpp that runs Large Language Models (LLMs) locally. It supports GGUF and open-source models from platforms like Hugging Face, which you can download directly from the LM Studio interface. You can run popular models such as Llama, DeepSeek-R1, Mistral, Gemma, Granite, and Phi locally after installation.
This article explains how to install LM Studio on Linux and run Large Language Models (LLMs) locally on your workstation. You will enable API access and use LM Studio to download and run models like DeepSeek-R1, and Gemma 3 for integration in your existing applications.
Before you begin, you need to:
Have access to a GUI-enabled Linux based remote instance with GPU or a desktop workstation with the x86 with AVX2 processor architecture.
This article uses Ubuntu 24.04 to demonstrate the installation steps.
A Domain name such as example.com if you want to use your LM Studio remotely with TLS encryption.
LM Studio is available as a standalone application file you can download and install from the official website. Follow the steps below to download and install LM Studio on your workstation.
Visit the official LM Studio download page.
Select the Linux operating system and the LM Studio version to download.
Click Download LM Studio to download the latest release package for your operating system. If you're using a remote server, copy the download link and use the wget tool to download the AppImage.
Open a new terminal window.
Install the required dependencies for LM Studio.
Navigate to the directory where you saved the LM Studio AppImage, for example, the Downloads directory.
Add execute privileges to the LM Studio AppImage file.
Extract the LM Studio AppImage contents.
Navigate to the extracted squashfs-root directory.
Change the chrome-sandbox ownership to the root user and group.
Set the file permission as 4755 to the chrome-sandbox binary file.
Run the lmstudio script to open LM Studio and verify the installation is success.
To run the lm-studio binary on a remote server with no GUI interface, you can use the X11 forwarding by logging into your server using ssh -X linuxuser@hostname. Without this, you'll get an error.
You can start LM Studio by running the lmstudio script on a Linux desktop or lms server start on a Linux server. Configuring LM Studio as a system service creates a desktop application icon that lets you open LM Studio on your server. Follow the steps below to create a new system service to automatically start LM Studio at boot, manage API connections, and run LLMs.
Press Control + C to close LM Studio in your terminal.
Move the LM Studio squash-fs directory to /opt and rename it to /lm-studio.
Note your current display session to use in the system service.
Output:
Create a new lmstudio.service file.
Enter the following service configurations into the file.
In the above file:
$DISPLAY variable value which you noted earlier.[SERVICE], replace <user> with your user name.Save the file and close the text editor.
The system service configuration above runs the LM Studio script in the installation directory with your Linux user profile, allowing you to start LM Studio as a service.
Reload systemd to apply the service configuration.
Start the LM Studio system service.
The LM Studio's GUI interface opens.
View the LM Studio service status and verify it’s running.
Output:
To stop the LM Studio, use:
You can configure LM Studio directly through the application interface or using the lms cli tool. Follow the steps below to configure LM Studio to browse and download LLMs on your workstation.
Open LM Studio if it's not running.
Click Get your first LLM to set up LM Studio.
Click Download to fetch the model files for the default model.
Click Start New Chat to open the LM Studio chat interface.
Click Select a model to load on the top selection bar.
Verify the downloaded model parameters, version, and size. Then, click the model to load it in your chat interface. For example, load the default deepseek-r1-distill-qwen-7b model.
Enter a prompt like Add 3 random numbers divisible by 10.
Check the number of input tokens and press Enter to send the prompt.
Verify the generated result and processing summary in the model output.
Click Power User or Developer on the bottom navigation bar to switch to advanced configuration options in LM Studio.
Click Discover on the main navigation menu.
Click Model Search to find new models to download.
Click Runtime to manage the runtime extension packs.
Click Hardware to verify the system architecture and memory.
You can change the default Guardrails policy to specify the default setting for loading models based on system memory and performance.
Click App Settings to modify the LM Studio application interface.
Click Check for updates to check for newer versions and update LM Studio to the latest version.
You can browse, download, and run LLMs in LM Studio to interact with models on your workstation. LM Studio includes a default models library linked to Hugging Face, which includes popular LLMs like DeepSeek, and Gemma. You can use the downloaded models locally without an internet connection after download. Follow the steps below to download and run LLMs in LM Studio.
Click Discover on the main navigation menu.
Click Model Search to browse the models library.
Enter a model name in the search bar.
Browse the available models based on:
Select a model from the list.
Click Download to fetch the model files and add the model to LM Studio.
Click Downloads in the bottom left corner to monitor downloads in LM Studio.
Click Models to view all downloaded models available in LM Studio.
Click LLMs or Text Embedding to view the models locally available in LM Studio.
Click Chat to open the LM Studio chat interface.
Select a model to load in LM Studio.
Type a message in the prompt field and press Enter to send the prompt.
Verify the model processing time, tokens information, and results in the chat output.
Click New Chat in the open Chats pane to create a new chat.
Click New Folder to organize and archive chats in folders.
Enabling the LM Studio server lets you run LLMs remotely on your system in headless mode without opening the graphical application. This allows you to run LM Studio on a remote server and a custom port to access downloaded models via API. Follow the steps below to enable the LM Studio server and run LLMs with unique OpenAI-like endpoints.
Click Developer to access the LM Studio server options.
Click Settings.
Replace 1234 with a custom port to set as the server port.
Click Serve on Local Network to enable LM Studio to listen for connections on all IP addresses instead of localhost 127.0.0.1. Keep the option off when using a reverse proxy like Nginx.
Click Just-in-Time Model Loading to automatically load models immediately after an API request.
Click Auto Unload unused JIT loaded models to specify the max Idle TTL to automatically unload inactive models.
Change the server status from Stopped to Running to start the LM Studio API server.
Configure your firewall to allow connections to the LM Studio API server port.
Open a new terminal on your local workstation or use an API testing tool like Postman to test LM Studio API.
Send an API request to the LM Studio API to test the connection to your server. For example, send an API request to the /v1/models endpoint, specifying your workstation's IP and LM Studio port to list all available models.
Output:
Nginx is an open-source web server and reverse proxy application that securely forwards connections to backend services. Configuring LM Studio with Nginx secures connections to your API server. It enables you to customize API requests with your domain to integrate LLMs with applications such as websites or for RAG processing in your projects. Follow the steps below to install Nginx on your Ubuntu Linux server and configure it as a reverse proxy to forward API requests to the LM Studio server.
Update the APT package index.
Install Nginx.
Start the Nginx system service.
Create a new lmstudio.conf Nginx server block configuration in the /etc/sites-available directory.
Add the following configurations to the lmstudio.conf file. Replace lmstudio.example.com with your actual domain that points to your server's public IP address.
Save and close the file.
The Nginx configuration above listens for HTTP connection requests using the lmstudio.example.com domain and forwards all incoming requests to the 1234 LM Studio API server port.
To bring this configuration into effect, link the lmstudio.conf file to the /etc/nginx/sites-enabled directory.
Test the Nginx configuration for syntax errors.
Output:
Restart Nginx to apply the configuration changes.
Install the Certbot plugin for Nginx to generate SSL certificates.
Allow HTTP connections through the default firewall to enable SSL verifications.
Restart UFW to apply the firewall changes.
Generate a new SSL certificate for your lmstudio.example.com domain.
Restart Nginx to apply the SSL configurations.
Allow HTTPS connections through the firewall.
Restart UFW.
Send a GET request to the /v1/models LM Studio server endpoint using your domain to list all available models.
Your output should be similar to the one below.
Get Information about a model available on the LM Studio server.
Send a request to the completions endpoint, specifying a model and prompt to perform text completions.
You have installed LM Studio and run Large Language Models (LLMs) on your workstation. You can download and run open-source models on your desktop workstation using LM Studio, providing multiple options to integrate LLMs into your applications. Installing LM Studio on a remote desktop server allows you to use API endpoints to interact with models and incorporate them into your applications. For more information and application options, visit the LM Studio documentation.
0 Comments
Be the first to comment and share your perspective with the community.