336

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?

7
  • 7
    This might be a better fit for Super User or the Ubuntu SE site, since it's really about the Debian/Ubuntu packaging system, not anything specific to LaTeX.
    – David Z
    Commented Aug 5, 2010 at 1:01
  • 1
    There's a bug for that: bugs.launchpad.net/ubuntu/+source/texlive-base/+bug/712521 . Looks like it might be time to start thinking about an upgrade to a 12.10 pre-release :)
    – naught101
    Commented May 28, 2012 at 13:04
  • 4
    Ah, there's a PPA for 12.04 too: launchpad.net/~texlive-backports/+archive/ppa. Haven't tried it yet.
    – naught101
    Commented May 28, 2012 at 13:08
  • 1
    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.
    – strpeter
    Commented Feb 11, 2013 at 23:27
  • 2
    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.
    – user34273
    Commented Jul 28, 2013 at 5:26

12 Answers 12

87

Use the net installer script from this page on the official tug.org website to install “vanilla” TeXlive.

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.)

2
  • 15
    See also: tug.org/texlive/debian.html , section "Vanilla TeX Live on Debian" which is also valid for Ubuntu (since Ubuntu is a Debian based distribution)
    – user2574
    Commented Feb 8, 2011 at 18:01
  • 4
    I asked a related question here: tex.stackexchange.com/questions/52388/…. If anyone is having trouble installing vanilla texlive, perhaps some information in that post will help. Commented May 18, 2012 at 13:28
432
+600

These instructions have been updated for Ubuntu 16.04 and TeX Live 2021, they will probably work on most Ubuntu/Debian distributions.

Installation

Installing "vanilla" TeX Live is not as hard as you think. Things you will need:

  • An internet connection.
  • About 4 GiB of free space (2 GiB if not installing documentation).
  • Root (sudo) powers.

Note: the instructions are meant for the terminal and for installing the "original" most up-to-date version of texlive. If you're uncomfortable with the command line and plenty of sudo instructions, you can probably still install the texlive-full package from the Software center; you will end up with the "stock" version of texlive, which usually lags a bit behind the latest distribution of texlive.

Installation of dependencies

The following packages are required for this guide: wget, perl-tk. Install them with:

sudo apt install wget perl-tk

TeX Live Installer

First the official installer needs to be downloaded with the following commands:

wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xf install-tl-unx.tar.gz
cd install-tl-20220211

The install-tl-20220211 folder is likely to 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

This starts the installation process. You can change all kind of options here, most of the the default options are correct. In order to have working executables and man/info -pages after installation where (1) is recommended option in Unix/Linux, while (2) in Windows:

  1. Create the following environment variables for finding your new installation in TeXLive 2021:
    export PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH    
    export INFOPATH=$INFOPATH:/usr/local/texlive/2021/texmf-dist/doc/info
    export MANPATH=$MANPATH:/usr/local/texlive/2021/texmf-dist/doc/man
    

This can be added to ~/.profile to automatically apply when opening a terminal.

  1. You can have the installer create symbolic links for you by changing the options: Use o to change the options and l to create symbolic links. The default locations are correct, so just press enter to use them. Use r to return to the installation menu.
    If for some reason you overlooked this and ran the installer, it is possible to create the symlinks retrospectively using the command: tlmgr path add. See the relevant documentation for more details.

In some cases changing the other 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. The full installation is likely to take a long time, say between one 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 the missing components can be easily installed later.

Interruptions: 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 following installed elements +/- possible elements mentioned in the thread answer How to remove everything related to TeX Live for fresh install on Ubuntu?

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

Failures: Such a long installation process may fail due to interruptions in communications or other reasons. In such a case, you may want to to restart the installation, but this time choose the smallest configuration that would get it going. Then, you can install all missing components with sudo tlmgr --gui.

Finalising the installation

If everything went well all TeX-related commands should work. Verify this by checking the output of which tex, which should be /usr/local/bin/tex.

Fake packages

Now TeX Live works, but it's also necessary to make Ubuntu think you've installed TeX Live. This can be done with the equivs package:

sudo apt install equivs --no-install-recommends freeglut3
mkdir -p /tmp/tl-equivs && cd /tmp/tl-equivs
equivs-control texlive-local

Note: If your /tmp is mounted wit noexec flag, the build will fail as described here. You may just use another directory instead of /tmp in this case.

Then, you'll have to edit texlive-local. For this use the file provided here corresponding to the version you are installing. For instance, for 2020 use:

wget -O texlive-local https://tug.org/texlive/files/debian-equivs-2021-ex.txt

More information about required edits can be found in the TeX Live Debian guide.

Now you can build the package and install it (exact name of .deb is created in first command below; you can also use tab autocompletion):

equivs-build texlive-local
sudo dpkg -i texlive-local_2021-1_all.deb
sudo apt install -f

After this installing texworks through the package maintainer won't install TeX Live again. You can check if this is indeed the case by installing TeX-related packages like texworks, texstudio, qtikz or kile.

Fonts

If you want to install all OpenType and TrueType fonts so you can use them in other programs as well, you'll have to add the TeX Live fonts to the system configuration:

sudo cp $(kpsewhich -var-value TEXMFSYSVAR)/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf
gedit admin:///etc/fonts/conf.d/09-texlive.conf

Remove the line containing type1 and save. Now run:

sudo fc-cache -fsv

Updating

If you have installed from a CD, DVD, or an ISO image, you should update your installation to the most recent version of all packages. To do so, run the following two commands:

sudo tlmgr update --self
sudo tlmgr update --all

From now on, you can update TeX Live through the TeX Live Manager with the GUI interface:

sudo tlmgr --gui

It might complain about missing 'Tk', this can be solved by installing perl-tk:

sudo apt install perl-tk --no-install-recommends

Launcher

You can also create a launcher for your desktop environment:

mkdir -p ~/.local/share/applications
cat > ~/.local/share/applications/tlmgr.desktop << EOF
[Desktop Entry]
Version=1.0
Name=TeX Live Manager
Comment=Manage TeX Live packages
GenericName=Package Manager
Exec=pkexec /usr/local/texlive/2021/bin/x86_64-linux/tlmgr --gui
Terminal=false
Type=Application
Icon=system-software-update
EOF

You may need to logout and login again for the changes to take effect.

Note: If the $XDG_DATA_HOME variable is set, use the value of that instead of ~/.local/share/applications. It is also possible to use /usr/share/applications for a system-wide launcher.

Upgrading to the next TeX Live

To upgrade you need to download and run the installer again. Do not forget to have the installer create symbolic links.

It might also be a good idea to run the font section again. You can remove the old distribution(s) by running (for example):

sudo rm -rf /usr/local/texlive/2019
sudo rm -rf /usr/local/texlive/2020

Uninstalling TeX Live

To remove TeX Live completely you need to undo everything you've done:

References and sources

47
  • 4
    @Silex Thanks for the nice howto. Works perfect... Commented Feb 19, 2013 at 12:27
  • 2
    @Silex: When I try to install texlive-publishers with the command tlmgr install texlive-publishers I receive the error You don't have permission to change the installation in any way, and if I do sudo tlmgr install texlive-publishers I receive the error sudo: tlmgr: command not found. I use Ubuntu 12.04 if it does matter.
    – Rasoul
    Commented Jul 4, 2013 at 18:50
  • 5
    For those wondering, /etc/environment should be replaced by /etc/login.defs when dealing with Debian, according to tug.org. In this file you can edit your path.
    – Clément
    Commented Jul 8, 2014 at 21:10
  • 42
    For the record, this is one of the best answers on the entire SE network.
    – mmdanziger
    Commented Oct 19, 2014 at 12:21
  • 3
    I followed it for installing Texlive 2021 in ubuntu 20.04 LTS. But sudo tlmgr update --self is not working. While giving the full path, like: sudo /usr/local/texlive/2021/bin/x86_64-linux/tlmgr update --self, then it's working.
    – raf
    Commented Jul 11, 2021 at 15:18
38

I wrote a script that automates Silex's answer and does (optionally) a lot more. It supports Ubuntu versions 12.04 up to the current version.

Download install-tl-ubuntu and run it as

sudo ./install-tl-ubuntu

To download that script, run

wget https://github.com/scottkosty/install-tl-ubuntu/raw/master/install-tl-ubuntu && chmod +x ./install-tl-ubuntu

Below I give the list of features from the GitHub repository

  • installs TeX Live 2013
    • automatically finds the fastest repository
    • gives updated progress of the install
    • restarts automatically if install fails
  • tlmgr can then be used to keep your install up-to-date
  • notifies apt so that apt does not try to install the Ubuntu texlive-* packages as dependencies (e.g. if you do sudo apt-get install lyx)
  • links to the folder where Ubuntu installs TeX files so that when you install Ubuntu packages (e.g. FoilTeX and noweb) with LaTeX files, they will be available
  • adds TeX Live fonts to be used system-wide
  • other font-related conveniences
    • tells AppArmor to allow Evince to access the TeX Live fonts
    • can install TrueType fonts that user provides (--truetype-dir)
    • can install IvriTeX Hebrew fonts (--hebrew)
  • optionally installs additional LaTeX files for common journals that are not included in TeX Live 2013 (--more-tex)
  • works non-interactively and thus can be added to a batch install script
  • tlmgr can be run from the desktop menu (if 'gksu' package is installed)
  • install can be done from an ISO file (--iso)

For more details, see

./install-tl-ubuntu --help
17
  • 1
    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?
    – user21548
    Commented May 16, 2014 at 19:06
  • @radek Glad it was useful. You do not need those files anymore.
    – scottkosty
    Commented May 16, 2014 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.)
    – cfr
    Commented Nov 19, 2014 at 3:05
  • 1
    @ErelSegal-Halevi I have heard from many Ubuntu 16.04 users that install-tl-ubuntu works well. I have also used it on a few Ubuntu 16.04 installations and it works smoothly for me. There might be a warning that 16.04 isn't yet "officially" supported but that's just because I haven't gotten around to confirming and tweaking the TeX Live -> Ubuntu package mappings for 16.04. But again, I have not heard about a single problem specific to Ubuntu 16.04. If you happen to use the --hebrew option of install-tl-ubuntu, I'd be interested in hearing from you regarding whether it works well.
    – scottkosty
    Commented Aug 4, 2016 at 1:09
  • 1
    @scottkosty I am also now trying your script for use in Hebrew on 16.04 (I only added the --hebrew option). Basically the Hebrew works, but your script does not install the culmus-latex package (guyrutenberg.com/culmus-latex) which, as far as I understand it, is needed in order to use the entire variety of the culmus fonts, as well as the Nikud. This is, of course, unless you use XeTeX. I also did not manage to install it using tlmgr as it is not in the repository, nor by the instructions provided by the package. Anyway, thanks for the script!
    – Ur Ya'ar
    Commented Sep 8, 2016 at 18:43
18

Some comments:

  1. 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.

  2. 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.".

  3. 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.

8
  • 1
    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.
    – Dima
    Commented Aug 5, 2010 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. Commented Aug 5, 2010 at 11:17
  • 4
    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. Commented Aug 29, 2010 at 3:32
  • @Jan Hlavecek: Thanks for the clarification. Option 3 seems best, then. Commented Aug 30, 2010 at 7:16
  • 2
    concerning option 3, you don't need to set TEXMFCNF and it is recommended not to set it. Setting the PATH is enough.
    – mpg
    Commented Mar 17, 2011 at 11:05
18

PLEASE THINK BEFORE EDITING! Please do NOT edit this answer in ways which render it distro-specific. Although this question specifically addresses Debian/Ubuntu systems, it serves to provide information to users of GNU/Linux more generally. The way things work on your system may not be the way they work on all GNU/Linux systems - not even all Debian-based systems.

Note that upstream recommend not installing as root. Installing as root introduces a level of risk and has no benefits whatsoever.

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.

The following are generic instructions which should work for most GNU/Linux distros. If you are using a Debian based system or another distro which features the adduser script, see the note below for an easier method. Otherwise, use the useradd command as follows.

Generic GNU/Linux distro: useradd

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.

If you wish, you can choose some other name for the user/group, so long as it is unique on your system. Suppose you want to use tladmin:tladmin, then you need

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

or, if you've previously installed TeX Live as another user, omit the -m flag and add

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

In what follows, <username for texlive> denotes the user name and group of texlive> denotes the group. So, in our examples, both are texlive or tladmin.

Debian-based distro: adduser

If you are using Debian or a Debian derivative then, according to this question and given Andrew Cashner's experience, you should probably use adduser rather than useradd. According to Andrew:

sudo adduser texlive

or, if you want to use a different user name, such as tladmin

sudo adduser tladmin

is sufficient but notice that this will create an additional directory /home/texlive or /home/tladmin which the useradd method does not. In this case, <username for texlive>'s home will be /home/<username for texlive> and not /usr/local/texlive. Moreover, <username for texlive>'s primary group will depend on the defaults for your system: you might get <username for texlive>:<username for texlive> (e.g. texlive:texlive or tladmin:tladmin) or you might get <username for texlive>:staff (e.g. texlive:staff or tladmin:staff) or <username for texlive>:users (e.g. texlive:users or tladmin:users). You can use

groups <username for texlive>

to discover which group <username for texlive> is assigned to. For example, use

groups texlive

if texlive is the name of the user you added, or

groups tladmin

for tladmin.

If the result includes <username for texlive> (e.g. texlive or tladmin), use this group in what follows. Otherwise, you probably only get a single group listed e.g. users and should use that one. In the following, I'll call this group <group of texlive> and denote the user name you're using by <username for texlive>. If you have not installed from upstream before:

sudo mkdir -p /usr/local/texlive
sudo chown -Rh <username for texlive>:<group of texlive> /usr/local/texlive

If you have installed from upstream before, then just:

sudo chown -Rh <username for texlive>:<group of texlive> /usr/local/texlive

Switch to the new user before installing

Now login as <username for texlive>:

su -l <username for texlive>

Give the password and you will be in <username for texlive>'s home directory. That is, you will be in /usr/local/texlive. (If you used the Debian method above, cd /usr/local/texlive to move from the home directory.)

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 <username for 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 <username for texlive> prior to running the update:

su -l <username for 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 <username for texlive> before you do it. If you want to do something in /etc or under /opt, you need root privileges (sudo or similar).


Loosely related notes

The use of single configuration files in /etc seems to be going out of fashion. If you find that /etc/environment does not set your PATH, it may be somewhere else. For example, on some systems, PATH is set in /etc/profile and should be extended by adding a file named something like /etc/profile.d/texmf.sh for shells such as sh or bash:

# /etc/profile.d/texlive.sh 
if [ $UID != 0 ]
then
        [ -d "<path to binaries>" ] && export PATH="<path to binaries>:${PATH}"
fi

This avoids adding TeX Live binaries automatically to root's PATH. In order to avoid needing to adapt this file when you install a new edition of TeX Live, you can use a system of symbolic links.

cd /usr/local/texlive
ln -s <YYYY>/bin/x86_64-linux bin.<YYYY>
ln -s <YYYY> current.<YYYY>
ln -s bin.<YYYY> bin
ln -s current.<YYYY> current

Then/etc/profile.d/texmf.sh can contain just

# /etc/profile.d/texlive.sh 
if [ $UID != 0 ]
then
        [ -d "/usr/local/texlive/bin" ] && export PATH="/usr/local/texlive/bin:${PATH}"
fi

and PATH will be set to include the current binaries automatically. When you install a new edition of TeX Live, you just add further links (2 per edition) and adjust the current and bin link to point to whichever edition you want to be active. This can all be done as <username for texlive>, with no need for root privileges. (That is, the .sh file in /etc/profile.d must be created with root privileges, but you need not touch this file when installing or activating a new edition of TeX Live.)

53
  • 1
    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èse
    Commented Jun 18, 2015 at 2:03
  • 2
    I installed TeXLive per your instructions on Debian, but with useradd I ended up with a fairly crippled user account for the texlive user. In particular, I was unable to set the path, which meant I couldn't use tlmgr. I tried again using the newer utility adduser (simply adduser texlive with no additional options required) and everything worked better. The only thing I had to do as root was create a /usr/local/texlive directory and chown texlive:texlive /usr/local/texlive so that the texlive user could install there. Commented Sep 3, 2015 at 15:52
  • 1
    @gusbrs Yes. But that's not really the point. The point is the general principle of not doing things with higher privileges than necessary. There's a reason I don't write my TeX documents as root: it is entirely unnecessary. Note that when you install programmes from your distro's repositories, installation scripts may well drop privileges for the sake of security. Neither the TeX Live installer nor tlmgr drops privileges. If you run them as root, they do everything as root.
    – cfr
    Commented Jun 29, 2017 at 22:31
  • 1
    @gusbrs It is left to the user to follow TeX Live's own advice or not, just as it is left to you whether to run other things as advised or not. It isn't a question of the repos being riskier or not. It is a question of it being riskier to ignore upstream's advice. Upstream advise installing without privileges. This is the only sensible advice: privileges are entirely unnecessary, therefore they should not be used. This is a basic strategy: don't do anything with more privileges than necessary. If you must run something as root, drop privileges as soon as possible.
    – cfr
    Commented Jun 29, 2017 at 22:34
  • 1
    @gusbrs In one sense, of course CTAN and TL are riskier than Debian/Ubuntu standard repositories. CTAN does not scrutinise the packages uploaded. TL does not scrutinise them either. They would not accept anything obviously malicious or obviously inadvertently problematic, but there is no active scrutiny. In another sense, of course the standard repos are riskier because they are the source of software with far more potential for damage. So which kind of risk are you asking about?
    – cfr
    Commented Jun 29, 2017 at 22:39
14

A paper about installing TeX Live 2011 on Ubuntu and other GNU/Linux distributions can be found on

ArsTeXnica, vol. 10 (in Italian)
TUGboat, vol. 32-1 (issue 100) (in English)
Die TeXnische Komödie, issue 3/2011 (in German)

Thanks to Karl Berry and Barbara Beeton for the revision of the TUGboat version, and to Heiko Oberdiek and Herbert Voß for the German translation.

The papers are, up to now, available only to members of GuIT, TUG, and Dante, respectively, but will be public in due time.

Note: the Italian and English versions are about TeX Live 2010, but it's sufficient to change 2010 into 2011 in all the steps.

4
  • it seems that access to the English version is restricted to tug members Commented Dec 23, 2011 at 0:20
  • Yes, as are also the other versions. TUG discloses articles to everybody after one year, IIRC.
    – egreg
    Commented Dec 23, 2011 at 0:29
  • @egreg I have a question about perl-tk. In your guide you state to install it using Synaptic. Silke, in his answer above, says to write sudo apt-get install perl-tk --no-install-recommends. I wanted to know if it is the same thing.
    – Marco
    Commented Jan 25, 2016 at 13:26
  • 1
    @Marco Yes, that should be the same, as Synaptic is an interface to apt.
    – egreg
    Commented Jan 25, 2016 at 14:23
9

I have successfully installed TeXLive on Ubuntu 11.10 on a 64bit machine.

I have condensed the steps linked to in frabjou's answer, which, while the instructions are clear, may leave many *buntu users wondering "how do I change the PATH variable?"

wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xvf install-tl-unx.tar.gz
cd install-tl*
sudo ./install-tl
  • at prompt, enter "i" to install
  • change PATH, I did so by editing ~/.bashrc:

    • 64 bit

      # PATH=/usr/local/texlive/2011/bin/x86_64-linux:$PATH
      cat "export PATH=/usr/local/texlive/2011/bin/x86_64-linux:$PATH" >> ~/.bashrc
      
    • 32 bit:

      cat "export PATH=/usr/local/texlive/2011/bin/i386-linux:$PATH" >> ~/.bashrc
      

caveat see the tug instructions for more details; e.g. if TeXLive 2011 has been previously installed, it needs to be removed

4

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:

add-apt-repository ppa:krlmlr/ppa
apt-get update
apt-get install texlive-dummy

I intend to update this package to more recent versions of Ubuntu.

See Scott's answer for a much better solution.

3

It should be noted that there is now a much easier way to install up to date versions of TeXLive. There are now official backports of newer versions of TeXLive, as detailed here.

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.

3
  • 1
    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. Commented Dec 18, 2013 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?
    – Canageek
    Commented Dec 18, 2013 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. Commented Dec 18, 2013 at 3:39
3

I ended up writing a guide for someone else that expands on the excellent answers here, so I will post it here as well. The first section is roughly equivalent to cfr’s answer.

Installing TeX Live on Debian/Ubuntu

You do not need to install TeX Live as root, although that will work. The reason you might not want to is security: if you install as root, every package install script runs sudo root.

If you already have a copy of TeX Live installed, you should remove it with apt. You might also want to sudo rm -r /usr/local/texlive if it exists and start fresh.

You can create a new user and group that owns only the TeX installation with

sudo adduser --system --group --home-dir /usr/local/texlive tex

This will create a new user and group account that cannot log in and owns only the local TeX Live directory. You can, however, run commands as sudo -u tex. The sole purpose of this account is to run TeX installers and updates. That way, they only have permission to read and modify your TeX distribution.

Having done this, you want to make sure that only TeX can add and remove files in the TeX directory, but everyone else can use cd and ls on it.

sudo chown tex:tex /usr/local/texlive
sudo chmod 755 /usr/local/texlive

You can now install TeX Live, as tex, to this new directory that TeX owns. From the directory where you unpacked the TeX Live installer:

chmod 755 install-tl
sudo -u tex -E ./install-tl

The option -u tex means run as the user tex, and -E means preserve the environment variables, for example LANG to determine the language. By default, the installer should put the files in the new directory you just created, /usr/local/texlive/. Since tex owns this directory, it can.

You don’t need to use sudo to run commands like lualatex or pdflatex. You’d run those from your regular account. The only time you need to run as tex is when you’re updating the TeX installation, which tex owns.

Updating Your Configuration

First, you need to add your TeX Live directories to your PATH, MANPATH and INFOPATH environment variables, ahead of the system directories. Reposting from above: you can save the following to a file named /etc/profile.d/texlive.sh and it will load the next time you open a shell.

PATH=/usr/local/texlive/2020/bin/x86_64-linux:$PATH
export PATH
INFOPATH=/usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH
export INFOPATH
MANPATH=/usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH
export MANPATH

Update this if you are running a version other than 2020, of course.

If you exec bash -login to reload your environment, latex --version should tell you that it was installed from TeX Live, not your distribution. You should also be able to run man latex and info latex.

The command to update your tex installation is long and annoying, but you can create an easy-to-remember alias. The command for this is:

alias update-tex='sudo -u tex -E $(which tlmgr) update --self --all'

You would need to add it to your profile (either the file in /etc/profile.d, ~/.profile, or ~/.bash_profile if it exists) as well as whichever of ~/.bashrc, ~/.cshrc, ~/.kshrc, etc. you use to set it for non-login shells. You could also set your aliases in a file such as ~/.sh_aliases and source it within your *profile and *rc files.

The next time you open a command prompt (or refresh it with exec bash -login), you can update by typing update-tex.

Installing Non-Libre Fonts from CTAN

There’s a bit of a gotcha if you want to install getnonfreefonts from TUG. You might be tempted to install to your user directory, because that’s the only way that works out of the box. You want to install as --sys, not --user. Installing 8-bit fonts as a user is a trap. If you install as user, the installer will run updmap as a user, which will create a font map in your user directory. That will appear to work at first, but it will hide the system map from you and not be updated when you update the system map, so your map file will get more and more out of date.

You have to use a little trick to install it. The command you have to run for the installer to work is

sudo -u tex -E --preserve-env=PATH $(which texlua) install-getnonfreefonts

This command creates a perl script to install the fonts, which you run with

sudo -u tex -E --preserve-env=PATH $(kpsewhich getnonfreefonts.pl) --sys --all --refreshmap --http

Installing Other Local Files

Sometimes, you might want to download TeX files that are not available as TeX Live packages, such as your publisher’s class file or the Type 1 fonts for Georgian. You usually want to put these in a subdirectory of TEXMFLOCAL (/usr/local/texlive/texmf-local/) . rather than TEXMFHOME (~/texmf/) . You can copy a directory with sudo -u tex cp -r. After manually installing new files, run

sudo -u tex -E $(which texhash)
sudo -u tex -E $(which updmap-sys)

This makes sure your indices and map files are up to date.

If you only need them for one project, you can copy them to your project directory.

Installing and Using Fonts

You can install new fonts for your user account by saving them to ~/.fonts/, or for everyone by saving them to /usr/local/share/fonts/.

You might want to add your TeX tree to the system font paths. (Or even need to, for XeTeX to consistently find them.) The file with the script to do this is texlive-fontconfig.conf, and you can enable it by creating a symbolic link to it in the directory /etc/fonts/conf.d/:

sudo ln -s /usr/local/texlive/2020/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive2020.conf

I additionally created a file with the same format to index the fonts in my TEXMFLOCAL tree. I saved the following as /etc/fonts/conf.d/09-texmf-local.conf:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <dir>/usr/local/texlive/texmf-local/fonts/opentype</dir>
  <dir>/usr/local/texlive/texmf-local/fonts/type1</dir>
  <dir>/usr/local/texlive/texmf-local/fonts/truetype</dir>    
</fontconfig>

I gave these files a low number, such as 09, so that they will be searched before the system directories. The fonts in my TeX directories are usually more up-to-date.

Both XeTeX and LuaTeX should automatically refresh their databases the next time you request a font it doesn’t know about, but you can manually make them do it with

sudo fc-cache -fsv
luaotfload-tool -f -u -p -v

Other Optional Stuff

Some people recommend making a dummy apt package to prevent a second version of texlive from being automatically installed. I personally have not had that problem.

2
  • If you put the path in /etc/profile.d/texlive.sh as shown above, then instead of the long alias to use tlmgr, you can just say sudo -i tlmgr and the profile will still apply. Commented Oct 7, 2022 at 0:48
  • @musarithmia That’s a good tip. I have the alias so I can just type update-tex anyway.
    – Davislor
    Commented Oct 7, 2022 at 3:43
2

This is intended as a complement to cfr's answer (https://tex.stackexchange.com/a/187379/105447) for those who wish the convenience of the GUI for the use of tlmgr.

If you login in the terminal with su texlive you won't be able to run tlmgr --gui because the user texlive is not allowed by default to start a gui in your regular user's session (I'm not sure this is the best terminology for that). But you can allow it explicitly. For that, you should first run, as your regular user:

xhost +SI:localuser:texlive

And then login as texlive and run tlmgr:

su -l texlive
tlmgr --gui

If, besides that, you want to setup a launcher, you could add xhost +SI:localuser:texlive at the end of your ~/.profile (or equivalent in your system), logout, login back, and then create ~/.local/share/applications/tlmgr.desktop with the following content:

[Desktop Entry]
Version=1.0
Type=Application
Name=TeX Live Manager
Comment=Manages TeX Live packages
Icon=system-software-update
Exec=gksu -d -u texlive -D "TeX Live Manager" '/usr/local/texlive/2017/bin/x86_64-linux/tlmgr --gui'
Categories=Office;
Terminal=false

The path to tlmgr should be set as appropriate in your system (in doubt, use which tlmgr). Furthermore, gksu must be set with gksu-properties, setting "authentication mode" = "su".

1
  • @cfr, if you have comments or repairs, I'm all ears.
    – gusbrs
    Commented Jul 29, 2017 at 20:39
0

Based on Silke's answer (one of the best I've seen on SE), the following Unix shell script makes this work for you:

(cd /tmp ; \
  wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz ; \
  zcat < install-tl-unx.tar.gz | tar xf - ; \
  cd install-tl-*/ ; \
  perl ./install-tl --no-interaction)
chown -R $SUDO_USER:$SUDO_USER /usr/local/texlive/ # change ownership to user

Then, just make sure that the correct paths in /usr/local/texliveXXXX is in you $PATH environment variable. You can assure that by adding this to your .profile:

if [[ -d /usr/local/texlive ]]; then
  texpath=$(\ls -d1 /usr/local/texlive/[[:digit:]]* | tail -n 1) # get the newest installation
  export PATH=${texpath}bin/x86_64-linux${PATH:+:${PATH}}
  export INFOPATH=${texpath}texmf-dist/doc/info:$INFOPATH
  export MANPATH=${texpath}texmf-dist/doc/man:$MANPATH
fi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .