一般情况下,安装g++只需要一个命令:
yum install gcc-c++。
但是今天新建了一台小机子,发现通过这个命令怎么也安装不上,问题如下:
mpfr-2.4.1-6.el6.x86_64: failure: Packages/mpfr-2.4.1-6.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
libgomp-4.4.7-17.el6.x86_64: failure: Packages/libgomp-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
gcc-c++-4.4.7-17.el6.x86_64: failure: Packages/gcc-c++-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
libgcc-4.4.7-17.el6.x86_64: failure: Packages/libgcc-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
cpp-4.4.7-17.el6.x86_64: failure: Packages/cpp-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
libstdc++-4.4.7-17.el6.x86_64: failure: Packages/libstdc++-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
gcc-4.4.7-17.el6.x86_64: failure: Packages/gcc-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
cloog-ppl-0.15.7-1.2.el6.x86_64: failure: Packages/cloog-ppl-0.15.7-1.2.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
ppl-0.10.2-11.el6.x86_64: failure: Packages/ppl-0.10.2-11.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
libstdc++-devel-4.4.7-17.el6.x86_64: failure: Packages/libstdc++-devel-4.4.7-17.el6.x86_64.rpm from base: [Errno 256] No more mirrors to try.
看了一些帖子,说需要添加两个命令:
yum clean all
yum makecache
在添加这个命令时又报错,百度上有人说这种错误,是因为没有配置/etc/resolv.conf。
解决方法:编辑resolv.conf文件,添加:nameserver 8.8.8.8
发现添加以后还是不行。
仔细读了一遍报的错误,是镜像找不到。于是在这台机子上先挂载,然后再安装g++问题解决
挂载的命令:
mount -t iso9660 /dev/cdrom /mnt/cdrom/(/mnt下没有cdromd的要先建立cdrom文件夹)
然后安装g++:
yum install gcc-c++