1. 개요
현재 서버에 설치된 g++ 버전은 4.4.7 입니다.
gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)
주어진 미션은 더 높은 버전의 g++ 설치하기. 그러나 yum update로는 더이상 업데이트 할 버전이 없다고 합니다.
2. 해결책
구글링을 해보니 repository에 정보를 추가하여 해결했다는 제보를 발견합니다. 그리고 따라합니다.
$ curl http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo > /etc/yum.repos.d/slc6-scl.repo
그리고 devtoolset-3를 설치합니다.
$ yum install devtoolset-3
하지만 마지막 단계에서 오류가 발생합니다.
(27/30): devtoolset-3-toolchain-3.0-15.el6.noarch.rpm | 3.4 kB 00:00 (28/30): devtoolset-3-valgrind-3.9.0-8.3.el6.x86_64.rpm | 14 MB 00:44 (29/30): kernel-devel-2.6.32-696.3.2.el6.x86_64.rpm | 11 MB 00:00 (30/30): scl-utils-20120927-27.el6_6.x86_64.rpm | 22 kB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------ Total 331 kB/s | 89 MB 04:34 warning: rpmts_HdrFromFdno: Header V4 DSA/SHA1 Signature, key ID 1d1e034b: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-cern
비슷한 문제를 구글링합니다.
해결책 (1)
$ wget http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 $ rpm --import RPM-GPG-KEY-CentOS-6
yum install .. 실패합니다.
해결책 (2)
$ rpm --import /etc/pki/rpm-gpg/RPM*
yum install .. 실패합니다.
해결책 (3)
/etc/yum.repos.d/slc6-scl.repo
파일에서 gpgcheck=1 을 gpgcheck=0 으로 수정합니다.
yum install .. 성공합니다.
devtoolset-3-systemtap-runtime.x86_64 0:2.5-8.el6 devtoolset-3-toolchain.noarch 0:3.0-15.el6 devtoolset-3-valgrind.x86_64 1:3.9.0-8.3.el6 kernel-devel.x86_64 0:2.6.32-696.3.2.el6 Dependency Updated: scl-utils.x86_64 0:20120927-27.el6_6 Complete!
마지막으로 다음 커맨드를 입력합니다.
$ scl enable devtoolset-3 bash
버전이 업그레이드되었음을 확인합니다.
$ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-3/root/usr/libexec/gcc/x86_64-redhat-linux/4.9.1/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --prefix=/opt/rh/devtoolset-3/root/usr --mandir=/opt/rh/devtoolset-3/root/usr/share/man --infodir=/opt/rh/devtoolset-3/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.9.1-20140922/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.9.1-20140922/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.9.1-20140922/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.9.1 20140922 (Red Hat 4.9.1-10) (GCC)