Skip to content

Instantly share code, notes, and snippets.

@zuyu
Last active May 3, 2024 06:57
Show Gist options
  • Save zuyu/7d5682a5c75282c596449758d21db5ed to your computer and use it in GitHub Desktop.
Save zuyu/7d5682a5c75282c596449758d21db5ed to your computer and use it in GitHub Desktop.
Install gcc 6 on Ubuntu
sudo apt update && \
sudo apt install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
sudo apt update && \
sudo apt install gcc-6 g++-6 -y && \
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6 && \
gcc -v
@AtoshDustosh
Copy link

I'm on 20.04 and get
E: Package 'gcc-6' has no installation candidate
E: Package 'g++-6' has no installation candidate

  1. sudo vim /etc/apt/sources.list
  2. add deb http://dk.archive.ubuntu.com/ubuntu/ bionic main universe to file
  3. sudo apt update
    4.sudo apt-get install gcc-6 g++-6 -y

It worked!. Thank you so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment