问题:
yum install -y gcc gcc-c++
Loaded plugins: product-id, refresh-packagekit, search-disabled-repos, security,
: subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Setting up Install Process
No package gcc-c++ available.
Nothing to do
解决方式:关注红色部分
[root@bogon pcre-8.39]# cat /etc/issue && uname -a
Red Hat Enterprise Linux Server release 6.9 (Santiago)
Kernel \r on an \m
Linux bogon 2.6.32-696.20.1.el6.x86_64 #1 SMP Fri Jan 12 15:07:59 EST 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@bogon pcre-8.39]# rpm -qa|grep yum|xargs rpm -e --nodeps
[root@bogon pcre-8.39]# cat /etc/issue && uname -a
Red Hat Enterprise Linux Server release 6.9 (Santiago)
Kernel \r on an \m
Linux bogon 2.6.32-696.20.1.el6.x86_64 #1 SMP Fri Jan 12 15:07:59 EST 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@bogon pcre-8.39]# cat /etc/issue && uname -a
Red Hat Enterprise Linux Server release 6.9 (Santiago)
Kernel \r on an \m
Linux bogon 2.6.32-696.20.1.el6.x86_64 #1 SMP Fri Jan 12 15:07:59 EST 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@bogon pcre-8.39]# rpm -qa |grep yum
[root@bogon pcre-8.39]# cd ..
[root@bogon software]# mkdir yumdir
[root@bogon software]# cd yumdir/
[root@bogon yumdir]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
--2018-05-21 09:55:08-- http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
Resolving mirrors.163.com... 59.111.0.251
Connecting to mirrors.163.com|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 27224 (27K) [application/x-redhat-package-manager]
Saving to: “yum-metadata-parser-1.1.2-16.el6.x86_64.rpm”
100%[===================================================================================================================>] 27,224 --.-K/s in 0.05s
2018-05-21 09:55:08 (519 KB/s) - “yum-metadata-parser-1.1.2-16.el6.x86_64.rpm” saved [27224/27224]
[root@bogon yumdir]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
--2018-05-21 09:56:29-- http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
Resolving mirrors.163.com... 59.111.0.251
Connecting to mirrors.163.com|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1042364 (1018K) [application/x-redhat-package-manager]
Saving to: “yum-3.2.29-81.el6.centos.noarch.rpm”
100%[===================================================================================================================>] 1,042,364 1.45M/s in 0.7s
2018-05-21 09:56:30 (1.45 MB/s) - “yum-3.2.29-81.el6.centos.noarch.rpm” saved [1042364/1042364]
[root@bogon yumdir]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
--2018-05-21 09:58:04-- http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
Resolving mirrors.163.com... 59.111.0.251
Connecting to mirrors.163.com|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 33524 (33K) [application/x-redhat-package-manager]
Saving to: “yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm”
100%[===================================================================================================================>] 33,524 --.-K/s in 0.06s
2018-05-21 09:58:04 (591 KB/s) - “yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm” saved [33524/33524]
[root@bogon yumdir]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
--2018-05-21 09:58:54-- http://mirrors.163.com/.help/CentOS6-Base-163.repo
Resolving mirrors.163.com... 59.111.0.251
Connecting to mirrors.163.com|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2006 (2.0K) [application/octet-stream]
Saving to: “CentOS6-Base-163.repo”
100%[===================================================================================================================>] 2,006 --.-K/s in 0s
2018-05-21 09:58:54 (181 MB/s) - “CentOS6-Base-163.repo” saved [2006/2006]
[root@bogon yum.repos.d]# ls
CentOS6-Base-163.repo redhat.repo rhel-source.repo
[root@bogon yum.repos.d]# vi CentOS6-Base-163.repo 修改$releasever为6或者7
[root@bogon yum.repos.d]# clean all
bash: clean: command not found
[root@bogon yum.repos.d]# yum makecache
bash: /usr/bin/yum: No such file or directory
[root@bogon yum.repos.d]# cd /usr/local/software/yumdir/
[root@bogon yumdir]# rpm -ivh yum*
warning: yum-3.2.29-81.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [ 33%]
2:yum-plugin-fastestmirro########################################### [ 67%]
3:yum ########################################### [100%]
[root@bogon yumdir]# clean all
bash: clean: command not found
[root@bogon yumdir]# yum makecache
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
base | 3.7 kB 00:00
base/group_gz | 226 kB 00:00
base/filelists_db | 6.4 MB 00:03
base/primary_db | 4.7 MB 00:02
base/other_db | 2.8 MB 00:01
extras | 3.4 kB 00:00
extras/filelists_db | 26 kB 00:00
extras/prestodelta | 1.7 kB 00:00
extras/primary_db | 30 kB 00:00
extras/other_db | 32 kB 00:00
updates | 3.4 kB 00:00
updates/filelists_db | 4.7 MB 00:02
updates/prestodelta | 270 kB 00:00
updates/primary_db | 7.5 MB 00:04
updates/other_db | 108 MB 01:11
Metadata Cache Created
[root@bogon yumdir]#
[root@bogon yumdir]#
[root@bogon yumdir]# yum install -y gcc gcc-c++
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Setting up Install Process
Determining fastest mirrors
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-18.el6 will be updated
---> Package gcc.x86_64 0:4.4.7-18.el6_9.2 will be an update
--> Processing Dependency: libgomp = 4.4.7-18.el6_9.2 for package: gcc-4.4.7-18.el6_9.2.x86_64
--> Processing Dependency: cpp = 4.4.7-18.el6_9.2 for package: gcc-4.4.7-18.el6_9.2.x86_64
--> Processing Dependency: libgcc >= 4.4.7-18.el6_9.2 for package: gcc-4.4.7-18.el6_9.2.x86_64
---> Package gcc-c++.x86_64 0:4.4.7-18.el6_9.2 will be installed
--> Processing Dependency: libstdc++-devel = 4.4.7-18.el6_9.2 for package: gcc-c++-4.4.7-18.el6_9.2.x86_64
--> Processing Dependency: libstdc++ = 4.4.7-18.el6_9.2 for package: gcc-c++-4.4.7-18.el6_9.2.x86_64
--> Running transaction check
---> Package cpp.x86_64 0:4.4.7-18.el6 will be updated
---> Package cpp.x86_64 0:4.4.7-18.el6_9.2 will be an update
---> Package libgcc.x86_64 0:4.4.7-18.el6 will be updated
---> Package libgcc.x86_64 0:4.4.7-18.el6_9.2 will be an update
---> Package libgomp.x86_64 0:4.4.7-18.el6 will be updated
---> Package libgomp.x86_64 0:4.4.7-18.el6_9.2 will be an update
---> Package libstdc++.x86_64 0:4.4.7-18.el6 will be updated
---> Package libstdc++.x86_64 0:4.4.7-18.el6_9.2 will be an update
---> Package libstdc++-devel.x86_64 0:4.4.7-18.el6_9.2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================================================
Installing:
gcc-c++ x86_64 4.4.7-18.el6_9.2 updates 4.7 M
Updating:
gcc x86_64 4.4.7-18.el6_9.2 updates 10 M
Installing for dependencies:
libstdc++-devel x86_64 4.4.7-18.el6_9.2 updates 1.6 M
Updating for dependencies:
cpp x86_64 4.4.7-18.el6_9.2 updates 3.7 M
libgcc x86_64 4.4.7-18.el6_9.2 updates 103 k
libgomp x86_64 4.4.7-18.el6_9.2 updates 134 k
libstdc++ x86_64 4.4.7-18.el6_9.2 updates 296 k
Transaction Summary
=============================================================================================================================================================
Install 2 Package(s)
Upgrade 5 Package(s)
Total download size: 21 M
Downloading Packages:
(1/7): cpp-4.4.7-18.el6_9.2.x86_64.rpm | 3.7 MB 00:02
(2/7): gcc-4.4.7-18.el6_9.2.x86_64.rpm | 10 MB 00:05
(3/7): gcc-c++-4.4.7-18.el6_9.2.x86_64.rpm | 4.7 MB 00:02
(4/7): libgcc-4.4.7-18.el6_9.2.x86_64.rpm | 103 kB 00:00
(5/7): libgomp-4.4.7-18.el6_9.2.x86_64.rpm | 134 kB 00:00
(6/7): libstdc++-4.4.7-18.el6_9.2.x86_64.rpm | 296 kB 00:00
(7/7): libstdc++-devel-4.4.7-18.el6_9.2.x86_64.rpm | 1.6 MB 00:00
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 1.6 MB/s | 21 MB 00:12
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Retrieving key from http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
Userid: "CentOS-6 Key (CentOS 6 Official Signing Key)
From : http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
** Found 3 pre-existing rpmdb problem(s), 'yum check' output follows:
PackageKit-0.5.8-26.el6.x86_64 has missing requires of PackageKit-yum = ('0', '0.5.8', '26.el6')
PackageKit-0.5.8-26.el6.x86_64 has missing requires of PackageKit-yum-plugin = ('0', '0.5.8', '26.el6')
rhn-check-1.0.0.1-43.el6.noarch has missing requires of yum-rhn-plugin >= ('0', '0.9.1', '35')
Updating : libgcc-4.4.7-18.el6_9.2.x86_64 1/12
Updating : libstdc++-4.4.7-18.el6_9.2.x86_64 2/12
Installing : libstdc++-devel-4.4.7-18.el6_9.2.x86_64 3/12
Updating : cpp-4.4.7-18.el6_9.2.x86_64 4/12
Updating : libgomp-4.4.7-18.el6_9.2.x86_64 5/12
Updating : gcc-4.4.7-18.el6_9.2.x86_64 6/12
Installing : gcc-c++-4.4.7-18.el6_9.2.x86_64 7/12
Cleanup : gcc-4.4.7-18.el6.x86_64 8/12
Cleanup : libstdc++-4.4.7-18.el6.x86_64 9/12
Cleanup : libgcc-4.4.7-18.el6.x86_64 10/12
Cleanup : cpp-4.4.7-18.el6.x86_64 11/12
Cleanup : libgomp-4.4.7-18.el6.x86_64 12/12
Verifying : libgomp-4.4.7-18.el6_9.2.x86_64 1/12
Verifying : gcc-4.4.7-18.el6_9.2.x86_64 2/12
Verifying : libstdc++-4.4.7-18.el6_9.2.x86_64 3/12
Verifying : gcc-c++-4.4.7-18.el6_9.2.x86_64 4/12
Verifying : libstdc++-devel-4.4.7-18.el6_9.2.x86_64 5/12
Verifying : cpp-4.4.7-18.el6_9.2.x86_64 6/12
Verifying : libgcc-4.4.7-18.el6_9.2.x86_64 7/12
Verifying : cpp-4.4.7-18.el6.x86_64 8/12
Verifying : libgomp-4.4.7-18.el6.x86_64 9/12
Verifying : libstdc++-4.4.7-18.el6.x86_64 10/12
Verifying : libgcc-4.4.7-18.el6.x86_64 11/12
Verifying : gcc-4.4.7-18.el6.x86_64 12/12
Installed:
gcc-c++.x86_64 0:4.4.7-18.el6_9.2
Dependency Installed:
libstdc++-devel.x86_64 0:4.4.7-18.el6_9.2
Updated:
gcc.x86_64 0:4.4.7-18.el6_9.2
Dependency Updated:
cpp.x86_64 0:4.4.7-18.el6_9.2 libgcc.x86_64 0:4.4.7-18.el6_9.2 libgomp.x86_64 0:4.4.7-18.el6_9.2 libstdc++.x86_64 0:4.4.7-18.el6_9.2
Complete!
[root@bogon yumdir]#
[root@bogon yumdir]# g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)