facing a problem while installing latex from terminal

i am new to Ubuntu and have Ubuntu 14.04.02 installed on my computer. I wanted to install the latest latex and so I downloaded and extracted the file from install-tl-unx.tar.gz and according to instructions given here.

I wrote the command ./install-tl and after that wrote i for installing latex on harddisk.but it was showing

./install-tl: mkdir(/usr/local/texlive/) failed, goodbye: Permission denied

what should I do ?


Solution 1:

@nikhilweee is right. Don't use sudo.

TeXLive installation scripts cannot cater to the myriad of folder structures and permissions.

When you have access to sudo

The best installation method is the official method. Stay with the official folder location /usr/local by doing a cd /usr/local then a sudo mkdir texlive && sudo chown `whoami` texlive.

The install-tl script will then run without a hitch.

Staying with the default folder location lets you write documentation and instructions (for your team) easier. The official guides for TeXLive uses that folder location, so your team can get some self-help browsing those guides themselves. Also, 3rd-party packages (like Atom editor) can be easily configured given standard TeX Live folder locations.

When you have no access to sudo

See answer from @PHPirate at here.

Solution 2:

Using administration rights via sudo

sudo ./install-tl

You could also install texlive-full or texlive via the package manager by:

sudo apt-get install texlive-full

or:

sudo apt-get install texlive

Solution 3:

As @nikhilweee already mentions, sometimes you cannot or do not want to use sudo, so you want to install to your users' directory. There are at least two ways you can go about this.

  1. You can set the following environment variables,

as per this SO answer:

export TEXLIVE_INSTALL_PREFIX=/home/your_user/texlive
export TEXLIVE_INSTALL_TEXDIR=/home/your_user/texlive/2018

and then install with ./install-tl.

  1. You can use a texlive.profile file for installation and change all the /usr/local paths to /home/your_user, then install with ./install-tl --profile=texlive.profile.