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