Installing LaTex on a Centos Operating System

Installing LaTex on a Centos Operating System

by Christopher King -
Number of replies: 5

Good day,

Installing TeX on a computer running the Centos operating system is challenging, because the standard repositories are missing a component used by Moodle.  First, here is the problem.

My system is a VPS (virtual private server) running Centos 7.8 (and cPanel and WHM).  From the root, I entered

$ yum install texlive

which installed 218 packages from the Centos repository (texlive is the TeX package).  Moodle’s >Site administration>plugins>filters>TeX notation settings showed that paths were needed to latex, dvips, convert, and dvisvgm.  I got those paths from my server using, for example,

$ which latex

That also worked for dvips and convert.  But no path to dvisvgm was found, indicating it had not been installed.  The texlive package in the repository that Centos 7 uses does not include the dvisvgm package.  (The texlive package in the repository is also old, 2012.)  The yum command shows that the texlive package did come from the official source, www.tug.org.

Solution

1. Remove what I had installed.

$ yum uninstall texlive

Although texlive had been removed, apparently some packages can cause the outdated texlive to be reinstalled.  To prevent that, I installed texlive-dummy, which is available for various versions of Centos at CTAN (Comprehensive TeX Archive Network). 

$ wget http://mirrors.ctan.org/support/texlive/texlive-dummy/EnterpriseLinux-7.zip # Get the file

$ unzip EnterpriseLinux-7.zip # Extract the file (tar and gzip didn’t work)

$ cd EnterpriseLinux-7 # Change to the newly created directory

$ sudo rpm -i texlive-dummy-2012a-1.el7.noarch.rpm # -i installs this repository

This removed/replaced a bunch of those 218 previously installed texlive packages that were associated with the Centos repository.

2.  Install texlive from the official site

The TeX Live Users Group (TUG) has a page, Installing TexLive over the Internet, from which I downloaded install-tl-unx.tar.gz and extracted it.

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

$ tar xvzf install-tl-unx.tar.gz # Extract the file

From the directory containing install-tl, run the installation file.

$ cd install-tl-20200607D

$ sudo perl install-tl

The screen now displays a bunch of options.  I foolishly accepted the defaults and started the installation.  Forty minutes and 7 GB latter, the 4018 packages had been installed.  Not finding a shortcut, I uninstalled everything and tried again.  (The package texlive gets put into the directory /usr/local/texlive/2020/bin/x86_64-linux/.)  This time, instead of installing everything, I chose the option “Schemes” by typing “s” and pressing enter. 

===============================================================================

Select scheme:

 

 a [ ] full scheme (everything)

 b [X] medium scheme (small + more packages and languages)

 c [ ] small scheme (basic + xetex, metapost, a few languages)

 d [ ] basic scheme (plain and latex)

 e [ ] minimal scheme (plain only)

 f [ ] ConTeXt scheme

 g [ ] GUST TeX Live scheme

 h [ ] infrastructure-only scheme (no TeX at all)

 i [ ] teTeX scheme (more than medium, but nowhere near full)

 j [ ] custom selection of collections

 

Actions: (disk space required: 1637 MB)

 <R> return to main menu

 <Q> quit

 

Enter letter to select scheme:

 

Scheme “b” is what I chose.  1.6 GB is a lot better than 7 GB.  Possibly scheme “c” would have included the missing package, dvisvgm, too, and saved an extra 1 GB.

The next-to-last step is to add the path to texlive for the current session.  The paths are listed on the terminal screen at the end of the installation. 

$ export PATH=$PATH:/usr/local/texlive/2020/bin/x86_64-linux # must capitalize PATH

The last step is to add the path for all future sessions.  In the directory /etc/profile.d/, create a file ending in .sh (if using the bash shell).

$ sudo nano setpaths.sh

In the nano editor I added the following lines, which also set the paths for man pages and info.  (The first line is just a comment I put in the file.)

# set $PATH, $MANPATH, and $INFOPATH environmental variable for all users

export PATH=$PATH:/usr/local/texlive/2020/bin/x86_64-linux

export MANPATH=$MANPATH:/usr/local/texlive/2020/texmf-dist/doc/man

export INFOPATH=$INFOPATH:/usr/local/texlive/2020/texmf-dist/doc/info

For completeness, for users using a different shell, I created a file ending in .csh.

$ sudo nano setpaths.csh

The following lines were added to that file. 

setenv PATH /usr/local/texlive/2020/bin/x86_64-linux:$PATH

setenv MANPATH /usr/local/texlive/2020/texmf-dist/doc/man:$MANPATH

setenv INFOPATH /usr/local/texlive/2020/texmf-dist/doc/info:$INFOPATH

The above changes to $MANPATH and $INFOPATH do not take effect until the system is restarted.

Now, go into Moodle into the “Tex Notation” settings and enter the paths to the four files it asks for (use the “which” command, mentioned at the start of this post, to find those paths). 

I hope that makes installing Tex easier for someone.

Chris


Average of ratings: Useful (1)
In reply to Christopher King

Re: Installing LaTex on a Centos Operating System

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I may be naive but the CentOS 7 repository lists dvisvgm as a package. Am I missing something?
In reply to Howard Miller

Re: Installing LaTex on a Centos Operating System

by Ken Task -
Picture of Particularly helpful Moodlers

Ahhh ... a 'teachable'/sharing moment? smile

uname -an
Linux sos 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

yum search dvisvgm

returns nada ... from base,extras,updates repos.

It is listed if one has other repos and enables them .... what repos do you have, Howard?  yum repolist

If I enable all repos and do

yum --enablerepo=* search dvisvgm

dvisvgm-debuginfo.x86_64 : Debug information for package dvisvgm
dvisvgm.x86_64 : DVI to SVG converter

Does appear.

yum -v --enablerepo=* search dvisvgm

shows coming from epel repo which is typically installed with hosting providers image of CentOS 7 (maybe not if OP chooses to install a minimal offering).

As in typical CentOS fashion, harder to build, but not totally impossible. smile

Still, though, OP (Chris) is to be commended for efforts and sharing.

In many years of supporting Moodle's for K12 entities, the one group that has always been the most difficult to 'please' (support) has been the Math folks.

Can students use whatever math editor when answering questions in a quiz?  Should math students in a Moodle be expected to know how to use? (in US grades ... 11 or 12)

Think the last Math person (chair of MS Dept) I had in a Moodle asked for the ability for students to use ... but teachers said no.

'SoS', Ken



Average of ratings: Useful (1)
In reply to Ken Task

Re: Installing LaTex on a Centos Operating System

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I shall defer to the expert here big grin
In reply to Howard Miller

Re: Installing LaTex on a Centos Operating System

by Christopher King -
Thanks to Howard, for pointing out that it is a lot easier to simply install dvisvgm from a repository, and to Ken, for pointing out that the repository to use is the epel repository. The epel repository appears to be a highly trusted repository. To install it, I did this:
$ yum search epel-release
$ yum info epel-release
$ yum install epel-release
$ yum update
(Probably only the last two were needed.)
To install the dvisvgm, this can be done:
$ yum --enablerepo=* dvisvgm
The result is that TeX support works, and only a little over 150 MB is needed, which is over 1 GB less than what I was doing.
Thanks, Gentlemen!
Chris
Average of ratings: Useful (2)
In reply to Christopher King

Re: Installing LaTex on a Centos Operating System

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Do you have a reason not to use MathJax, which renders rather nicely using JavaScript?