Skip to content

Instantly share code, notes, and snippets.

@yorkie
Created August 6, 2014 05:43
Show Gist options
  • Save yorkie/9ff3216e5b6cf9a84c66 to your computer and use it in GitHub Desktop.
Save yorkie/9ff3216e5b6cf9a84c66 to your computer and use it in GitHub Desktop.
update your gcc in centos

update yum config via vi:

$ vi /etc/yum.repos.d/DevToolset.repo

make sure this file is new and paste below block to your terminal:

[DevToolset-2]
name=RedHat DevToolset v2 $releasever - $basearch
baseurl=http://puias.princeton.edu/data/puias/DevToolset/$releasever/$basearch/
enabled=1
gpgcheck=0

install gcc 4.8.1:

$ yum install devtoolset-2-gcc-4.8.1 devtoolset-2-gcc-c++-4.8.1
$ /opt/rh/devtoolset-2/root/usr/bin/gcc --version
> gcc (GCC) 4.8.1 20130715 (Red Hat 4.8.1-4)

create link let you just simplely run gcc:

$ ln -s /opt/rh/devtoolset-2/root/usr/bin/* /usr/local/bin/
$ hash -r
$ gcc --version
> gcc (GCC) 4.8.1 20130715 (Red Hat 4.8.1-4)
@yorkie
Copy link
Author

yorkie commented Aug 6, 2014

This tutorial is inspired by http://superuser.com/questions/381160/how-to-install-gcc-4-7-x-4-8-x-on-centos, thank you the author :)

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