Debian and Ubuntu have very good texlive packaging. But I'd like to use tlmgr to have a more fine-grained control about upgrades and which packages I want to be installed. So how do I install "vanilla" TeXLive on Debian/Ubuntu? Also how do I make dpkg aware that I have TeXLive installed?

Could you please announce what vanilla is good for? Just because many people like me are using other distributions. I would like to look for a similar package.
–
strpeterFeb 11 '13 at 23:27

1

I successfully installed TeXLive 2013 on Ubuntu 12.04 following silex's answer (thanks for that!). Only problem I encountered was a bunch of not really working CTAN mirrors. You may need to change your default mirror by sudo perl install-tl -repository ftp.fu-berlin.de/tex/CTAN for example.
–
user34273Jul 28 '13 at 5:26

9 Answers
9

Tricking Ubuntu into satisfying the package dependencies is more involved and requires using the equivs package. There are basic guidelines for doing so in this post on TeXblog (an unofficial blog). (This page is a bit old and was aimed at older versions of Ubuntu.) The package list there is a bit old, but the same overall procedure should still work. I’m afraid I don’t have a list offhand of what the dummy package should contain; maybe someone else will. (You can always just create new dummy packages as need be if you try to install something it tells you you have unsatisfied texlive dependencies.)

According to the Ubuntu package listing, the texlive package is a dummy package whose only purpose is to install a decent selection of dependencies. So it is possible to install this texlive package without installing any of its dependencies. This requires using dpkg instead of aptitude (as far as I can see, and I don't know if it's possible through the synaptic package manager): passing the --ignore-depends=texlive option to dpkg will cause it to forego the dependency check. Then anything that depends on texlive will afterwards install fine (I believe), though if something depends on, say, texlive-bin then it will complain.

Whilst checking the options for aptitude and dpkg for the above, I came across the following snippet from aptitude: the command

aptitude install texlive&m

will mark texlive as having been manually installed. (Note that the & will probably need some sort of shell escaping to avoid it being interpreted by the shell.) I believe this basically says to the system "I've installed this myself, so you can stop bothering with it.".

Possibly the easiest solution (and the one I use myself) is to simply ignore the system one and install your own version as well. If you do this right, you get the best of both worlds because one possible problem with replacing the system version with your own version is that the upgade may break some dependencies from other packages. It's less likely with something like TeX, but you can imagine that lots might go wrong if you upgrade one of the core system libraries without upgrading all the programs that use it. This is what the /usr/local directory is for. Put your installation of TeXLive in /usr/local/texlive or somewhere using the standard installation (as mentioned by frabjous, for example). By ensuring that /usr/local appears before /usr/bin in your path, and that $TEXMFCNF points to the right place, you can effectively ignore the system installation whilst being able to fall back on it if necessary.

Except that by policy none of the packages depend on the "decent selection packages" e.g. texlive since they are subject to change to something like equivs will be required.
–
DimaAug 5 '10 at 10:39

@Dima: I was afraid of that. In that case, I'd go for option 3 with option 2 if you really don't want to install the system version.
–
Loop SpaceAug 5 '10 at 11:17

2

Ad 2: packages marked as "manually installed" are still regular packages. The difference is that if all packages that depend on them are removed the "manually installed" packages will be kept. In contrast, if all packages that depend on an "automatically installed" package are removed, the package itself will be removed too. By default, manually installed packages are those that you actually select for installation in aptitude, automatically installed are those pulled in as dependencies. You can override this by marking a package as manually or automatically installed. So 2 would not work.
–
Jan HlavacekAug 29 '10 at 3:32

Note that the install-tl-20140618 folder may be named differently. You can probably type install-tl and then press tab to autocomplete the folder name.

Now the installation can begin, run:

sudo ./install-tl

If you prefer a "cut-and-paste" sequence of commands for downloading the installation script, opening the archive, changing to the directory into which unarchiving took place, and then starting installation, try this:

(The above is supposed to be robust and idempotent, i.e., it should work even if you apply it a second time, and even if the first application went wrong.)

The command line instruction sudo ./install-tl starts the installation prrocess. You can change all kind of options here, most of the time the default options are correct.
In some cases changing the options can, of course, be helpful. Not installing the doc and source trees will save you a lot (1.8 GiB, 50%) of disk space. This comes with the downside of having to look up documentation online, instead of locally.

If you want to reduce disk space further you can also change the installation scheme or collections, but this will result in not having certain packages installed by default. You can, however, install them later through the TeX live manager.

Press i to start installation. Installation is likely to take a long time, say between an hour and three hours (even on relatively fast connections). As usual, your mileage may vary, but if fewer components are selected in your settings, the process is hastened, and this components can be easily installed later.

If, for some reason, the installation is interrupted it can probably be resumed by running the installer again. This will prompt you to continue the installation. If you want to start the installation from the beginning it's probably wise to remove the installed elements:

sudo rm -rf /usr/local/texlive/2014

Finalising the installation

If the installation completes successfully you will want to make sure your operating system can find it. This can be done by creating a symbolic link:

sudo ln -s /usr/local/texlive/2014/bin/* /opt/texbin

(Note: there should only be one subdirectory in /usr/local/texlive/2014/bin.)

Now you'll have to add /opt/texbin to your $PATH variable. This can be done by editing /etc/environment:

Fake packages

Following up Silex's excellent write-up: I have put a fake package texlive-dummy created by the equivs-build process into my PPA. (Package source.) If you are on Ubuntu 13.04, the following will provide the necessary dependencies without having to generate a package:

This gets you to at least 2012, and it looks like newer versions of Ubuntu have 2013, so you can probably pull this package out of their repertories without damaging anything, though I wouldn't swear by that and you should consult an Ubuntu expert first.

texdoc,tlmgr which get's automatic updates for all new packages will be missing with 2012 backports and even distro specific latex packages are very old and cannot updated with tlmgr. Hence vanilla texlive installation is the way to do for taking advantage of full power of texlive distro and being latest.
–
texenthusiastDec 18 '13 at 3:10

@texenthusiast Ah, I didn't know that. Looking at the changelog once you get the newest version of ubuntu they are keeping the package up to date at least. Should I delete my answer?
–
CanageekDec 18 '13 at 3:34

actually backports was mentioned by naught101 user in comments. So I think backports is not too much advisable compared to the vanilla install if possible sorry to say delete the answer. But some people prefer to be with ubuntu's ppa also instead of being over latest. finally take your decision.
–
texenthusiastDec 18 '13 at 3:39

Many many thanks for that. I updated Ubuntu to 14.04 and that broke the LaTeX completely on my machine. 'Usual' instillation didn't work but your script worked like a charm. One question though. I downloaded install-tl-ubuntu to my home directory. After installation was complete it left behind some folders: install-tl-20140417, debian-control-texlive-in.txt, install-tl-1.log, install-tl-ubuntu_EXTRAS.log, install-tl-unx.tar.gz, mirrorCandidates.logand mirrorWgets.log. Can they all/some be deleted?
–
radekMay 16 '14 at 19:06

@radek Glad it was useful. You do not need those files anymore.
–
scottkostyMay 16 '14 at 19:47

@scottkosty Looks very nice! (I don't use Ubuntu/Debian, though.) Can you run it as a non-root user, as upstream recommends? Even better, could you have it create a non-root user to manage the installation and then proceed as that user? (So the user would also then be used for subsequent updates etc.)
–
cfrNov 19 '14 at 3:05

Note that I trust the people who are in charge of TeX Live. However, I have been given reason to believe that they are fallible and fallible beings screw up however competent and however well-intentioned they are. Moreover, servers get hacked, downloads get corrupted or intercepted. Shit, basically, happens.

The crucial point is that there is zero benefit to installing with root privileges. All it gets you is an increased security risk. While it may be small, I see no reason to take it.

It is possible to install and manage the installation as your ordinary user. However, that only protects your system directories. Your home directory - where you probably keep all of your personal files and projects - remains exposed. Fortunately, it is easy to protect /home as well.

If you want to follow upstream's advice, then, here is how I do it...

Set up a dedicated user/group and create a suitable home for it

This is the only part you need root privileges for.

sudo useradd -d /usr/local/texlive -m -r -U -s /bin/sh texlive

This creates a new user, texlive, as a member of a new group, texlive. It creates a home directory for texlive at /usr/local/texlive.

If you have previously installed TeX Live from upstream, omit the -m flag from the above command. Instead, once you have created the new user, do this:

sudo chown -Rh texlive:texlive /usr/local/texlive

Be sure to set a password:

sudo passwd texlive

You will be asked to choose and confirm a password. Note that what you type will not show up on the screen at all. Just type the password and hit enter. Then do the same to confirm.

Switch to the new user before installing

Now login as texlive:

su texlive

Give the password and you will be in texlive's home directory. That is, you will be in /usr/local/texlive.

Now follow Silex's instructions but omit all occurrences of sudo. You don't need them.

Note that this method not only protects your system directories, it also protects your home. The texlive user cannot write to your normal home directory. So even if somebody screws up and the installer tries to delete all your documents, it will not be allowed to do so. In fact, if you were to get any permissions errors whatsoever, that would be a red flag. The installer is not supposed to touch anything outside /usr/local/texlive at all.

Aftercare: when to use root

You will need sudo to install the fake packages and to integrate TeX Live's fonts into the system configuration. That's because these steps involve system directories. The fake packages get installed for the system and the font configuration involves altering files in /etc. That all necessarily requires root privileges.

Maintenance: updating your installation

When you are ready to update TeX Live, simply login as texlive prior to running the update:

su texlive
# give the password
tlmgr update --all

Do not use sudo or switch to root. The whole point is that tlmgr runs as an unprivileged user and cannot touch your home or system directories.

In general, if you want to change anything under /usr/local/texlive, su texlive before you do it. If you want to do something in /etc or under /opt, you need root privileges (sudo or similar).

This is an excellent suggestion. I’ve often been tempted to install TeX Live as root because some editors (Emacs, for one) open .sty files upon compilation errors, and then I’m in danger of modifying the files without noticing what I’m doing (absent-minded). This approach prevents that as well as protecting /home.
–
ThérèseJun 18 at 2:03

@Thérèse Thanks. That's a good point. My editor tends to do that too. I've never installed TL as myself I went from root to a special user. But it is definitely another good reason to keep a separate account. It also means if there's anything of your own you don't want to touch, you can stick it in TEXMFLOCAL which is managed by the dedicated user as well. (At least, using the above instructions it ends up that way.) This method is really, really easy to use. It really is just creating a new user with a special home and setting it up that is a little fiddly. But you only do that once....
–
cfrJun 18 at 2:18