I just installed g++10 on my computer, which runs the Ubuntu OS. These are the commands I used to install:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test