Texlive distribution on centOS for RStudio Server and Connect

If you want your RStudio Server or Connect to be able to render PDF reports on a centOS machine, you need to install a copy of texlive. However, I found that the texlive distribution on centOS through yum install sometimes lack some LaTeX packages even after installing texlive-* and it doesn't come with a latex package manager "for good reasons" (See https://www.centos.org/forums/viewtopic.php?t=54410). Therefore, I run into trouble in the past that I couldn't render a PDF because some latex packages were not and could not be installed. :joy:

My solution was to install the vanilla version of texlive from [TUG] (https://www.tug.org/texlive/acquire.html). I found these SE answer 1 & SE answer 2 were very helpful.

I just want to share my experience here in case other people fall into this rabbit hole. Also, please let me know if there is better solution for this issue.

My biggest issue was i never had inconsolata or zi4. These steps fixed it on CentOS 7.

$ yum install levien-inconsolata-fonts
$ wget http://mirrors.ctan.org/install/fonts/inconsolata.tds.zip
$ mkdir inconsolata
$ unzip inconsolata.tds.zip -d inconsolata
$ cp -r inconsolata/* /usr/share/texmf
$ mktexlsr

$ tee -a /usr/share/texlive/texmf-dist/web2c/updmap.cfg << EOF
Map zi4.map
EOF

$ yum install perl-Digest-MD5
$ updmap-sys --force