Notes on TeX Live setup

From STMDocs
Revision as of 22:55, 21 September 2008 by Thanh (talk | contribs)
Jump to navigation Jump to search

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.

Overview of involved steps

  • we download the whole TL iso image to disk, mount it permanently and run the TL install script;
  • after installation, we adjust the configuration so that non-TL binaries can also find TL data;
  • we add another texmf tree to our setup;
  • we make some needed changes so that we can run another version of pdftex (compiled from sources) to run with our setup.

Prerequisites

  • root access
  • disk space (~2.5GB)
  • basic command-line skills

This approach takes some disk space (~2.5GB for TL2008), but has some advantages:

  • installation is quick: all data are available on disk, no need to copy bunch of files from dvd.
  • installation is complete: everything from TL is installed.
  • upgrade is quick: replace the current TL iso image by the new one, and that's it.

The downside is that we cannot update installed packges easily using tlmgr.

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>

  • to mount the TL image permanently, add to /etc/fstab a line saying

<geshi lang="bash"> /opt/iso-images/texlive2008.iso /mnt/texlive2008 iso9660 defaults,ro,loop 0 0 </geshi>

  • mount the image:

<geshi lang="bash"> sudo mkdir -p /mnt/texlive2008 sudo mount /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:

<geshi lang="bash">

...
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 </geshi>

  • change some environment variables permanently by adding to /etc/profile the following lines:

<geshi lang="bash">

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

<geshi lang="bash"> $ 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. </geshi>

Post-installation tuning

Use non-TL binaries wth TL data

Change the TL configuration file to be independent of locations of TL binaries (this is needed 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 or 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


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)