gcc – How to Install gfortran-7

gcc

I have successfully installed gcc-7 with

sudo sed -i 's/xenial/zesty/g' /etc/sources.list.d/ubuntu-toolchain-r*.list
sudo apt update && sudo apt full-upgrade

Howver this does not install gfortran. I need gfortran-7 for my work.
Installing gfortran from gcc source, which provides for specifying languages to be installed gives an error (sfp-exceptions.c) at the make stage.
Does anyone know how I can have gfortran-7 installed.
I am working on ubuntu 16.04
Hello again, my apologies to those who have spent time looking at my problem. I managed to install gfortran-7 with

sudo apt-get install gfortran

Previously it did not work. Perhaps because of gcc-7, gofrtran-7 has installed. I am now trying to figure out how to make gfortran-7 the default, currently –version shows gfortran-5.
Thank you all
Perhaps someone can assist me make gfortran-7 as the alternative to gfortran-5. I have been able to make gcc-7 as the alternative with

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 60 --slave /usr/bin/g++ g++ /usr/bin/g++-5
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 40 --slave /usr/bin/g++ g++ /usr/bin/g++-7

then

sudo update-alternatives --config g++

I have tried to modify the above commands for gfortran, without success, even with reference to
man

man update-alternatives

or

update-alternatives --help

Please help

Best Answer

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).