如何在RHEL6.4中安装GCC 7.1.0

How to install GCC 7.1.0 in RHEL6.4

我使用的是 RHEL 6.4,我知道通过 yum 命令安装,

但我想下载离线模式 Linux RPM(版本 7.1.0)GCC 包并安装(对于 c/c++ 程序),

我在互联网上搜索但无法找到解决方案,

请帮助我。

如果您可以通过 yum 访问该软件包,那么您可以 下载并安装 或者您可以 下载已经安装的 打包为 rpm 文件。 Here is written how,反正我引用了

如果您有 rpm 文件,您也可以通过 yum 安装它:yum install packageName.rpm,您可能需要调用 sudo.

C/C++ 编译器的包名是:gcc.x86_64(C:64 位)和gcc-c++.x86_64(C++:64 位)或gcc.i686(C: 32 位)和 gcc-c++.i686(C++:32 位)。

如果通过 yum 下载的版本(适用于您的系统的最新版本)不是您想要的版本,您必须下载源和 build it on your own, see here

There are two ways to download a package without installing it.

One is using the "downloadonly" plugin for yum, the other is using "yumdownloader" utility.

Downloadonly plugin for yum

Install the package including "downloadonly" plugin:

(RHEL5)
# yum install yum-downloadonly

(RHEL6)
# yum install yum-plugin-downloadonly

Run yum command with "--downloadonly" option as follows:

# yum install --downloadonly --downloaddir=<directory> <package>

Confirm the RPM files are available in the specified download directory.

Note:

  • Before using the plugin, check /etc/yum/pluginconf.d/downloadonly.conf to confirm that this plugin is "enabled=1"
  • This is applicable for "yum install/yum update" and not for "yum groupinstall". Use "yum groupinfo" to identify packages within a specific group.
  • If only the package name is specified, the latest available package is downloaded (such as sshd). Otherwise, you can specify the full package name and version (such as httpd-2.2.3-22.el5).
  • If you do not use the --downloaddir option, files are saved by default in /var/cache/yum/ in rhel-{arch}-channel/packages
  • If desired, you can download multiple packages on the same command. You still need to re-download the repodata if the repodata expires before you re-use the cache. By default it takes two hours to expire.

Yumdownloader

If downloading a installed package, "yumdownloader" is useful.

Install the yum-utils package:

# yum install yum-utils

Run the command followed by the desired package:

# yumdownloader <package>

Note:

  • The package is saved in the current working directly by default; use the --destdir option to specify an alternate location.
  • Be sure to add --resolve if you need to download dependencies.