install gcc-9 on Ubuntu 18.04?

gcc-9 is just released.

I was wondering if there is a repository that allows me to install gcc 9 on Ubuntu 18.04 LTS (bionic)?

There seems to be repositories supporting disco:

https://packages.ubuntu.com/disco/gcc-9-base

But I liked to have it on the current LTS for a while.


Solution 1:

It is now available in ubuntu-toolchain-r too:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-9

If the add-apt-repository command cannot be found, run this:

sudo apt install software-properties-common

Solution 2:

I used a search for PPAs, using search on launchpad.net and found JonathonF's GCC 9.0 PPA. You can install this package by:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:jonathonf/gcc
sudo apt-get update
sudo apt-get install gcc-9