Skip to content

Instantly share code, notes, and snippets.

@moschlar
Last active March 25, 2019 05:01
Show Gist options
  • Save moschlar/2b941f75a44fbac69993 to your computer and use it in GitHub Desktop.
Save moschlar/2b941f75a44fbac69993 to your computer and use it in GitHub Desktop.
Build and install ShareLaTeX in Ubuntu 14.04 LTS

Since the official ShareLaTeX documentation is primarily written with Ubuntu 12.04 LTS in mind, I tried to re-build the provided .deb from scratch using Ubuntu 14.04 TLS with the least amount of non-standard or non-packaged software.

Here are all the steps that were required (with sudo since Ubuntu doesn't want you to be root).

First, install lots of packages - note that no additional repositories are required! (Dependencies):

$ sudo apt-get update
$ sudo apt-get install git build-essential curl python-software-properties zlib1g-dev zip unzip
$ sudo apt-get install ruby-dev
$ sudo apt-get install nodejs npm
$ sudo apt-get install redis-server
$ sudo apt-get install mongodb
$ sudo apt-get install aspell
$ sudo apt-get install texlive latexmk

To satisfy grunt, we need to have an executable called node:

$ sudo ln -s `which nodejs` /usr/local/bin/node

Additionally, we need some packages through external package managers:

$ sudo npm install -g grunt-cli
$ sudo gem install fpm

Now there might be a ~/tmp directory owned by root. We need to remove that so we can continue as a normal user:

$ sudo rmdir ~/tmp

Now we can clone the repository and install all additional dependencies (Setting up a Development Environment, make sure to check out the release branch, as per #comment-1346019):

$ git clone -b release https://github.com/sharelatex/sharelatex.git
$ cd sharelatex
$ npm install

Now we can install the actual ShareLaTeX services:

$ grunt install

After that is done, we can run the provided sanity check:

$ grunt check --force
[...]
Running "check:latexmk" task
Checking latexmk is installed... >> FAIL.
>> latexmk version is too old (4.35). Must be 4.39 or greater.
>> This is a not a fatal error, but compiling will not work without latexmk
Warning: latexmk is too old Use --force to continue.
[...]

In my case, it complained about latexmk being too old, but I ignored that for now, compiling simple LaTeX documents seemed to work anyway.

Now you need to apply the patch below to change one of the dpkg dependencies since the package in the official Ubuntu repositories is called just mongodb instead of mongodb-org:

$ wget https://gist.githubusercontent.com/moschlar/2b941f75a44fbac69993/raw/mongodb-dep.patch
$ patch -p1 < mongodb-dep.patch

After that, we create a huge .deb package:

$ grunt build:deb

Then it should be sufficient to run

$ dpkg -i sharelatex_0.0.1_amd64.deb

(Installing on Ubuntu 12.04 from dpkg (.deb)) and your ShareLaTeX should be running on http://localhost:3000.

And finally, as you might guess, if you want to use Nginx as a Reverse Proxy, you don't need no external repository, the packaged version in the Ubuntu repository is recent enough:

$ sudo apt-get install nginx
diff --git a/Gruntfile.coffee b/Gruntfile.coffee
index 6f618a8..345f6cc 100644
--- a/Gruntfile.coffee
+++ b/Gruntfile.coffee
@@ -440,7 +440,7 @@ module.exports = (grunt) ->
command.push(
"--depends", "redis-server > 2.6.12"
- "--depends", "mongodb-org > 2.4.0"
+ "--depends", "mongodb > 2.4.0"
"--depends", "nodejs > 0.10.0"
)
@wngr
Copy link

wngr commented Dec 1, 2015

See overleaf/overleaf#292

After reverting all the changes from the mentioned commit, deb builds and installs fine.

Copy link

ghost commented Jan 3, 2016

I had to install the following package before 'npm install' would run without error:
( The error was 'make: *** [Release/obj.target/kerberos/lib/kerberos.o] Error 1' )

sudo apt-get install libkrb5-dev

The afore mentioned problem with the fix can be solved (as stated by wngr) by reverting the removal of the patch with:

git revert c96d713

After the revert one can procede with patching the file according to the instractions above.

@chriskvik
Copy link

I'm still having issues on 14.04, installed the 2.6 version of mongodb, which is running and operational. I reverted to the c96d713 build, but it complains when I'm trying to dpkg -i with.

$ sudo dpkg -i sharelatex_0.0.1_amd64.deb

Preparing to unpack sharelatex_0.0.1_amd64.deb ...
Unpacking sharelatex (0.0.1) over (0.0.1) ...
dpkg: dependency problems prevent configuration of sharelatex:
sharelatex depends on mongodb (>> 2.4.0); however:
Package mongodb is not installed.

Can anyone assist me with this error? I'm positive mongodb is installed and running.

@henryoswald
Copy link

ShareLaTeX is only being updated via docker now to try and make the process as simple as possible as many things come pre configured.

@aruntraj83
Copy link

By clicking register it shows "Please contact placeholder@example.com to create an account." . What is the admin password to login with 'placeholder@example.com'. How to change administrator account? How to create other normal users?

@gdistasi
Copy link

Can someone provide me with a VM image with sharelatex installed? my email is gdistasi at gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment