Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 111 additions & 90 deletions tutorials/overleaf/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,90 @@ meta:
content:
h1: Installing Overleaf Community Edition
paragraph: This page shows you how to install Overleaf Community Edition on Ubuntu Linux
tags: media Overleaf ubuntu
tags: media Overleaf ubuntu
categories:
- instances
dates:
validation: 2024-08-12
validation: 2025-01-09
posted: 2023-10-02
---

Overleaf is a collaborative writing and publishing system that uses LaTeX, a typesetting software that allows for the creation of structured, professional documents online.

Overleaf is a collaborative writing and publishing system that uses LaTeX, a typesetting software that allows for creating structured, professional documents online.

It is particularly favored by academics and professionals for producing scientific documents, research papers, theses, and presentations due to its precise formatting and styling capabilities. Overleaf also supports real-time collaboration between multiple authors.

<Macro id="requirements" />

- A Scaleway account logged into the [console](https://console.scaleway.com)
- [Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization
- [Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission)
- An [SSH key](/identity-and-access-management/organizations-and-projects/how-to/create-ssh-key/)
- An [Instance](/compute/instances/how-to/create-an-instance/) running on the Docker image or with Docker installed
- An [Instance](/compute/instances/how-to/create-an-instance/) with Docker installed and at least **30 GB of storage**
- Installed `git` on your Instance
For optimal performance, we recommend running this tutorial on an Instance with more than 30 GB of storage.

<Message type="tip">
Make sure to run this tutorial on an Instance running the [Docker InstantApp image](/tutorials/docker-instantapp/) or make sure [Docker is installed](/tutorials/install-docker-ubuntu-jammy-jellyfish/) on the Instance, as Overleaf requires Docker.
</Message>
- Properly configured DNS A/AAAA records pointing to your Instance's public IP

## Installing Overleaf community edition

1. Connect to your Instance using SSH:
```
### Preparing the environment
1. SSH into your Instance:
```bash
ssh root@<YOUR-INSTANCE-IP>
```
2. Use `git` to download the Overleaf code repository:
2. Ensure Docker is installed:
- If Docker is not installed, follow the [Docker Installation Guide](/tutorials/install-docker-ubuntu-jammy-jellyfish/).
- Verify Docker installation:
```bash
docker --version
```

3. Create a directory for Overleaf:
```bash
mkdir -p /opt/overleaf-toolkit
cd /opt/overleaf-toolkit
```

4. Clone the Overleaf repository from GitHub:
```bash
git clone https://github.com/overleaf/toolkit.git /opt/overleaf-toolkit
```
3. Enter the Overleaf `overleaf-toolkit` directory.
```

5. Initialize the configuration:
```bash
cd /opt/overleaf-toolkit
```
4. Run the following command to copy the configuration files:
```
./bin/init
```
5. Download and start the Overleaf container and its requirements:
```

6. Start the application and its containers:
```bash
./bin/up
```
<Message type="tip">
* If a web server is already running on port 80, be sure to stop it before executing the above command.
* Downloading and configuring the application for the first start may take some time.
<Message type="note">
If a web server is already running on port 80, stop it before running the command.
</Message>
6. Stop the application by pressing `CTRL+C`.
7. Open the file `./config/overleaf.rc` in a text editor and edit the `NGINX_HTTP_PORT=80` line. Set the value to `NGINX_HTTP_PORT=8877`, then save the file and exit the editor.

## Configuring a systemd script
## Stopping the application and updating Overleaf's configuration

Once Overleaf runs correctly, you can create a systemd daemon service.
1. Stop the application with `CTRL+C`.
2. Edit the Overleaf configuration file:
```bash
nano ./config/overleaf.rc
```
3. Modify the following line:
```bash
OVERLEAF_PORT=80
```
Change it to:
```bash
OVERLEAF_PORT=8877
```
4. Save and exit.

1. Create and open the `/etc/systemd/system/overleaf.service` file in a text editor of your choice and paste the following content into it:
```
[Unit]
Description=Overleaf Community Edition

[Service]
User=root
WorkingDirectory=/opt/overleaf-toolkit
ExecStart=/opt/overleaf-toolkit/bin/up
Restart=always
RestartSec=10

[Install]
WantedBy=multi-user.target
## Configuring a systemd service

1. Create a systemd service file:
```bash
nano /etc/systemd/system/overleaf.service
```
2. Add the following content:
```
[Unit]
Description=Overleaf Community Edition

Expand All @@ -91,69 +102,70 @@ Once Overleaf runs correctly, you can create a systemd daemon service.
[Install]
WantedBy=multi-user.target
```
2. Save the file and exit the text editor.
3. Reload systemd by running the following command:
```
3. Save and exit the editor.
4. Reload systemd:
```bash
systemctl daemon-reload
```
4. Enable the `overleaf.service` to be started on reboot:
```
5. Enable and start the service:
```bash
systemctl enable overleaf.service
```
5. Start the Overleaf service:
```
systemctl start overleaf.service
```
6. Check the status of the Overleaf service:
```
6. Check the service status:
```bash
systemctl status overleaf.service
```

## Installing LaTeX packages

The LaTeX packages can now be installed, using TeX Live.

1. Run the following command to launch the Texlive manager update:
1. Update the TeX Live Manager:
```bash
docker exec sharelatex tlmgr update --self
```
docker exec Overleaf Community Edition tlmgr update --self
2. Install the full TeX Live package:
```bash
docker exec sharelatex tlmgr install scheme-full
```
2. Run the following command to launch the full `texlive` installation:
```
docker exec Overleaf Community Edition tlmgr install scheme-full
```
<Message type="note">
The installation of `texlive` may take a while.
</Message>
<Message type="note">
- Replace `sharelatex` with the name of the Share LateX container. Use `docker ps` to find it.
- The installation of `textlive` may take a while and take up a lot of storage space. Ensure your Instance has sufficent storage available.
</Message>

## Configuring Nginx
## Configuring SSL

This tutorial uses [NGINX](https://nginx.org/en/) with [Let's Encrypt](https://letsencrypt.org/) and [CertBot](https://certbot.eff.org/) as an SSL-enabled reverse proxy to secure the connection between the client and our server.
1. Install Certbot and nginx
```bash
apt install python3-certbot-nginx nginx
```

1. Install Certbot on the server:
```
apt install python3-certbot-nginx
```
2. Generate the certificate, by running the following command:
```
sudo certbot --nginx certonly
```
2. Obtain an SSL certificate
```bash
sudo certbot --nginx certonly
```

SSL certificates issued by Let's Encrypt are valid for 90 days. Certbot comes with the option to automatically renew the certificate.
3. Configure a cron job that launches Certbot daily to check the status of the certificate. Open the crontab by typing:
```
3. Add a daily cron job for certificate renewal:
```bash
crontab -e
```
4. Add the following line which will stop Nginx, renew the certificate, and restart the web server daily at 4:30 in the morning:
Add the following line to the crontab:
```bash
30 4 * * * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"
```
30 4 * * * /opt/letsencrypt/certbot-auto renew --pre-hook "service nginx stop" --post-hook "service nginx start"

## Configuring Nginx

1. Edit the Nginx configuration:
```bash
nano /etc/nginx/sites-enabled/default
```
5. Edit the `/etc/nginx/sites-enabled/default` file so that it looks like the example below. This allows you to configure Nginx in a way that will serve our Overleaf Community Edition site as the default site:
2. Replace the file content with:
```
server {
listen 80;
listen [::]:80;

server_name my.overleave-instance.tld;
server_name my.overleaf-instance.tld;

location / {
return 301 https://$server_name$request_uri;
Expand All @@ -164,10 +176,10 @@ This tutorial uses [NGINX](https://nginx.org/en/) with [Let's Encrypt](https://l
listen [::]:443 ssl ipv6only=on;
listen 443 ssl;

server_name my.overleave-instance.tld;
server_name my.overleaf-instance.tld;

ssl_certificate /etc/letsencrypt/live/my.overleave-instance.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/my.overleave-instance.tld/privkey.pem;
ssl_certificate /etc/letsencrypt/live/my.overleaf-instance.tld/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/my.overleaf-instance.tld/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

Expand All @@ -191,14 +203,23 @@ This tutorial uses [NGINX](https://nginx.org/en/) with [Let's Encrypt](https://l
proxy_read_timeout 3m;
proxy_send_timeout 3m;

access_log /var/log/nginx/Overleaf Community Edition.access.log;
error_log /var/log/nginx/Overleaf Community Edition.error.log;
access_log /var/log/nginx/overleaf.access.log;
error_log /var/log/nginx/overleaf.error.log;
}
}
```
6. Restart Nginx with the following command:
```
<Message type="note">
Replace `my.overleaf-instance.tld` with your Overleaf domain name in the configuration.
</Message>
3. Save and restart Nginx:
```bash
service nginx restart
```
You can now reach your Overleaf installation at `https://<YOUR-INSTANCE-IP>/launchpad`.
Open a web browser and navigate to this page to set up your instance's administrator credentials, log in, and you can start drafting your documents, and invite collaborators to work with you.

## Creating a first admin user

1. Open your browser and navigate to `<http://<YOUR_OVERLEAF_DOMAIN>/launchpad/`. A form displays, prompting you to set up your admin account by entering an email and password. After filling in the credentials, click **Register**.

2. Follow the link to the login page (`<http://<YOUR_OVERLEAF_DOMAIN>/login>/`) and enter the credentials you just created. Upon successful login, you'll be directed to a welcome page.

To begin using Overleaf, click the green button at the bottom of the welcome page. For more information on how to use Overleaf, refer to the [official documentation](https://www.overleaf.com/learn).
Loading