Overleaf CE – Self Host your own LaTeX-Server [Tutorial]

Using LaTeX regularly for University, i was once searching for a good and easy way to write my latex-files. I then stumbled upon “Overleaf”. It’s a web-based multi-user platform for creating latex-documents. It gives you a split-screen on the web with a good editor on the left and your compiled PDF on the right. It also comes with all latex-extensions – so there is no more searching for how to install X and Y.

There is a free version to be used on their Servers, good enough for simple assignments. But once you get to writing bigger essays or a thesis, the basic free version does not have enough resources to compile your complex document. At least that ist true for the thesis-template I got. Now there are two possibilities: either you get a paid subscription to get more compilation-time or you setup your own instance of overleaf on your own server. Obviously I chose the latter self hosting option and got into hours of work, because I did not know, what I was doing. But in this article, I will save you those hours and just show you, how to easily install Overleaf Community Edition for free on your own Server.

I just created a new Instance on a new Debian-10 Server, so these Steps will be shown here. If you got a differing System, the steps will be similar but not the same. So you should just use google to translate my Steps to your System.

I installed my Instance as root on a local Server, that will never be seen on the Internet. If your plans differ, please take precautions!

Step 0: Update && upgrade

Obviously we want to work on the newest packages, so please upgrade your System:

apt update && apt full-upgrade && apt auto-remove

Step 1: Install docker

First up we will need docker. I followed this tutorial by DigitalOcean: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-debian-10
Here is the short form:

apt install apt-transport-https ca-certificates curl gnupg2 software-properties-common
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt install docker-ce

To check, if docker is running now, type:

systemctl status docker

You should see a positive response.

Next up, we need docker-compose. For that I used another DigitalOcean Tutorial: https://www.digitalocean.com/community/tutorials/how-to-install-docker-compose-on-debian-10-de
But I also got the newest Version-Number directly from docker on this page: https://docs.docker.com/compose/install/

First Step here is to execute the following command. BUT: you probably need to update the Version-Number. Right now the newest version is 1.29.2 for me, but the docker-page will contain the newest version.

curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Next up, you need to make the binary executable, you just downloaded:

chmod +x /usr/local/bin/docker-compose

After that, do:

ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

And now you should have successfully installed docker-compose – check that with:

docker-compose --version

Step2: Install Overleaf

Next up, we will use the Overleaf Toolkit to install Overleaf. You can find their Quick-Start-Guide here: https://github.com/overleaf/toolkit/blob/master/doc/quick-start-guide.md

Here is a short summary. First clone that git-repo to your machine:

git clone https://github.com/overleaf/toolkit.git ./overleaf

and cd into the newly created folder:

cd overleaf

To create the local configuration, run the following command as is:

bin/init

If you also want a quick-n-dirty install, you want to update config/overleaf.rc with your favorite editor (it’s vim for me) and change the SHARELATEX_LISTEN_IP to 0.0.0.0:

vim config/overleaf.rc
SHARELATEX_LISTEN_IP=0.0.0.0

This will enable you to directly access Overleaf on your servers local IP.

Next you can start and let Overleaf install everything with:

bin/up

This will be an attached session. Later you can use

bin/start

to start Overleaf detached. This should also enable Overleaf to start with your Server, so it always runs when your server is running.

If the install was successful, you can go to your IP in your Browser and the Login-Screen of Overleaf. To create an admin-account however you want to go to:

http://your-ip-here/launchpad

Add your credentials and then go back to the login-page to log in.

And here you are with a finished install of Overleaf.

However I found that my Thesis-Template is not able to be compiled in this basic install. So I have to update TeX Live, the actual compiler Overleaf uses. This will be described in the next Step. If you find your latex-documents to be compiled just fine, then just stop here, explore and enjoy Overleaf.

Step3: Update TeX Live

Up front: The Update will take a lot of time! Once you entered the commands (which takes less than 5 mins) the update will take more than an hour – on my hardware it took about 1.5 hours. So make sure you got time for that!

First up, go into your Overleaf-docker-container. You must there fore be in the overleaf-toolkit-folder we created in Step 2. From here you can execute the following command:

bin/shell

Now that you are in the docker-container, you can download the tex-live update-script:

wget https://mirror.clientvps.com/CTAN/systems/texlive/tlnet/install-tl-unx.tar.gz

Next up: extract the folder and cd into it:

tar -xf install-tl-unx.tar.gz
cd install-tl-*

Now you can start the perl-installscript with:

perl install-tl

It might ask you, if you want to use previous configs, I just denied that. Next start the installation with i when it gives you the opportunity:

Enter command: i

Now it will work and work and work, you will see that it is going to install over 4000 packages, so be patient.

After the installation is done, i restarted the Server to be on the save side and enjoyed by perfectly functioning Overleaf-Server.

And now go and enjoy your perfectly working and up to date LaTeX Server that is self hosted.

6 comments

  1. Good post. I learn something totally new and challenging on blogs I stumbleupon every day. It will always be interesting to read through articles from other writers and use a little something from other sites.

    1. Hi, yes it does. You can let others create their own account on your overleaf-server and then share your project with them! Your Server needs to be accessible to them of course 😉

  2. Could you make a tutorial on how to host this on a server, and login via a browser? Would be very usefull, and I can’t seem to find this anywhere online. Thanks 🙂

Comments are closed.

Cookie Consent with Real Cookie Banner