0

I am using RHEL 6.4, I know installing through yum command,

but I want to download offline mode Linux RPM(version 7.1.0) GCC package and install(for c/c++ programs),

I searched on the internet but not able to find out the solution,

please help me.

Lavakusa
  • 105
  • 1
  • 15

1 Answers1

0

If you can access the package via yum then you can either download and install or you can download an already installed package as rpm file. Here is written how, I quoted it anyways.

If you have that rpm file you can install it also via yum: yum install packageName.rpm, you may have to invoke sudo.

The package names for the C/C++ compiler are: gcc.x86_64 (C: 64bit) and gcc-c++.x86_64 (C++: 64bit) or gcc.i686 (C: 32bit) and gcc-c++.i686 (C++: 32bit).

If the downloaded version via yum, which is the latest available for your system, is not the version you want, you have to download the sources and 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.
Andre Kampling
  • 5,476
  • 2
  • 20
  • 47
  • Please specify the name of the package or how can I find that package particular name – Lavakusa Jun 16 '17 at 08:56
  • I assume that you already installed the package via yum on your clients computer. Isn't that right? What does `yum info gcc-c++` outputs under Version? – Andre Kampling Jun 16 '17 at 08:59
  • I have a fresh Linux server, I didn't install any software, I have no internet access in my home so, i am copying GCC compiler from the internet and i will bring back to my home and i will install my Linux server. – Lavakusa Jun 16 '17 at 09:03
  • I want complete download software and put into some external drive bring to my system.. – Lavakusa Jun 16 '17 at 09:07
  • Then the package names are: `gcc.x86_64` (C: 64bit) and `gcc-c++.x86_64` (C++: 64bit) and `gcc.i686` (C: 32bit) and `gcc-c++.i686` (C++: 32bit). With that follow the instructions above! – Andre Kampling Jun 16 '17 at 09:08
  • I am not able to install yum command because of lack of internet. So, I need complete offline package or installer... – Lavakusa Jun 16 '17 at 09:10
  • Yeah sure, but on any computer you have to download it with internet access like you write: `i am copying GCC compiler from the internet and i will bring back to my home`. If you have no Linux system with internet try `https://www.rpmfind.net/`. But **caution**, you will find fedora packages. Most times they are compatible with RHEL but you want install a sensible part, so take backups. So I recomment install same Linux system to download it! – Andre Kampling Jun 16 '17 at 09:14
  • Is there any way to install GCC 4.8.5 rpm in RHEL 6.4, – Lavakusa Jun 16 '17 at 09:53
  • @Lavakusa: In your title you wrote you want version 7.1.0, now you write 4.8.5!? What is the problem with my instructions? Please tell. – Andre Kampling Jun 16 '17 at 09:55
  • I followed your instructions It's working, I want to install GCC 4.8.5 but when I installed GCC version is 4.4.7. Is there anyway. – Lavakusa Jun 16 '17 at 09:56
  • my minimum requirement is 4.8.5 but I thought 7.1.0 is good for me, I follow your instructions I installed GCC 4.4.7 – Lavakusa Jun 16 '17 at 09:57
  • downloaded rpm is :- gcc-c++-4.4.7-18.el6.x86_64.rpm – Lavakusa Jun 16 '17 at 09:59
  • If that is the latest version via yum available, then you have to [build newer sources](https://gcc.gnu.org/wiki/InstallingGCC) on your own or use rpmfind as I said already. – Andre Kampling Jun 16 '17 at 09:59
  • Yes, I tried with that, i am not able to find the RedHat GCC rpm, but i found Centos--- gcc-4.8.5-11.el7.x86_64, Installed , Result is :--- **libgcc = 4.4.7-18.el6 You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest** – Lavakusa Jun 16 '17 at 10:04
  • @Lavakusa: Then build it, as I said. – Andre Kampling Jun 16 '17 at 10:06