rhel6 yum源 配置文档

本地源

rhel

vim /etc/yum.repos.d/rhel6.repo

 

  
  
  
  
  1. [base] 
  2.  
  3. name=base 
  4.  
  5. baseurl=file:///mnt/cdrom/ 
  6.  
  7. enabled=1 
  8.  
  9. gpgcheck=1 
  10.  
  11. gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release 

#rhel6.repo 是我新建的文件,/mnt/cdrom/ 为光盘(iso镜象)挂载目录!

 

#接下来就可以安装了,比如gcc !

yum install gcc

 

#其它配置

[base]
name=rhel6-x86_64
baseurl=http://192.168.6.51:8080/pub2/RHEL6/
failovermethod=priority
enabled=1
keepcache=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

centos 与 rhel 不同

  
  
  
  
  1. 把光盘塞进去 
  2. mkdir /media/CentOS 
  3. mount /dev/cdrom  /media/CentOS 
  4.  
  5. yum  --disablerepo=\* --enablerepo=c5-media update 
  6. yum --disablerepo=\* --enablerepo=c5-media install httpd php php-mysql mysql mysql-server mysql-devel openssl-devel dovecot perl-DBD-MySQL tcl tcl-devel libart_lgpl libart_lgpl-devel libtool-ltdl libtool-ltdl-devel expect


 

yum 服务器

  
  
  
  
  1. YUM Client:要有如下软件包: 
  2.  
  3. yum-3.2.19-18.el5.centos 
  4. yum-metadata-parser-1.1.2-2.el5 
  5.  
  6. YUM Server:要有如下软件包: 
  7.  
  8. yum-3.2.19-18.el5.centos 
  9. yum-metadata-parser-1.1.2-2.el5
  10. yum-fastestmirror-1.1.16-13.el5.centos 
  11. yum-updatesd-0.9-2.el5 
  12. createrepo-0.4.11-3.el5 
  13. yum-arch-2.2.2-2.el5.kb.noarch.rpm (此包需要去网站下载例如http://rpm.pbone.net/) 
  14. httpd-2.2.3-22.el5.centos
  15.  
  16. mkdir /mnt/rhel6-x86_64
  17. mount -o loop /root/rhel6-x86_64.iso /mnt/rhel6-x86_64
  18. mkdir /var/www/yum
  19. ln -s /mnt/rhel6-x86_64/* /var/www/yum/
  20. createrepo -g /mnt/rhel6-x86_64/Server/repodata/1a7fc54d30d0d44222742c63069ab0126afef9f160931cc15e564dbe6414f268-comps-rhel6-Server.xml /data/htdocs/8080/rhel6-x86_64/
  21. ....
  22. 20586/20586 - HighAvailability/Packages/zsh-4.3.10-4.1.el6.x86_64.rpm #2万个包,大概 15分钟
  23.  
  24. yum repo文件
  25. cat /etc/yum.repos.d/CentOS.repo
    [base]
    name=rhel6-x86_64
    baseurl=http://192.168.6.51:8080/pub2/RHEL6/
    failovermethod=priority
    enabled=1
    keepcache=1
    gpgcheck=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

注意

不同版本对应不同的 comps.xml文件,如下

rhel

  
  
  
  
  1. createrepo -g /mnt/rhel5.4-x86_64/Server/repodata/comps-rhel5-server-core.xml /data/htdocs/8080/rhel5.4-x86_64/ 
  2. createrepo -g /mnt/rhel6-x86_64/Server/repodata/1a7fc54d30d0d44222742c63069ab0126afef9f160931cc15e564dbe6414f268-comps-rhel6-Server.xml /data/htdocs/8080/rhel6-x86_64/ 

 

centos

  
  
  
  
  1. createrepo -g /mnt/centos5.5-x86_64/repodata/comps.xml /data/htdocs/8080/centos5.5-x86_64/ 

 

yum 客户端

如果你的 linux 是64位 系统,那么你可能需要只安装64 bit rpm 包,设置如下:

  
  
  
  
  1. vim /etc/yum.conf   #添加如下即可 
  2.  
  3. exclude=*.i386 *.i586 *.i686

 

 yum 下载的文件包保存目录为:
/var/cache/yum
也可把 /etc/yum.conf文件中的“keepcache=0”改为“keepcache=1”
这样就不会在安装后自动清除安装文件了

 

结束

 

 

你可能感兴趣的:(linux,yum,源,休闲,RHEL6)