TransWikia.com

How to install "vanilla" TeXLive on Fedora?

TeX - LaTeX Asked on March 25, 2021

Fedora has provided a very good texlive packaging. But, I think it’s best to install texlive directly, using ./install-tl command. I have installed texlive directly on Ubuntu system before, by using this guide:

How to install "vanilla" TeXLive on Debian or Ubuntu?

(thanks to Torbjørn T, for the complete guide).

Now, I’m currently using Fedora 23 Workstation. Is there a way to install texlive directly on Fedora 23 ? Is there any fake packages to make Fedora think that we have already installed the texlive, i.e, similar to equivs package on Debian?

3 Answers

Duck

How to install TeX Live in Fedora – a quick guide for ducks

No ducks were harmed during the making of this guide.

Step one: Obtain the official Unix installer from TUG. If you want to use the terminal directly, open it and type:

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

Step two: Time to unpack the installer and run it! Personally, I like the command line, so in the terminal, go to the directory where you downloaded install-tl-unx.tar.gz and type:

$ tar xvzf install-tl-unx.tar.gz

You will get a directory named install-tl-<build date>, where <build date> is the date referring to the latest installer build (your mileage may vary). Let us delve into the installation, so type:

$ cd install-tl-*
$ sudo ./install-tl

The installer will appear in your terminal screen:

< verbose output, suppresed here because it is too complex for ducks >

 <O> options:
   [ ] use letter size instead of A4 by default
   [X] allow execution of restricted list of programs via write18
   [X] create all format files
   [X] install macro/font doc tree
   [X] install macro/font source tree
   [ ] create symlinks to standard directories

 <V> set up for portable installation

Actions:
 <I> start installation to hard disk
 <H> help
 <Q> quit

Enter command: 

Now, simply choose I and wait until the installation finishes.

Step three: Let us add a symbolic link to the TeX Live binary directory! Open the terminal and type the following:

$ sudo ln -s /usr/local/texlive/<year>/bin/<arch> /opt/texbin

Please, replace <year> and <arch> by the correct year and architecture. In my case, I'd run:

$ sudo ln -s /usr/local/texlive/2016/bin/x86_64-linux /opt/texbin

Now, we can refer to the TeX Live binaries by providing the symbolic reference /opt/texbin. When installing newer versions, it's just a matter of simply updating the symbolic link and everything is ready to go.

Step four: In your terminal, type the following:

$ gedit texlive.sh

The GEdit editor will appear with a blank document named texlive.sh. Copy and paste the following text (courtesy of egreg):

#!/bin/bash
pathmunge () {
    if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
        if [ "$2" = "after" ] ; then
            PATH=$PATH:$1
        else
            PATH=$1:$PATH
        fi
    fi
}
pathmunge /opt/texbin
unset pathmunge

Save the file in GEdit and close it. You will be back to the terminal screen. Now type:

$ sudo mv texlive.sh /etc/profile.d/

This script ensures the /opt/texbin entry will be in your path, before any other entry. After running the command, close your terminal and open it again (this is important). Now, try running:

$ which pdflatex
/opt/texbin/pdflatex

If you get the output shown above, everything is set up perfectly!

Step five: Now, let us configure the OpenType fonts from TeX Live. Open the terminal and type:

$ sudo cp $(kpsewhich -var-value TEXMFSYSVAR)/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf
$ sudo fc-cache -fsv

Wait a couple of seconds (or minutes) and we are done!

Have fun with TeX Live and Fedora!

Answered by Paulo Cereda on March 25, 2021

This answer is an adaptation of some notes I had taken combining cfr's and Silke's answers on How to install "vanilla" TeXLive on Debian or Ubuntu?. It explains how to install and maintain TeX Live using a dedicated user account, in order to avoid potential risks to the system directories and your home directory. Much of it is taken verbatim from those answers, and other things I am not interested in – such as making TeX fonts available system-wide – are described there.


1) Set up a dedicated user/group and create a suitable home for TeX Live

This method not only protects your system directories, it also protects your home. The tladmin user cannot write to your normal home directory.

Notes:

  • this, the setting of PATH and the installation of the fake package are the only parts you need root privileges for;
  • in general, if you want to change anything under /usr/local/texlive, su - tladmin before you do it. If you want to do something outside of users' home directories (e.g., in /etc), you need root privileges (sudo or similar).

1.1) Create the user

Note: If you have previously installed TeX Live from upstream, omit the -m flag from the following command.

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

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

If you have previously installed TeX Live from upstream, once you have created the new user, do this:

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

Set the password for the new user

sudo passwd tladmin

If you wish, you may also restore user files from /etc/skel.

1.2) Hide the name of the new user from the login screen

Open /var/lib/AccountsService/users/tladmin (create it if necessary)

sudo vim /var/lib/AccountsService/users/tladmin

if the file already exists, make sure there's the line

SystemAccount=true

under the [User] section. Otherwise, just write these two lines in it:

[User]
SystemAccount=true

2) Installation

Login as tladmin:

su - tladmin

then download and run the installer:

wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar xvfz install-tl-unx.tar.gz
rm -i install-tl-unx.tar.gz
cd install-tl-... *press TAB*
./install-tl

The command ./install-tl starts the installation process. You can change all kind of options there, anyway, 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 of disk space (around 50%). 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. The only thing I personally like to change is the location of TEXMFHOME, using in ~/.texmf instead of the default ~/texmf, to make it hidden.

When you're done setting up the options, press i to start the installation. The full installation is likely to take a long time, about an hour even on a good connection.

After the installation has completed you can delete the directory with the installation files:

rm -rf /usr/local/texlive/install-tl- *hit TAB*

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 mcbetz's answer on How to remove everything related to TeX Live for fresh install on Ubuntu?.

rm -rf /usr/local/texlive/2019

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 tlmgr --gui.

3) Set the PATH

Note: on [1-1] there are instructions about how to avoid having to adapt /etc/profile.d/texmf.sh when you install a new edition of TeX Live, using a system of symbolic links.

In order to have working executables and man/info -pages, create the following PATH for finding your new TeX Live installation:

login as your normal user (in order to be able to use sudo)

su - <your user>

open or create the file /etc/profile.d/texlive.sh

sudo vim /etc/profile.d/texlive.sh

and write in it

# /etc/profile.d/texlive.sh

TeX_path="/usr/local/texlive/2019/bin/x86_64-linux"

if [[ $UID != 0 && -d $TeX_path ]]; then
  case ":$PATH:" in
    *":$TeX_path:"*) :;;        # already there
    *) PATH="$PATH:$TeX_path";; # add it
  esac
fi

unset TeX_path

This avoids adding TeX Live binaries automatically to root's PATH, as would happen if you set it in /etc/environment, and also avoids duplicating the entry [3-4] (it happens if you modify the PATH in shell initialization scripts).

Log out, then log back in ("Files with the .sh extension in the /etc/profile.d directory get executed whenever a Bash login shell is entered (e.g. when logging in from the console or over SSH), as well as by the DisplayManager when the desktop session loads." [3-1]).

4) Fake the packages

You'll need to install a dummy-package in order to satisfy dependencies involving TeX Live components that have been installed by the TUG installer. Otherwise installing software that require those components will pull down texlive-* packages like crazy (see [4-3]).

Use the appropriate package among those listed on [4-1]. For TeX Live 2019 on Fedora 30 the one made for RHEL7 [4-2] does the job.

Unzip the archive and run

sudo dnf install /path/to/texlive-dummy[…].rpm

Then you should be able to install another package that depends on TeX without downloading tons of dependencies.

Other sources for dummy packages (which I’ve not tested) are

5) Test

Note: all of the following commands should work no matter which user runs them, except for tlmgr which needs to be run as tladmin.

If everything went well all TeX-related commands should work. Verify this by checking the output of

which tex

which should be

/usr/local/texlive/2019/bin/x86_64-linux/tex

Last time I installed TeX Live (v. 2019 on Fedora 30) which tex was failing because the test in /etc/profile.d/texlive.sh, [ -d "$TeX_home/bin/x86_64-linux" ], returned false. Check the permissions of directories in /usr/local/,

ls -l /usr/local/

it may be that texlive has rwx------ (700) permissions. If that's the case, run

sudo chmod 755 /usr/local/texlive/

to fix the issue.

Try some other commands

man tlmgr
info tlmgr
tlmgr --version
pdflatex --version
biber --version

Another issue I had last time I installed TeX Live was Biber rasing this error:

biber: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory

after installing libnsl it complained again:

biber: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory

You can find which packages provide the missing files with

dnf provides libnsl.so.1
dnf provides libcrypt.so.1

then install them:

sudo dnf install libnsl libxcrypt-compat

6) Make your classes, packages and input files available to TeX Live

If you have personal classes, packages or input files, put them in ~/<your setting for TEXMFHOME>/tex/latex/ (you may need to create it). A symlink will do if you want to keep them stored somewhere else.

Note: files in the local texmf tree can bee loaded with just input{filename} instead of input{path/to/file}.

7) getnonfreefonts

Some typefaces are not distributed with TeX Live's installer due to licensing issues. Instead, you have to use a separate script, getnonfreefonts, to install them.

Notes:

  • don't run getnonfreefonts --user. It causes problems because it executes updmap (see [7-2]).
  • it is possible to use all OpenType and TrueType fonts in other programs as well. To do that you have to add TeX Live fonts to the system configuration; see [2-1].
su - tladmin
wget https://tug.org/fonts/getnonfreefonts/install-getnonfreefonts
texlua install-getnonfreefonts
rm -i install-getnonfreefonts
getnonfreefonts --sys -a

Check if all the fonts have been installed correctly

getnonfreefonts --sys -l

If they have not, run

getnonfreefonts --sys -a

again.

8) Install Inkscape to enable the LaTeX command includesvg

sudo dnf install inkscape

9) Update

su - tladmin
tlmgr update --self --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.


APPENDIX

I) Upgrading to the next TeX Live

To upgrade you need to download and run the installer again, and to update the year in /etc/profile.d/texlive.sh

You can remove the old distribution(s) by running:

rm -rf /usr/local/texlive/<YEAR>

II) Uninstalling TeX Live

To remove TeX Live completely you need to undo everything you've done [2-1]:

III) Optional stuff

On [2-1] there are further instructions for

  • making OpenType and TrueType fonts available to other programs;
  • updading via GUI;
  • creating a launcher (.desktop file) for Gnome to start the GUI updater.

If you want to use tlmgr --gui you'll need perl-Tk:

sudo dnf install perl-Tk

You might also need the dictionaries for Aspell (for instance if you use it in Emacs), which you can install with

sudo dnf install aspell-<lang1> aspell-<lang2> …

Have fun :-)

Answered by Arch Stanton on March 25, 2021

Install the official package from fedora using ‘yum install texlive’ (so that software with tex as a dependency can be installed) Download the installer for the full texlive from http://www.tug.org/texlive/acquire-netinstall.html Run the install-tl script Make sure the install path is /opt (or /opt/texlive if you’d like) Add /opt/texlive/2012/bin/x86_64-Linux (with the correct year) to the path (see e.g. http://askubuntu.com/questions/60218/how-to-add-a-directory-to-my-path if unsure how to do this) making sure it’s added before /usr/bin so the correct latex programs are used rather than the ones from fedora’s texlive package If using some software such as texmaker to edit and compile your latex, make sure it is correctly configured to run pdflatex, Biber etc. from /opt/texlive/2012/bin/x86_64-Linux

Answered by Aaron Smith on March 25, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP