yum使用过程

  使用YUM来安装软件,就可以不用去到处找依赖关系的RPM了。很方便。
  第一步:安装yum
  第二步:下载createrepo包并安装 下载地址:
   ftp://195.220.108.108/linux/dag/redhat/el4/en/i386/dag/RPMS/createrepo-0.4.6-1.el4.rf.noarch.rpm
  安装createrepo 包rpm -ivh createrepo-0.4.6-1.el4.rf.noarch.rpm
  软件准备就算是完了,下面主要讲创建repo 文件的过程
  第三步:挂载下载的RHEL4.6-i386-AS-DVD.iso 到本地 并完成yum本地源配置
  [root@Lovehack mnt]# mkdir /mnt/RHELAS4      // 建立RHELAS4文件来挂载ISO
  [root@Lovehack mnt]# mount -o loop RHEL4.6-i386-AS-DVD.iso /mnt/RHELAS4 //挂载iso
  [root@Lovehack mnt]# mkdir /mnt/repodata    //建立repodata 文件夹
  [root@Lovehack mnt]# ln -s /mnt/RHELAS4/RedHat/RPMS/*.rpm /mnt/repodata //为镜像所有的rpm做一个链接
  [root@Lovehack mnt]# createrepo /mnt/repodata //创建repomd.xml等必须文件,此过程比较长
  1536/1536 - vino-2.8.1-1.i386.rpm
  Saving Primary metadata
  Saving file lists metadata
  Saving other metadata
  [root@Lovehack mnt]# cd /etc/yum.repos.d/   //进入yum文件夹创建repo文件,把原有的。repo文件备份
  [root@Lovehack yum.repos.d]# ls
  as4-base.repo.bak as4-update.repo.bak backup CentOS-Base.repo.bak
  [root@Lovehack yum.repos.d]# vi iso.repo    //新建iso.repo文件,内容如下
  [iso]
  name=iso
  baseurl=file:///mnt/repodata
  enabled=1
  gpgcheck=1
  gpgkey=file:///mnt/RHELAS4/RPM-GPG-KEY
  第四步:[root@Lovehack yum.repos.d]# yum update
  Setting up Update Process
  Setting up repositories
  iso                         100% |=========================| 951 B    00:00
  Reading repository metadata in from local files
  primary.xml.gz            100% |=========================| 589 kB    00:00
  iso       : ################################################## 1536/1536
  Added 1536 new packages, deleted 0 old in 17.81 seconds
  No Packages marked for Update/Obsoletion

  第五步:剩下的就是安装你想要的东东了,至此已经全部完成


3.安装

[root@orange3c opt]# rpmbuild --rebuild /opt/yum-2.0.8-1.src.rpm 
Installing /opt/yum-2.0.8-1.src.rpm
warning: user skvidal does not exist - using root
warning: group skvidal does not exist - using root
warning: user skvidal does not exist - using root
warning: group skvidal does not exist - using root
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.40879
+ umask 022
+ cd /usr/src/redhat/BUILD
+ LANG=C
+ export LANG
+ unset DISPLAY
+ cd /usr/src/redhat/BUILD
+ rm -rf yum-2.0.8
+ /bin/gzip -dc /usr/src/redhat/SOURCES/yum-2.0.8.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd yum-2.0.8
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.40879
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd yum-2.0.8
+ LANG=C
+ export LANG
+ unset DISPLAY
+ CFLAGS='-O2 -g -pipe -m64'
+ export CFLAGS
+ CXXFLAGS='-O2 -g -pipe -m64'
+ export CXXFLAGS
+ FFLAGS='-O2 -g -pipe -m64'
+ export FFLAGS
++ find . -name config.guess -o -name config.sub
+ ./configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --target=noarch-redhat-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man --infodir=/usr/share/info
checking for a BSD-compatible install... /usr/bin/install -c
configure: creating ./config.status
config.status: creating bin/Makefile
config.status: creating etc/Makefile
config.status: creating Makefile
config.status: creating docs/Makefile
config.status: creating po/Makefile
+ make
for subdir in bin etc docs po ; do \
  make -C $subdir ; \
done
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/bin'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/bin'
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/etc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/etc'
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/docs'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/docs'
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/po'
for cat in cs.po es.po ru.po uk.po; do \
        lang=`basename $cat .po`; \
        if msgmerge -v $lang.po yum.pot > $lang.pot ; then \
                mv -f $lang.pot $lang.po ; \
                echo "msgmerge -v of $lang succeeded" ; \
        else \
                echo "msgmerge -v of $lang failed" ; \
                rm -f $lang.pot ; \
        fi \
done
....................
Read 1 old + 1 reference, merged 194, fuzzied 0, missing 0, obsolete 0.
msgmerge -v of cs succeeded
....................
Read 1 old + 1 reference, merged 194, fuzzied 0, missing 0, obsolete 0.
msgmerge -v of es succeeded
....................
Read 1 old + 1 reference, merged 194, fuzzied 0, missing 0, obsolete 11.
msgmerge -v of ru succeeded
....................
Read 1 old + 1 reference, merged 194, fuzzied 0, missing 0, obsolete 0.
msgmerge -v of uk succeeded
msgfmt --statistics --verbose -o cs.mo cs.po
193 translated messages.
msgfmt --statistics --verbose -o es.mo es.po
178 translated messages, 8 fuzzy translations, 7 untranslated messages.
msgfmt --statistics --verbose -o ru.mo ru.po
170 translated messages, 12 fuzzy translations, 11 untranslated messages.
msgfmt --statistics --verbose -o uk.mo uk.po
193 translated messages.
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/po'
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.22235
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd yum-2.0.8
+ LANG=C
+ export LANG
+ unset DISPLAY
+ '[' /var/tmp/yum-2.0.8root '!=' / ']'
+ rm -rf /var/tmp/yum-2.0.8root
+ make DESTDIR=/var/tmp/yum-2.0.8root install
for subdir in bin etc docs po ; do \
  make -C $subdir ; \
done
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/bin'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/bin'
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/etc'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/etc'
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/docs'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/docs'
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/po'
for cat in cs.po es.po ru.po uk.po; do \
        lang=`basename $cat .po`; \
        if msgmerge -v $lang.po yum.pot > $lang.pot ; then \
                mv -f $lang.pot $lang.po ; \
                echo "msgmerge -v of $lang succeeded" ; \
        else \
                echo "msgmerge -v of $lang failed" ; \
                rm -f $lang.pot ; \
        fi \
done
....................
Read 1 old + 1 reference, merged 194, fuzzied 0, missing 0, obsolete 0.
msgmerge -v of cs succeeded
....................
Read 1 old + 1 reference, merged 194, fuzzied 0, missing 0, obsolete 0.
msgmerge -v of es succeeded
....................
Read 1 old + 1 reference, merged 194, fuzzied 0, missing 0, obsolete 11.
msgmerge -v of ru succeeded
....................
Read 1 old + 1 reference, merged 194, fuzzied 0, missing 0, obsolete 0.
msgmerge -v of uk succeeded
msgfmt --statistics --verbose -o ru.mo ru.po
170 translated messages, 12 fuzzy translations, 11 untranslated messages.
msgfmt --statistics --verbose -o uk.mo uk.po
193 translated messages.
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/po'
./mkinstalldirs /var/tmp/yum-2.0.8root/usr/bin /var/tmp/yum-2.0.8root/etc /var/tmp/yum-2.0.8root/usr/share/yum /var/tmp/yum-2.0.8root/usr/share/man/man8 /var/tmp/yum-2.0.8root/usr/share/man/man5 /var/tmp/yum-2.0.8root/var/cache/yum/
mkdir /var/tmp/yum-2.0.8root
mkdir /var/tmp/yum-2.0.8root/usr
mkdir /var/tmp/yum-2.0.8root/usr/bin
mkdir /var/tmp/yum-2.0.8root/etc
mkdir /var/tmp/yum-2.0.8root/usr/share
mkdir /var/tmp/yum-2.0.8root/usr/share/yum
mkdir /var/tmp/yum-2.0.8root/usr/share/man
mkdir /var/tmp/yum-2.0.8root/usr/share/man/man8
mkdir /var/tmp/yum-2.0.8root/usr/share/man/man5
mkdir /var/tmp/yum-2.0.8root/var
mkdir /var/tmp/yum-2.0.8root/var/cache
mkdir /var/tmp/yum-2.0.8root/var/cache/yum
for module in ./pullheaders.py ./config.py ./nevral.py ./logger.py ./yumlock.py ./yummain.py ./i18n.py ./pkgaction.py ./serverStuff.py ./archwork.py ./callback.py ./clientStuff.py ./iutil.py ./lilocfg.py ./lilo.py ./grubcfg.py ./checkbootloader.py ./bootloadercfg.py ./up2datetheft.py ./keepalive.py ./urlgrabber.py ./progress_meter.py ./yumcomps.py ./failover.py ./comps.py ./rpmUtils.py  ; do \
  /usr/bin/install -c -m 644 ./$module /var/tmp/yum-2.0.8root/usr/share/yum ; \
done
for subdir in bin etc docs po ; do \
  make -C $subdir install ; \
done
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/bin'
make -C .. installdirs
make[2]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8'
./mkinstalldirs /var/tmp/yum-2.0.8root/usr/bin /var/tmp/yum-2.0.8root/etc /var/tmp/yum-2.0.8root/usr/share/yum /var/tmp/yum-2.0.8root/usr/share/man/man8 /var/tmp/yum-2.0.8root/usr/share/man/man5 /var/tmp/yum-2.0.8root/var/cache/yum/
make[2]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8'
/usr/bin/install -c -m 755 ../bin/yum-arch /var/tmp/yum-2.0.8root/usr/bin/yum-arch
/usr/bin/install -c -m 755 ../bin/yum /var/tmp/yum-2.0.8root/usr/bin/yum
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/bin'
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/etc'
make -C .. installdirs
make[2]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8'
./mkinstalldirs /var/tmp/yum-2.0.8root/usr/bin /var/tmp/yum-2.0.8root/etc /var/tmp/yum-2.0.8root/usr/share/yum /var/tmp/yum-2.0.8root/usr/share/man/man8 /var/tmp/yum-2.0.8root/usr/share/man/man5 /var/tmp/yum-2.0.8root/var/cache/yum/
make[2]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8'
../mkinstalldirs /var/tmp/yum-2.0.8root/etc/{cron.daily,init.d,logrotate.d}
mkdir /var/tmp/yum-2.0.8root/etc/cron.daily
mkdir /var/tmp/yum-2.0.8root/etc/init.d
mkdir /var/tmp/yum-2.0.8root/etc/logrotate.d
/usr/bin/install -c -m 644 ../etc/yum.conf /var/tmp/yum-2.0.8root/etc/yum.conf
/usr/bin/install -c ../etc/yum.cron /var/tmp/yum-2.0.8root/etc/cron.daily/yum.cron
/usr/bin/install -c ../etc/yum.init /var/tmp/yum-2.0.8root/etc/init.d/yum
/usr/bin/install -c -m 644 ../etc/yum.logrotate /var/tmp/yum-2.0.8root/etc/logrotate.d/yum
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/etc'
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/docs'
make -C .. installdirs
make[2]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8'
./mkinstalldirs /var/tmp/yum-2.0.8root/usr/bin /var/tmp/yum-2.0.8root/etc /var/tmp/yum-2.0.8root/usr/share/yum /var/tmp/yum-2.0.8root/usr/share/man/man8 /var/tmp/yum-2.0.8root/usr/share/man/man5 /var/tmp/yum-2.0.8root/var/cache/yum/
make[2]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8'
/usr/bin/install -c -m 644 ../docs/yum.8 /var/tmp/yum-2.0.8root/usr/share/man/man8/yum.8
/usr/bin/install -c -m 644 ../docs/yum-arch.8 /var/tmp/yum-2.0.8root/usr/share/man/man8/yum-arch.8
/usr/bin/install -c -m 644 ../docs/yum.conf.5 /var/tmp/yum-2.0.8root/usr/share/man/man5/yum.conf.5
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/docs'
make[1]: Entering directory `/usr/src/redhat/BUILD/yum-2.0.8/po'
`cs.mo' -> `/var/tmp/yum-2.0.8root/usr/share/locale/cs/LC_MESSAGES/yum.mo'
`es.mo' -> `/var/tmp/yum-2.0.8root/usr/share/locale/es/LC_MESSAGES/yum.mo'
`ru.mo' -> `/var/tmp/yum-2.0.8root/usr/share/locale/ru/LC_MESSAGES/yum.mo'
`uk.mo' -> `/var/tmp/yum-2.0.8root/usr/share/locale/uk/LC_MESSAGES/yum.mo'
make[1]: Leaving directory `/usr/src/redhat/BUILD/yum-2.0.8/po'
+ /usr/lib/rpm/redhat/find-lang.sh /var/tmp/yum-2.0.8root yum
+ /usr/lib/rpm/find-debuginfo.sh /usr/src/redhat/BUILD/yum-2.0.8
0 blocks
find: /var/tmp/yum-2.0.8root/usr/lib/debug: No such file or directory
+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
Processing files: yum-2.0.8-1
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.14568
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd yum-2.0.8
+ DOCDIR=/var/tmp/yum-2.0.8root/usr/share/doc/yum-2.0.8
+ export DOCDIR
+ rm -rf /var/tmp/yum-2.0.8root/usr/share/doc/yum-2.0.8
+ /bin/mkdir -p /var/tmp/yum-2.0.8root/usr/share/doc/yum-2.0.8
+ cp -pr README AUTHORS COPYING TODO INSTALL ChangeLog /var/tmp/yum-2.0.8root/usr/share/doc/yum-2.0.8
+ exit 0
Provides: config(yum) = 2.0.8-1
Requires(interp): /bin/sh /bin/sh
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires(post): /bin/sh
Requires(preun): /bin/sh
Requires: /bin/bash /bin/sh /usr/bin/python config(yum) = 2.0.8-1 libxml2-python python rpm >= 0:4.1.1 rpm-python
Obsoletes: yum-phoebe
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/yum-2.0.8root
Wrote: /usr/src/redhat/RPMS/noarch/yum-2.0.8-1.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.61722
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd yum-2.0.8
+ '[' /var/tmp/yum-2.0.8root '!=' / ']'
+ rm -rf /var/tmp/yum-2.0.8root
+ exit 0
Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.61722
+ umask 022
+ cd /usr/src/redhat/BUILD
+ rm -rf yum-2.0.8
+ exit 0


 

[root@orange3c opt]# cd /usr/src/redhat/RPMS/noarch/
[root@orange3c noarch]# ll
total 136
-rw-r--r--  1 root root 134368 Jul 20 13:58 yum-2.0.8-1.noarch.rpm

[root@orange3c noarch]# rpm -ivh yum-2.0.8-1.noarch.rpm 
Preparing...                ########################################### [100%]
   1:yum                    ########################################### [100%]


 

4.配置

[root@orange3c noarch]# vim /etc/yum.conf

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

[base]
name=Red Hat Linux $releasever - $basearch - Base
#baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/
baseurl=http://vault.centos.org/4.7/updates/i386/


[updates]
name=Red Hat Linux $releasever - Updates
#baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/
baseurl=http://vault.centos.org/4.7/updates/i386/

 


 

[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1

[base]
name=Red Hat Linux $releasever - $basearch - Base
#baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/
#baseurl=http://vault.centos.org/4.7/updates/i386/
#baseurl=http://centos.ustc.edu.cn/centos/4.8/updates/i386/
baseurl=http://mirrors.163.com/centos/4.8/os/i386/


[updates]
name=Red Hat Linux $releasever - Updates
#baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/
#baseurl=http://vault.centos.org/4.7/updates/i386/
baseurl=http://mirrors.163.com/centos/4.8/updates/i386/


[updates]
name=Red Hat Linux $releasever - Updates
baseurl=http://mirror.centos.org/centos/4.8/updates/i386/


你可能感兴趣的:(shell)