Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a few package installation related questions concerning RPM, YUM and CentOS and getting GCC installed:

  1. I've mounted my distribution media on my CentOS 5.2 machine but I can't seem to work out how to point RPM at the media and use that instead of looking to the internet. All the examples I've googled for appear to assume downloading the RPM's from the internet.

  2. What does the -ivh switch combo do (I'm guessing -i is for install)? I did man rpm but the switch count and combinations blew my mind.

  3. Should I be using YUM instead of RPM?

share|improve this question
add comment

4 Answers 4

up vote 7 down vote accepted

I'd recommend using yum localinstall rather than using the rpm command directly; that way you'll have the gcc package in your yum database so that it can keep track of updates. The command would just be:

yum localinstall /mnt/cdrom/CentOS/gcc-(whatever).rpm
share|improve this answer
    
Good answer, I didn't know about that. –  Bill Weiss Jul 1 '10 at 19:31
    
These were all great answers and they all got a +1 from me earlier, but this was the one got me going. –  Kev Jul 2 '10 at 6:28
add comment

You want to use something like rpm -ivh /mnt/cdrom/CentOS/gcc-(whatever).rpm. The command line options there are:

  • -i -- install (you can use -U to install or upgrade, many just always use that)
  • -v -- verbose output
  • -h -- show hashmarks, a simplistic progress bar

Yum will figure out which package you mean if you type yum install gcc. That'll use your chosen repository, or the CD if you've got the correct repository installed (which you probably do). In general, yum is easier to use if you're not doing anything strange.

share|improve this answer
add comment

There is probably already a repo defined in yum for the centos media that you can use that just needs to be enabled. The documentation included in the file shows you how you could disable all your remote repos, enable just the local media repo and install your software package from cd.

$ cat /etc/yum.repos.d/CentOS-Media.repo 
# CentOS-Media.repo
#
# This repo is used to mount the default locations for a CDROM / DVD on
#  CentOS-5.  You can use this repo and yum to install items directly off the
#  DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
#  yum --enablerepo=c5-media [command]
#  
# or for ONLY the media repo, do this:
#
#  yum --disablerepo=\* --enablerepo=c5-media [command]

[c5-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/
        file:///media/cdrom/
        file:///media/cdrecorder/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
share|improve this answer
    
If you are going to go with a yum localinstall keep in mind that it usually works best when the package being installed has no dependencies. That's why setting up the local DVD repo as mtinberg/Rajat explained is not overkill, because it won't be the last time you install something from the DVD. I can't believe that yum did not go out on the internet to resolve the dependencies on binutils, cpp, and glibc-devel. Am I missing something? –  Allen Jul 4 '10 at 19:47
add comment

1 step rpm -ivh vsftpd.x86_64 0:2.2.2-7.rpm

2 step rpm -ivh createrepo-0.9.8-4.rpm

3 step copy every thing from DVD or .iso to /var/ftp/pub (cp -av /var/ftp/pub)

4 step createrepo -v /var/ftp/pub/

5 step vi /etc/yum.repos.d/base.repo

6 step

[base] name=Server Software baseurl=ftp://192.168.0.254/pub/ enabled=1 gpgcheck=0

7 step yum install gcc -y

share|improve this answer
    
"Set up a local package repository" seems like overkill for "hey, how do I install a package?", doesn't it? –  Bill Weiss Jul 1 '10 at 19:32
    
yum install <package> -y –  Rajat Jul 2 '10 at 11:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.