How to self-host LibreChat on your own server

We earn commissions when you shop through the links below.

About 30 minutes · Commands checked against the official documentation on November 26, 2026

LibreChat is an open-source chat interface for many AI models and agents. Self-hosting it gives you and your team one private place to use them, with conversations stored on your own server.

This guide follows LibreChat's own guide for a remote Ubuntu server, which uses a Compose file built for deployment. You end with LibreChat at http://<your server's IP address> and your own account.

LibreChat is #49 on the all-time Top 100 this week.

You will need

  • A Linux server running Ubuntu 24.04 LTS
  • Git and OpenSSL (both are on standard Ubuntu server images)
  • Comfort with SSH, a terminal and a text editor such as nano
  1. 1.Get a server

    Rent a virtual private server (VPS) running Ubuntu 24.04 LTS. LibreChat's documentation doesn't publish a minimum size, and its server guide was written for a DigitalOcean Droplet. This setup runs LibreChat together with its database, search and web server, so we'd start with 2 CPUs and 4 GB of memory.

    Any provider works. When it is created you will have an IP address and a way to log in over SSH, usually as root or as a user that can run sudo.

    Where to run it

    Open-source agents are self-hosted. These are places to run one.

    Affiliate links: we may earn a commission if you sign up, at no cost to you. Partners are hosting providers only, and they have no influence on any ranking or score.

  2. 2.Install Docker

    Log in to the server over SSH, then install Docker Engine and the Compose plugin from Docker's official repository:

    # Add Docker's official GPG key:
    sudo apt update
    sudo apt 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:
    sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
    Types: deb
    URIs: https://download.docker.com/linux/ubuntu
    Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
    Components: stable
    Architectures: $(dpkg --print-architecture)
    Signed-By: /etc/apt/keyrings/docker.asc
    EOF
    
    sudo apt update
    
    # Install Docker:
    sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

    Check that both are available. If Docker isn't running, start it with sudo systemctl start docker.

  3. 3.Check Docker

    docker --version
    docker compose version
  4. 4.Download LibreChat

    As your own user, not root, clone the repository and enter it:

    git clone https://github.com/LibreChat-AI/LibreChat.git
    cd LibreChat/
  5. 5.Create the config file

    The deployment Compose file requires a librechat.yaml file, even if you don't customise anything yet. Open a new one in the editor:

    nano librechat.yaml

    Paste the minimum configuration below, then save with Ctrl+X, Y and Enter.

    # For more information, see the Configuration Guide:
    # https://www.librechat.ai/docs/configuration/librechat_yaml
    
    # Configuration version (required)
    version: 1.3.19
    
    # This setting caches the config file for faster loading across app lifecycle
    cache: true
  6. 6.Create the environment file

    Copy the example environment file, and generate a secret for the admin panel:

    cp .env.example .env
    openssl rand -hex 32

    Open .env (nano .env) and add the generated value as ADMIN_PANEL_SESSION_SECRET. The admin panel won't start without it.

    LibreChat creates temporary encryption keys on first start. For anything beyond a trial, set permanent values for CREDS_KEY, CREDS_IV, JWT_SECRET and JWT_REFRESH_SECRET in the same file, using LibreChat's credentials generator (linked below). Keep these values private and don't change them later, or saved data can become unreadable.

  7. 7.Start LibreChat

    sudo systemctl start docker
    sudo docker compose -f ./deploy-compose.yml up -d

    It's safe to close the terminal; LibreChat keeps running.

  8. 8.Create your account, then close registration

    Open http://<your server's IP address> in a browser and sign up. Then, so strangers can't create accounts, open .env again and set:

    ALLOW_REGISTRATION=false

    Apply the change by stopping and starting LibreChat:

    sudo docker compose -f ./deploy-compose.yml down
    sudo docker compose -f ./deploy-compose.yml up -d

Custom domain and HTTPS

This Compose file serves LibreChat through NGINX on port 80. LibreChat's documentation explains how to point a domain at it and add HTTPS, with guides for NGINX, Traefik and Cloudflare, linked below.

Updating

LibreChat's remote guide gives these manual update commands, run from the LibreChat folder:

sudo docker compose -f ./deploy-compose.yml down, then git pull, then sudo docker compose -f ./deploy-compose.yml pull, then sudo docker compose -f ./deploy-compose.yml up -d.

Backups

Back up the .env file and the librechat-data Docker volume, which holds LibreChat's generated keys. Losing them can make encrypted records unreadable.

Sources

Every command above is taken from these pages. If a step has changed, they are the authority.