63

I just finished installing LaTeX for my company's Ubuntu server that we all SSH into to use. At the end of the install it says this:

Add /usr/local/texlive/2010/texmf/doc/man to MANPATH, if not dynamically determined.

Add /usr/local/texlive/2010/texmf/doc/info to INFOPATH.

Most importantly, add /usr/local/texlive/2010/bin/x86_64-linux to your PATH for current and future sessions.

How do I do this so that these variables are set for all users on the system? (And yes, I have sudo permissions).

muru
  • 197,895
  • 55
  • 485
  • 740
Rob S.
  • 1,631
  • @geirha's answer (with Rob's comment on MANPATH) resolves this except for the INFOPATH variable. Though I imagine it is not often used by users(?), does anyone know the correct location to set that? Should it also be /etc/environment ? – belacqua Feb 05 '11 at 19:27
  • @jgbelacqua afaik Debian and some other Linux distros use it but not Ubuntu. Or at least thats the best I could gather frm searching on google for an hour. – Rob S. Feb 05 '11 at 21:36
  • When you installed TeXlive 2010, it should have asked you if you wanted to create symlinks for all the binaries. If you had said yes, this wouldn't have been an issue at all. – frabjous Feb 06 '11 at 01:10
  • @frabjous It never asked me. The only command I ever gave it was "i" in the beginning to initiate the installation. Anyways, after setting the variables, it all works perfectly. – Rob S. Feb 06 '11 at 15:01
  • There wasn't a menu with other options at that point? If not, you must have used a different installer than the normal one (here). – frabjous Feb 06 '11 at 21:45
  • @frabjous That IS the installer I used (grabbed via wget too). – Rob S. Feb 07 '11 at 14:27
  • You must have missed the menu then. – frabjous Feb 07 '11 at 17:00
  • @frabjous Again, I was only prompted once at which point I entered "i" as recommended in the installation section of the documentation. – Rob S. Feb 08 '11 at 15:39
  • There are other things you can press there besides i; there's a whole menu, one of which is to add the symlinks. – frabjous Feb 08 '11 at 19:52
  • 1
    @frabjous: The symlink option seems to be now missing from the installer. I installed TeXLive 2011 today and could find it anymore. I installed TeXLive in multiple versions at least a dozen times before, so I wondered why it isn't there anymore. – Martin Scharrer May 01 '12 at 10:20

2 Answers2

69

You add those to /etc/environment.

It likely already has a line for PATH, so you just append :/usr/local/texlive/2010/bin/x86_64-linux to the end of that. Then add two new lines for MANPATH and INFOPATH.

See https://help.ubuntu.com/community/EnvironmentVariables.

After editing /etc/environment, log out and back in, and check that e.g. echo "$MANPATH" outputs the value you added.

geirha
  • 46,101
  • In the end I also had to edit /etc/manpath.config. Thanks. – Rob S. Feb 05 '11 at 18:09
  • 2
    I've deleted my answer, as this appears to be a better choice. According to https://help.ubuntu.com/community/EnvironmentVariablesSystem-wide /etc/environment is the place for "Environment variable settings that affect the system as a whole (rather then just a particular user) [...]"
    /etc/profile and /etc/bash.bashrc are listed as 'Not recommended'
    – belacqua Feb 05 '11 at 18:29
  • 1
    Annoyingly doesn't work for root! – Owl Apr 09 '19 at 08:49
10

Add these default PATH to /etc/profile. It will work for bash and sh. Bash is default in Ubuntu.

PATH=$PATH:<new path you need to add>

echo $SHELL can be used to determine the shell of current user or can be viewed from /etc/passwd file.

Alternatively you can include it in /etc/environment as well. Here you can just add the PATH at the end of PATH statement.

d a i s y
  • 5,511
Jamess
  • 3,123
  • I opened up etc/profile in vim and there was nothing regarding PATH in it. Thanks for the reply just the same. – Rob S. Feb 05 '11 at 17:22
  • 21
    The order of execution of files is /etc/environment -> /etc/profile -> /etc/bash.bashrc -> /home//.profile -> /home//.bashrc – Jamess Feb 06 '11 at 10:11
  • editing /etc/profile path variable could damage system and its better to avoid. specially when you are connecting to remote host via ssh. – AmirHossein Rezaei Aug 25 '19 at 05:21