If a web server is already running on port 80, stop it before running the command.
Installing Overleaf Community Edition
- media
- Overleaf
- ubuntu
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.
Before you start
To complete the actions presented below, you must have:
- A Scaleway account logged into the console
- Owner status or IAM permissions
- An SSH key
- An Instance with Docker installed and at least 30 GB of storage
- Installed
git
on your Instance - Properly configured DNS A/AAAA records pointing to your Instance’s public IP
Preparing the environment
-
SSH into your Instance:
ssh root@<YOUR-INSTANCE-IP> -
Ensure Docker is installed:
- If Docker is not installed, follow the Docker Installation Guide.
- Verify Docker installation:
docker --version
-
Create a directory for Overleaf:
mkdir -p /opt/overleaf-toolkitcd /opt/overleaf-toolkit -
Clone the Overleaf repository from GitHub:
git clone https://github.com/overleaf/toolkit.git /opt/overleaf-toolkit -
Initialize the configuration:
cd /opt/overleaf-toolkit./bin/init -
Start the application and its containers:
./bin/upNote
Stopping the application and updating Overleaf’s configuration
- Stop the application with
CTRL+C
. - Edit the Overleaf configuration file:
nano ./config/overleaf.rc
- Modify the following line:
Change it to:OVERLEAF_PORT=80OVERLEAF_PORT=8877
- Save and exit.
Configuring a systemd service
- Create a systemd service file:
nano /etc/systemd/system/overleaf.service
- Add the following content:
[Unit]Description=Overleaf Community Edition[Service]User=rootWorkingDirectory=/opt/overleaf-toolkitExecStart=/opt/overleaf-toolkit/bin/upRestart=alwaysRestartSec=10[Install]WantedBy=multi-user.target
- Save and exit the editor.
- Reload systemd:
systemctl daemon-reload
- Enable and start the service:
systemctl enable overleaf.servicesystemctl start overleaf.service
- Check the service status:
systemctl status overleaf.service
Installing LaTeX packages
- Update the TeX Live Manager:
docker exec sharelatex tlmgr update --self
- Install the full TeX Live package:
docker exec sharelatex tlmgr install scheme-full
- Replace
sharelatex
with the name of the Share LateX container. Usedocker 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.
Configuring SSL
- Install Certbot and nginx
apt install python3-certbot-nginx nginx
- Obtain an SSL certificate
sudo certbot --nginx certonly
- Add a daily cron job for certificate renewal:
Add the following line to the crontab:crontab -e30 4 * * * certbot renew --pre-hook "service nginx stop" --post-hook "service nginx start"
Configuring Nginx
- Edit the Nginx configuration:
nano /etc/nginx/sites-enabled/default
- Replace the file content with:
server {listen 80;listen [::]:80;server_name my.overleaf-instance.tld;location / {return 301 https://$server_name$request_uri;}}server {listen [::]:443 ssl ipv6only=on;listen 443 ssl;server_name my.overleaf-instance.tld;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;proxy_set_header X-Forwarded-For $remote_addr;add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";server_tokens off;add_header X-Frame-Options SAMEORIGIN;add_header X-Content-Type-Options nosniff;client_max_body_size 50M;location / {proxy_pass http://localhost:8877;proxy_set_header X-Forwarded-Proto $scheme;proxy_http_version 1.1;proxy_set_header Upgrade $http_upgrade;proxy_set_header Connection "upgrade";proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;proxy_read_timeout 3m;proxy_send_timeout 3m;access_log /var/log/nginx/overleaf.access.log;error_log /var/log/nginx/overleaf.error.log;}}Note
Replace
my.overleaf-instance.tld
with your Overleaf domain name in the configuration. - Save and restart Nginx:
service nginx restart
Creating a first admin user
-
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. -
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.