non-sudo Homebrew on Linux
Homebrew is for Linux and MacOS, allowing install of the latest compilers and other packages without sudo.
Use the Homebrew install script without sudo.
Install desired packages such as Gfortran:
brew install gcc
Generally the latest compilers are available from Homebrew for Linux and MacOS.
Instead of putting Homebrew environment variables into ~/.profile, consider putting them into
~/brew.sh, where you can activate them when needed, instead of constantly being active.
Either choice is fine of course.
PATH="/home/linuxbrew/.linuxbrew/bin:$PATH" MANPATH="/home/linuxbrew/.linuxbrew/share/man:$MANPATH" INFOPATH="/home/linuxbrew/.linuxbrew/share/info:$INFOPATH" HOMEBREW_EDITOR="nano"
To use Homebrew, type
Upon closing the terminal, the configuration falls back to default (non-Homebrew)