How do I install gfortran-7?

I use aptitude on the command line for everything in ubuntu. I always install the toolchain test builds so I can get all versions of gfortran (I have to support down to 4.9). Here's how I get them on a new install of ubuntu:

sudo apt-get install aptitude
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo aptitude install gcc-7 g++-7 gfortran-7

You can add whatever other versions you want in there (https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test).

I know this is a really late reply, but I just had to install 16.04 after an update to 14.04 destroyed my proprietary nvidia drivers (or maybe it was the other way around).


sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt update sudo apt install gfortran-7

You may need to use update-alternatives to set the compiler version if you have different versions installed.