Notes on TeX Live setup
Introduction
This page describes steps to install TeX Live (TL from now) and needed tweaks so that other kpathsea programs that are not part of TL can also use TL data. This is useful if we recompile some program from sources and want it to be able to find TL data. For example, one might want to recompile pdftex with some patch, and use it instead of the binary coming with TL.
This guide was written for Ubuntu linux 8.01 and should work with no or little change for other Linux/UNIX systems.
Prerequisites
- root access
- enough disk space (~5GB)
- basic command-line skills
Install TL
- start with a shell where no tex-related environment variables are defined. A quick check can be done by
(set;env) | fgrep TEX
- download latest TL iso image to /opt/iso-images (this is my preference, feel free to use any location you prefer)
- unpack the image:
<geshi lang="bash"> cd /opt/iso-images unlzma texlive2008.iso.lzma </geshi>
- mount the TL image:
<geshi lang="bash"> sudo mkdir -p /mnt/texlive2008 sudo mount -t iso 9660 -o loop /opt/iso-images/texlive2008.iso /mnt/texlive2008/ </geshi>
- run the TL installer:
<geshi lang="bash"> sudo perl /mnt/texlive2008/install-tl </geshi>
- when the menu is up, choose <V> set up for running from DVD by entering v<Enter>
- in next menu, change the destination of installation to /opt/texlive/2008 by entering:
d<Enter> 1<Enter> /opt/texlive/2008<Enter> r<Enter>
- start the installation process by entering i<Enter>. When the installation process is done, the last messages should like this:
... See /mnt/texlive2008/index.html for links to documentation. The TeX Live web site (http://tug.org/texlive/) contains any updates and corrections. TeX Live is a joint project of the TeX user groups around the world; please consider supporting it by joining the group best for you. The list of groups is available on the web at http://tug.org/usergroups.html. Add /mnt/texlive2008/texmf/doc/man to MANPATH. Add /mnt/texlive2008/texmf/doc/info to INFOPATH. Set TEXMFCNF to /opt/texlive/2008/texmf-var/web2c. Most importantly, add /mnt/texlive2008/bin/i386-linux to your PATH for current and future sessions. Welcome to TeX Live! /mnt/texlive2008/install-tl: done. Logfile: /opt/texlive/2008/install-tl.log
- change some environment variables permanently by adding to /etc/profile the following lines:
<geshi lang="bash">
- added for TeX Live
TEXMFCNF=/opt/texlive/2008/texmf-var/web2c MANPATH=/mnt/texlive2008/texmf/doc/man:$MANPATH INFOPATH=/mnt/texlive2008/texmf/doc/info:$INFOPATH PATH=/mnt/texlive2008/bin/i386-linux:$PATH export TEXMFCNF MANPATH INFOPATH PATH </geshi>
- logout and login again to ensure that the above environment variables are set. With bash as the default shell, it can be done by saying:
<geshi lang="bash"> exec bash -login </geshi>
- test the installation:
<geshi lang="bash"> cd /tmp pdflatex sample2e </geshi>
- if things go well, we should get the below log:
$ pdflatex sample2e This is pdfTeXk, Version 3.1415926-1.40.9 (Web2C 7.5.7) %&-line parsing enabled. entering extended mode (/mnt/texlive2008/texmf-dist/tex/latex/base/sample2e.tex LaTeX2e <2005/12/01> Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh yphenation, german-x-2008-06-18, ngerman-x-2008-06-18, ancientgreek, ibycus, ar abic, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danish, dutc h, esperanto, estonian, farsi, finnish, french, galician, german, ngerman, mono greek, greek, hungarian, icelandic, indonesian, interlingua, irish, italian, la tin, mongolian, mongolian2a, bokmal, nynorsk, polish, portuguese, romanian, rus sian, sanskrit, serbian, slovak, slovenian, spanish, swedish, turkish, ukenglis h, ukrainian, uppersorbian, welsh, loaded. (/mnt/texlive2008/texmf-dist/tex/latex/base/article.cls Document Class: article 2005/09/16 v1.4f Standard LaTeX document class (/mnt/texlive2008/texmf-dist/tex/latex/base/size10.clo)) No file sample2e.aux. (/mnt/texlive2008/texmf-dist/tex/latex/base/omscmr.fd) [1{/opt/texlive/2008/tex mf-var/fonts/map/pdftex/updmap/pdftex.map}] [2] [3] (./sample2e.aux) )</mnt/tex live2008/texmf-dist/fonts/type1/bluesky/cm/cmbx12.pfb></mnt/texlive2008/texmf-d ist/fonts/type1/bluesky/cm/cmex10.pfb></mnt/texlive2008/texmf-dist/fonts/type1/ bluesky/cm/cmmi10.pfb></mnt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cmmi7 .pfb></mnt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cmr10.pfb></mnt/texliv e2008/texmf-dist/fonts/type1/bluesky/cm/cmr12.pfb></mnt/texlive2008/texmf-dist/ fonts/type1/bluesky/cm/cmr17.pfb></mnt/texlive2008/texmf-dist/fonts/type1/blues ky/cm/cmr6.pfb></mnt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cmr7.pfb></m nt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cmr8.pfb></mnt/texlive2008/tex mf-dist/fonts/type1/bluesky/cm/cmsy10.pfb></mnt/texlive2008/texmf-dist/fonts/ty pe1/bluesky/cm/cmsy7.pfb></mnt/texlive2008/texmf-dist/fonts/type1/bluesky/cm/cm ti10.pfb> Output written on sample2e.pdf (3 pages, 69560 bytes). Transcript written on sample2e.log.
Use non-TL binaries with TL data
Change the TL configuration file to get rid of $SELFAUTOPARENT, so that non-TL binaries work with TL data as well: <geshi lang="bash"> cd /opt/texlive/2008/texmf-var/web2c sudo cp texmf.cnf texmf.cnf.orig sudo sed -i -e 's:.SELFAUTOPARENT:/mnt/texlive2008:' texmf.cnf </geshi>
Add another texmf tree
Suppose we have tetex previously installed to /opt/tetex-3.0. The tetex texmf tree is then located at /opt/tetex-3.0/share/texmf. To add this texmf tree to our setup, we do this: <geshi lang="bash"> sudo ln -s /opt/tetex-3.0/share/texmf /opt/texlive/texmf-tetex sudo sed -i ' /^TEXMFLOCAL/ a\ TEXMFTETEX = /opt/texlive/texmf-tetex s/^TEXMF = .*TEXMFLOCAL/&,!!$TEXMFTETEX/ s/^TEXMFDBS = .*TEXMFLOCAL/&;!!$TEXMFTETEX/ s/^SYSTEXMF = .*TEXMFLOCAL/&;$TEXMFTETEX/ ' /opt/texlive/2008/texmf-var/web2c/texmf.cnf </geshi>
We can repeat the above steps to add as many texmf trees as we need. For each texmf tree we must:
- choose a variable name that it's not used yet (TEXMFTETEX in the above example)
- locate the path to the texmf tree, and make a symlink in /opt/texlive
- adjust the above commands accordingly.
The order of the texmf trees given in TEXMF is important: earlier trees take predecence over later ones in TEXMF. Edit texmf.cnf manually to change the order if needed.
Run pdftex compiled from sources
Sometimes it's desirable to run a different version of pdftex than the one comming with TL, for example when we want to run pdftex with some features or bugfixes not included in the version in TL. Then we must compile pdftex from sources and do some extra steps.
- compiling pdftex from sources: download pdftex sources tarball and apply patches if needed. Suppose that we have unpacked pdftex sources to $HOME/src/pdftex-1.40.9, then to build it:
<geshi lang="bash"> cd $HOME/src/pdftex-1.40.9 ./build.sh </geshi>
- when the above process finishes, the pdftex binary should be located at $HOME/src/pdftex-1.40.9/build/texk/web2c/pdftex
- edit /home/opt/texlive/2008/texmf-var/web2c/fmtutil.cnf to apply the below changes:
<geshi lang="diff"> $ diff -u fmtutil.cnf.orig fmtutil.cnf --- fmtutil.cnf.orig 2008-09-21 17:03:06.642547786 +0200 +++ fmtutil.cnf 2008-09-21 17:03:11.086872146 +0200 @@ -95,6 +95,7 @@
# $Id: format.latex.cnf 9357 2008-07-08 11:58:23Z preining $ latex pdftex language.dat -translate-file=cp227.tcx *latex.ini pdflatex pdftex language.dat -translate-file=cp227.tcx *pdflatex.ini
+pdflatex2 pdftex2 language.dat -translate-file=cp227.tcx *pdflatex2.ini
# lualatex luatex language.dat lualatex.ini pdflualatex luatex language.dat pdflualatex.ini
@@ -126,6 +127,7 @@
etex pdftex language.def -translate-file=cp227.tcx *etex.ini pdfetex pdftex language.def -translate-file=cp227.tcx *pdfetex.ini pdftex pdftex language.def -translate-file=cp227.tcx *pdfetex.ini
+pdftex2 pdftex2 language.def -translate-file=cp227.tcx *pdfetex2.ini
# ------------------------------------------------------------------ # $Id: format.physe.cnf 8442 2008-05-31 23:30:56Z karl $ physe pdftex - physe.ini
</geshi>
- create a file $HOME/texmf/tex/generic/config/pdfetex2.ini with the contents
<geshi lang="tex"> \input pdfetex.ini </geshi>
- create a file $HOME/texmf/tex/generic/config/pdflatex2.ini with the contents
<geshi lang="tex"> \input pdflatex.ini </geshi>
- make symlinks (suppose that $HOME/bin is in $PATH):
<geshi lang="bash"> ln -s $HOME/src/pdftex-1.40.9/build/texk/web2c/pdftex $HOME/bin/pdftex2 ln -s $HOME/src/pdftex-1.40.9/build/texk/web2c/pdftex $HOME/bin/pdflatex2 </geshi>
- create formats:
<geshi lang="bash"> fmtutil --byfmt pdftex2 fmtutil --byfmt pdflatex2 </geshi>
- the new formats will be located in $HOME/.texlive2008/texmf-var/web2c/pdftex2. To make it searchable to pdftex, we need to:
<geshi lang="bash"> ln -s $HOME/.texlive2008/texmf-var/web2c/pdftex2 $HOME/.texlive2008/texmf-var/web2c/pdftex </geshi>
- test the new binary:
<geshi lang="bash"> pdftex2 story \\bye pdflatex2 sample2e </geshi>
Maintain packages installed locally
If we keep installing local packages to a texmf tree for some time, we will find out that it's getting difficult to keep track of what has been installed, and how to remove or upgrade a package. This is the place where a package management system is useful. We will use miktex tools to maintain our local packages.
(to be continued)