Skip to content
🧮 Is Lifetime with ZapX Pass worth it? Work it out for your own servers in 30 seconds. Open the Lifetime calculator →

Set Up Overleaf on a Linux Server – Write LaTeX Together in the Browser

Install Overleaf Community Edition as a One-Click App or with the Overleaf Toolkit on your VPS and write LaTeX documents together in the browser, with PDF previews and version history.

2 December 202611 min read1 Views0 helpful

Introduction

Overleaf is an online editor for LaTeX documents. You write in your browser, see the finished PDF alongside your document, and collaborate with others on the same document at the same time. Overleaf saves every change in the version history, so you can find earlier versions. The self-hosted Community Edition is the free core of overleaf.com: your projects, files, and accounts stay on your own server instead of with a cloud provider.

In this guide, we’ll show you two ways to get started: the easy way, as a One-Click App, which gets Overleaf running with its database and admin account in just a few minutes, and the manual installation using the official Overleaf Toolkit. Then you’ll learn how to create additional users and install any missing LaTeX packages.

When Overleaf on a VPS makes sense

A self-hosted Overleaf installation is worth it if:

  • You collaborate on LaTeX documents, for example theses, papers, reports, or scripts as a team.
  • You want your documents to stay on your own server, for example if they contain unpublished research or internal material.
  • You don’t want the compilation time limits of a free cloud account. You decide how long a document can take to compile.
  • You don’t want anyone to install LaTeX locally. A browser is all you need, including on tablets and other people’s computers.

The Community Edition is less suitable if you want to open Overleaf to lots of people you don’t know. All documents are compiled in the same container, and LaTeX can run commands on the server during compilation. Only create accounts for people you trust. LDAP or SSO sign-in and isolated compilation are available only in Overleaf Server Pro, the paid version.

The easy way: Overleaf as a One-Click App

With your VPS’s One-Click Apps, you can start Overleaf with everything it needs: the Overleaf interface, a MongoDB database, and Redis. ZapX sets up the domain and HTTPS for you, and the app creates the admin account itself during the first installation.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See VPS: One-Click Apps for instructions.
  • At least 3 GB RAM, 2 vCPU cores, and 10 GB storage. 6 GB RAM, 4 vCPU cores, and 30 GB storage are recommended. As a rule of thumb, Overleaf recommends 2 cores and 3 GB RAM for about five people working at the same time, plus one core and 1 GB RAM for every additional five to ten people.
  • An address for Overleaf: either a free subdomain on zap.cloud or your own domain.

Install

  1. Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
  2. Search for “Overleaf” in the App catalog and click Install app next to Overleaf.
  3. Enter a name under App name and, under Use a custom subdomain or zap.cloud, choose the address where Overleaf should be available. Overleaf uses HTTPS with a domain.
  4. Under App configuration, enter the email address you want to use to sign in as an admin in ADMIN_EMAIL. This field is required. The other two values, SERVICE_PASSWORD_SESSION and SERVICE_PASSWORD_ADMIN, are listed under Automatically generated values and are generated securely during installation.
  5. Click Queue installation.

The app starts Overleaf Community Edition 5.5.8 along with MongoDB 6.0 and Redis 7. The first time it starts, your VPS downloads the images. This takes about 5 to 8 minutes because the Overleaf image includes LaTeX. The app then sets up the database and creates the admin account. The app will show as Online only after that.

First login: Find your login details

Once the app is Online, its card displays the Login notice: the login details were generated during installation, and you can find them in the settings under App environment.

Your username is the email address in ADMIN_EMAIL. You can find the password in the app settings (gear icon) under App environment > Automatically generated values. Click the eye icon to show a value or the copy icon to copy it.

ValueMeaning
ADMIN_EMAILAdmin account email address; this is also your username
SERVICE_PASSWORD_ADMINAdmin account password (32 characters)
SERVICE_PASSWORD_SESSIONKey Overleaf uses to secure sessions; not a login password

Open Overleaf using the app card’s Access link and sign in with your email address and password. You’ll land on the project overview. As an admin, you’ll also see the “Admin” menu at the top. Then change your password under “Account” > “Account Settings.”

Info: The admin account is created on the first startup

The One-Click App creates the admin account the very first time it starts, using ADMIN_EMAIL and SERVICE_PASSWORD_ADMIN. The /launchpad setup page therefore redirects to the login page; nobody can make themselves an admin there. On every subsequent startup, the account stays as it is: if you change the password in Overleaf, your new password remains valid, even after restarts and updates. The value in the app environment will then no longer match the account. If there isn’t a valid email address on the first startup, the app won’t create an account and won’t start.

Set up email delivery

Overleaf won’t send emails without a mail server. New users won’t receive an email with a link to set their password, and “Forgot password” won’t work. Add your email provider’s details as custom environment variables:

  1. Open the app settings (gear icon) > App environment.
  2. Add the following values:
VariableExampleMeaning
OVERLEAF_EMAIL_FROM_ADDRESSlatex@example.comSender address
OVERLEAF_EMAIL_SMTP_HOSTsmtp.example.comYour email provider’s SMTP server
OVERLEAF_EMAIL_SMTP_PORT587Port, usually 587
OVERLEAF_EMAIL_SMTP_SECUREfalseUse true only with port 465; use false with port 587
OVERLEAF_EMAIL_SMTP_USERlatex@example.comUsername with your email provider
OVERLEAF_EMAIL_SMTP_PASSMailbox passwordStored only in the app environment
  1. Save your changes. The app restarts and applies the values.

Updates and backups

  • Updates: Open the app settings (gear icon) > App update and click Check for updates. If a new version is available, install it with Apply update. Overleaf updates the database itself on startup.
  • Backups: A VPS backup from the Backups tab also backs up the volumes. The important ones are overleaf-data (project files, version history, and compiled PDFs) and overleaf-mongo-data (accounts and projects). You can also download individual projects from Overleaf as ZIP files.
  • Uninstall: Under App actions > Uninstall app, you can also delete the data volumes. This permanently deletes all projects and accounts.
Warning: LaTeX packages you install separately are lost during updates

LaTeX packages that you install using tlmgr (see below) are stored in the container, not in a volume. You’ll need to install them again after an app update or reinstallation. Make a note of any packages you add.

Manual installation

The rest of this guide covers manual installation using the official Overleaf Toolkit, for example on a server without One-Click Apps. The Toolkit is a collection of scripts built around Docker Compose that sets up Overleaf, MongoDB, and Redis for you.

Requirements

MinimumRecommended
CPU2 vCPU cores4 vCPU cores
RAM3 GB6 GB
Storage10 GB free30 GB free

You’ll also need:

Set up the firewall

With the Toolkit, Overleaf listens only on the server itself. Open only SSH, HTTP, and HTTPS to external connections:

Code
sudo apt install -y ufw
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

MongoDB and Redis won’t have any ports open to external connections. For more about ufw, see VPS: Open ports and manage the firewall on Linux.

Install using the Overleaf Toolkit

Download the Toolkit and create the configuration:

Code
sudo git clone https://github.com/overleaf/toolkit.git /opt/overleaf-toolkit
cd /opt/overleaf-toolkit
sudo bin/init

bin/init creates three files in the config folder:

  • overleaf.rc for the Toolkit’s basic settings, such as the port and storage locations,
  • variables.env for Overleaf’s own settings,
  • version for the Overleaf version started by the Toolkit.

Open config/overleaf.rc and check two lines. Overleaf should only be accessible on the server; nginx handles external access:

Code
OVERLEAF_LISTEN_IP=127.0.0.1
OVERLEAF_PORT=8080

In config/variables.env, enter the address and the name you want to use for the interface, and tell Overleaf that it’s running behind a reverse proxy:

Code
OVERLEAF_APP_NAME="Overleaf"
OVERLEAF_SITE_URL=https://latex.example.com
OVERLEAF_BEHIND_PROXY=true
OVERLEAF_SECURE_COOKIE=true
OVERLEAF_ADMIN_EMAIL=latex@example.com

You can add the SMTP settings (OVERLEAF_EMAIL_*) from the One-Click App section to the same file. Then start Overleaf in the background:

Code
sudo bin/up -d
sudo bin/logs -f web

The first startup downloads the images and sets up the database. This takes a few minutes. Stop the log output with Ctrl+C. Run sudo bin/doctor to check that everything is set up correctly.

Access over HTTPS using a reverse proxy

Install nginx and Certbot, then create /etc/nginx/sites-available/overleaf:

Code
server {
    listen 80;
    server_name latex.example.com;

    client_max_body_size 50M;

    # Only until the admin account is created: restrict access to your own IP
    allow DEINE_IP;
    deny all;

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_read_timeout 3m;
        proxy_send_timeout 3m;
    }
}

The Upgrade and Connection lines are important: Overleaf maintains a WebSocket connection for collaborative editing. Without them, the editor won’t load. Enable the site and get a certificate:

Code
sudo apt install -y nginx certbot python3-certbot-nginx
sudo ln -s /etc/nginx/sites-available/overleaf /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d latex.example.com

For more details, see VPS: Set Up an nginx Reverse Proxy on Linux and VPS: Create an SSL Certificate (Let’s Encrypt) for Linux Servers.

First visit and admin account

With a manual installation, you create the admin account in your browser. Whoever does this first becomes the admin. That’s why the allow and deny lines in the nginx block initially restrict access to your own IP address.

Warning: Never leave Launchpad open to the internet

Until an admin account exists, anyone who visits /launchpad can make themselves an admin. Create the account immediately after startup, and only then make the page accessible to others.

  1. Go to https://latex.example.com/launchpad.
  2. Enter an email address and a secure password, then click “Register.”
  3. Sign in at https://latex.example.com/login.
  4. Remove the allow DEINE_IP; and deny all; lines from the nginx block, then reload nginx: sudo systemctl reload nginx.

Back up your data

With the Toolkit, all data is stored in the data folder inside the Toolkit directory: data/overleaf (project files and version history), data/mongo (accounts and projects), and data/redis. To create a full backup, briefly stop Overleaf:

Code
cd /opt/overleaf-toolkit
sudo bin/stop
sudo tar czf /root/overleaf-backup-$(date +%F).tar.gz config data
sudo bin/start

Also store the backup somewhere off the server. To back up without downtime, use mongodump for the database and copy data/overleaf; however, the two parts may be a few seconds out of sync.

Update Overleaf

  1. Back up your data first, as described above.
  2. Update the Toolkit and switch to the new version:
Code
cd /opt/overleaf-toolkit
sudo bin/upgrade

bin/upgrade downloads the latest scripts, shows you the available Overleaf version, and asks whether it should restart the containers. Before making major version upgrades, read the notes in the Toolkit changelog. You’ll need to reinstall any LaTeX packages you added after an update.

Working with Overleaf

After your first login, you’ll land on the project overview. Click “New Project” to create an empty project, start with a sample template, or upload an existing project as a ZIP file.

Create additional users

The Community Edition doesn’t have open registration. The admin creates new accounts:

  1. Sign in as an admin and open the /admin/register page, for example https://latex.example.com/admin/register.
  2. Enter the person’s email address and confirm.
  3. Overleaf generates a link that the person can use to set their password. If email delivery is configured, the link is sent by email. Otherwise, copy the link and send it yourself.

You can then share projects with other accounts in the editor using “Share,” with either read or write access.

Install missing LaTeX packages

The Overleaf image includes only the smallest basic TeX Live setup (the “basic” scheme, about 200 MB). Even common packages such as TikZ, biblatex, and the German language files for babel are missing. If compilation reports “File `paket.sty' not found,” install the package in the Overleaf container. Connect to your server over SSH and first find the container name:

Code
docker ps --format '{{.Names}}' | grep -E 'overleaf|sharelatex'

Then install the missing package and link the programs again (replace CONTAINER with the name from the first command):

Code
docker exec CONTAINER tlmgr install PAKETNAME
docker exec CONTAINER tlmgr path add

The package name may differ from the filename: TikZ is included in the pgf package, and the German language files are in babel-german. For German documents using TikZ and biblatex, for example, install tlmgr install pgf biblatex babel-german.

With the Toolkit, simply start a shell in the container using sudo bin/shell. If you want all packages, install the full TeX Live distribution with tlmgr install scheme-full. This uses several additional gigabytes of storage and takes a while.

Tip: Keep packages permanently

With the Toolkit, save an extended container as your own image using docker commit and enter its name in config/version, as described in the Toolkit documentation for TeX Live. With the One-Click App, simply reinstall the packages after an update.

Community Edition limitations

  • All projects are compiled in the same container. An account on your instance can access files in the container through LaTeX. Only create accounts for people you trust.
  • LDAP, SAML, or OAuth sign-in, isolated compilation, and official support are available only in Overleaf Server Pro.
  • Synchronization with Git, GitHub, or Dropbox, as available on overleaf.com, isn’t included in the Community Edition. Exchange projects by downloading and uploading ZIP files.

Conclusion

With Overleaf on your server, you can write LaTeX documents together in the browser, with PDF previews and version history, while your data stays with you. To go with it, the guide Set Up draw.io on a Linux Server shows you how to draw diagrams and sketches for your documents in your own editor.

If you have any other questions or need help, our support team is available every day! 🙂

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

For most people, the One-Click App is the quickest option: Overleaf, the database, HTTPS, and the admin account are ready in minutes, and you can install updates in the ZapX dashboard. Manual installation with the Overleaf Toolkit is a good choice if your server doesn’t have One-Click Apps, you use your own reverse proxy, or you want to keep a custom image with the full TeX Live distribution.
For the One-Click App, sign in with the email address you entered as ADMIN_EMAIL during installation. The app generates the password during installation. You can find it in the app settings (gear icon) under App environment > Automatically generated values, as SERVICE_PASSWORD_ADMIN. With a manual installation using the Overleaf Toolkit, create the admin account yourself at /launchpad.
The Community Edition doesn’t have open registration. As an admin, create new accounts at /admin/register. Overleaf generates a link that each person can use to set their password. If SMTP is configured, the link is sent by email; otherwise, you’ll need to send it yourself.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.