Skip to content

How to install gcc using chroot

William Zhang edited this page Aug 31, 2016 · 1 revision

The default version of g++ for CentOS 6 is 4.4.x. And the default one for CentOS 7 is 4.8.x. See link for details.

$ cat chroot.repo 
[centos.7.base.$basearch]
name=centos7
baseurl=http://mirrors.yun-idc.com/centos/7/os/$basearch
gpgcheck=0

$ sudo yum install -c chroot.repo --installroot=/home/zedware/chroot gcc gcc-c++ gdb make
$ sudo chroot /home/zedware/chroot

NB:

  1. Have to chroot to use the new tools
  2. Have to cp/mv the source code to be compiled with the new tool
Clone this wiki locally