You don’t go into detail about how you installed TeX on your system, so it’s difficult to diagnose your problem.
However, you should not be running
sudo latex. If you need to, your system is not properly configured. Either install the
texlive packages you need on your system or do a custom installation. On Ubuntu, this is either
texlive-publishers, or just install
texlive-full. If you install vanilla TeX Live and use
tlmgr, it’s in the
IEEEtran. If you use MikTeX, it’s in the package
You should be able to find the file with
kpsewhich IEEEtran.cls. If this command runs but cannot find the file, make sure its parent directories are readable and executable by everyone (
sudo chmod 755 /usr/local/texlive/2020/texmf-dist/tex/latex/IEEEtran/, or wherever it is.) If the command can find the file but you cannot open it with
more, set it world-readable (
sudo chmod 644 /usr/local/texlive/2020/texmf-dist/tex/latex/IEEEtran/IEEEtran.cls or wherever it is.) If your shell cannot find the
kpsewhich command itself, make sure to add the directory with your TeX binaries to your
PATH, and also the documentation to your
INFOPATH. I have the following in a file called
If you do a custom installation, I would advise creating a user
tex (or perhaps using the
bin account) and running the installation and update commands as, for example,
sudo -u tex -g tex $(which tlmgr) update --self --all
You then run all commands except installers from your own account (just
sudo), but when you install, you are only giving the installer permission to write to your TeX installation, not full root access.
Now that the OP has posted an answer, I’d like to follow up on some of the remaining questions they had.
You do not need to install TeX Live as root, although that will work. The reason you might not want to is security: if you install as root, every package install script runs
sudo root. You can create a new user and group that owns only the TeX installation with
sudo adduser --system --group --home-dir /usr/local/texlive tex
This will create a new user and group account that cannot log in and owns only the TeX Live directory. You can, however, run commands as
sudo -u tex. The sole purpose of this account is to run TeX installers and updates. That way, they only have permission to read and modify your TeX distribution.
Having done this, you want to create a local TeX tree that tex owns, and make sure that only TeX can add and remove files there, but everyone else can use
ls on it.
sudo mkdir /usr/local/texlive
sudo chown tex:tex /usr/local/texlive
sudo chmod 755 /usr/local/texlive
chmod as generating a file. but what it does is set file permissions. I’m using the old-fashioned octal codes because I’m a UNIX grognard. What’s relevant here is that 755 means everyone can read and execute a file, but only you can write it.)
If you already have this directory, you can remove it and start over, or just hand ownership to tex with
chown -R tex:tex /usr/local/share/texlive/
You can now install TeX Live, as tex, to this new directory that TeX owns. From the directory where you unpacked the TeX Live installer:
chmod 755 install-tl
sudo -u tex -E ./install-tl
-u tex means run as the user tex, and
-E means preserve the environment variables, for example
LANG to determine the language. By default, the installer should put the files in the new directory you just created,
/usr/local/texlive/. Since tex owns this directory, it can.
There’s still some set-up left to do. First, you need to add your TeX Live directories to your
INFOPATH environment variables, ahead of the system directories. Reposting from above: you can save the following to a file named
/etc/profile.d/texlive.sh and it will load the next time you open a shell.
exec bash -login to reload your environment,
latex --version should give you
pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020). You should also be able to run
man latex and
The command to update your tex installation is long and annoying, but you can create an easy-to-remember alias. Edit the file
~/.profile and add the following line at the end:
alias update-tex=`sudo -u tex -E $(which tlmgr) update --self --all`
The next time you open a command prompt (or refresh it with
exec bash -login), you can update by typing
Installing Non-Libre Fonts from CTAN
There’s a bit of a gotcha if you want to install
getnonfreefonts from CTAN. You might be tempted to install to your user directory, because that’s the only way that works out of the box. You want to install as
--user. Installing 8-bit fonts as a user is a trap. This requires a little trick, but it works. If you install as user, the installer will run
updmap as a user, which will create a font map in your user directory. That will appear to work at first, but it will hide the system map from you and not be updated when you update the system map, so your map file will get more and more out of date.
The command you have to run for the installer to work is
sudo -u tex -E --preserve-env=PATH $(which texlua) install-getnonfreefonts
This command creates a perl script to install the fonts, which you run with
sudo -u tex -E --preserve-env=PATH /usr/local/texlive/2020/texmf-dist/scripts/getnonfreefonts/getnonfreefonts.pl --sys --all --refreshmap --http
Installing Other Local Files
Sometimes, you might want to download TeX files that are not available as TeX Live packages, such as your publisher’s class file or the Type 1 fonts for Georgian. You usually want to put these in a subdirectory of
/usr/local/texlive/texmf-local/) . rather than
~/texmf/) . You can copy a directory with
sudo -u tex cp -r. After manually installing new files, run
sudo -u tex -E $(which texhash)
sudo -u tex -E $(which updmap-sys)
This makes sure your indices and map files are up to date.
If you only need them for one project, you can copy them to your project directory.
Installing and Using Fonts
You can install new fonts for your user account by saving them to
~/.fonts/, or for everyone by saving them to
You might want to add your TeX tree to the system font paths. (Or even need to, for XeTeX to consistently find them.) The file to do this is
texlive-fontconfig.conf, and you can enable it by creating a symbolic link to it in the directory
sudo ln -s /usr/local/texlive/2020/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive2020.conf
I additionally created a file with the same format to index the fonts in my TEXMFLOCAL tree. I saved the following as
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
I gave these files a low number, such as
09, so that they will be searched before the system directories. The fonts in my TeX directories are usually more up-to-date..
Both XeTeX and LuaTeX should automatically refresh their databases the next time you request a font it doesn’t know about, but you can manually make them do it with
sudo fc-cache -fsv
luaotfload-tool --update --local --prefer-texmf
Other Optional Stuff
Some people recommend making a dummy
apt package to prevent a second version of
texlive from being automatically installed. I personally have not had that problem.