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.
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.
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.
- 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.
- Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
- Search for “Overleaf” in the App catalog and click Install app next to Overleaf.
- 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.
- 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_SESSIONandSERVICE_PASSWORD_ADMIN, are listed under Automatically generated values and are generated securely during installation. - 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.
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.
| Value | Meaning |
|---|---|
ADMIN_EMAIL | Admin account email address; this is also your username |
SERVICE_PASSWORD_ADMIN | Admin account password (32 characters) |
SERVICE_PASSWORD_SESSION | Key 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.”
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.
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:
- Open the app settings (gear icon) > App environment.
- Add the following values:
| Variable | Example | Meaning |
|---|---|---|
OVERLEAF_EMAIL_FROM_ADDRESS | latex@example.com | Sender address |
OVERLEAF_EMAIL_SMTP_HOST | smtp.example.com | Your email provider’s SMTP server |
OVERLEAF_EMAIL_SMTP_PORT | 587 | Port, usually 587 |
OVERLEAF_EMAIL_SMTP_SECURE | false | Use true only with port 465; use false with port 587 |
OVERLEAF_EMAIL_SMTP_USER | latex@example.com | Username with your email provider |
OVERLEAF_EMAIL_SMTP_PASS | Mailbox password | Stored only in the app environment |
- Save your changes. The app restarts and applies the values.
- 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) andoverleaf-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.
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.
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.
| Minimum | Recommended | |
|---|---|---|
| CPU | 2 vCPU cores | 4 vCPU cores |
| RAM | 3 GB | 6 GB |
| Storage | 10 GB free | 30 GB free |
You’ll also need:
- SSH access; see VPS: First connection over SSH,
- Docker with the Compose plugin and Git; see How to Set Up Docker on a Linux Server,
- a domain with an A record pointing to your server, for example
latex.example.com.
With the Toolkit, Overleaf listens only on the server itself. Open only SSH, HTTP, and HTTPS to external connections:
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.
Download the Toolkit and create the configuration:
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.rcfor the Toolkit’s basic settings, such as the port and storage locations,variables.envfor Overleaf’s own settings,versionfor 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:
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:
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:
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.
Install nginx and Certbot, then create /etc/nginx/sites-available/overleaf:
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:
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.
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.
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.
- Go to
https://latex.example.com/launchpad. - Enter an email address and a secure password, then click “Register.”
- Sign in at
https://latex.example.com/login. - Remove the
allow DEINE_IP;anddeny all;lines from the nginx block, then reload nginx:sudo systemctl reload nginx.
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:
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.
- Back up your data first, as described above.
- Update the Toolkit and switch to the new version:
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.
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.
The Community Edition doesn’t have open registration. The admin creates new accounts:
- Sign in as an admin and open the
/admin/registerpage, for examplehttps://latex.example.com/admin/register. - Enter the person’s email address and confirm.
- 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.
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:
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):
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.
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.
- 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.
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! 🙂
