首页 > 代码库 > Redhat Linux6.5下搭建本地yum源

Redhat Linux6.5下搭建本地yum源

1. Linux安装盘插入光驱(已连接,启用时连接,使用ISO映像文件)

2. 挂载光驱
[root@localhost ~]# mount /dev/cdrom /mnt/ 
mount: block device /dev/sr0 is write-protected, mounting read-only 
[root@localhost ~]#

3. 安装createrepo软件包 ---> 这是一个解决依赖性的工具
[root@localhost ~]# cd /mnt/Packages/ 
[root@localhost Packages]# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm 
warning: createrepo-0.9.9-17.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY 
error: Failed dependencies: 
python-deltarpm is needed by createrepo-0.9.9-17.el6.noarch 
[root@localhost Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm 
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY 
error: Failed dependencies: 
deltarpm = 3.5-0.5.20090913git.el6 is needed by python-deltarpm-3.5-0.5.20090913git.el6.x86_64

[root@localhost Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:deltarpm               ########################################### [100%]
[root@localhost Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:python-deltarpm        ########################################### [100%]
[root@localhost Packages]# rpm -ivh createrepo-0.9.9-18.el6.noarch.rpm
warning: createrepo-0.9.9-18.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]
4. 拷贝光驱中的rpm包到本系统中,并创建对应的目录
[root@localhost Packages]# mkdir -pv /var/yum

mkdir: created directory `/var/yum/pub‘ 
[root@localhost Packages]# cp -R Packages /var/yum/

二、 开始搭建yum
1. 生成依赖关系

[root@localhost Packages]# createrepo -g  /var/yum/repodata/6221039e7e3dabf7d538c76571d82aaf42b6292b8f6fe6cf56b8fcf1cff3d3ab-comps-rhel6-Server.xml /var/yum/Packages/
Spawning worker 0 with 3763 pkgs
Workers Finished
Gathering worker results

Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
[root@localhost Packages]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]#  ls
packagekit-media.repo  rhel-source.repo
[root@localhost yum.repos.d]# cp rhel-source.repo rhel-source.repo.bak
[root@localhost ~]# cd /etc/yum.repos.d/ 
[root@localhost yum.repos.d]# ls 
rhel-source.repo 
[root@localhost yum.repos.d]# cp rhel-source.repo rhel-source.repo.bak 
[root@localhost yum.repos.d]# vim rhel-source.repo 
[myyum] 
name=RedHat Myyum 
baseurl=file:///var/yum/Packages/
enabled=1 
gpgcheck=1 
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release


[root@localhost yum.repos.d]# yum grouplist
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Group Process
rhel-source                                              | 3.8 kB     00:00 ...
rhel-source-beta                                         | 3.8 kB     00:00 ...
rhel-source-beta/primary_db                              | 3.2 MB     00:00 ...
rhel-source/group_gz                                     | 204 kB     00:00 ...
rhel-source-beta/group_gz                                | 204 kB     00:00 ...
Installed Groups:
   Additional Development
   Base
   Compatibility libraries
   Desktop
   Dial-up Networking Support
   Directory Client
   E-mail server
   Fonts
   General Purpose Desktop
   Graphical Administration Tools
   Hardware monitoring utilities
   Internet Browser
   Legacy UNIX compatibility
   Legacy X Window System compatibility
   Network Infrastructure Server
   Networking Tools
   Performance Tools
   Perl Support
   Print Server
   Printing client
   SNMP Support
   Security Tools
   Web Server
   X Window System
Installed Language Groups:
   Arabic Support [ar]
   Armenian Support [hy]
   Bhutanese Support [dz]
   Chinese Support [zh]
   Ethiopic Support [am]
   Georgian Support [ka]
   Hebrew Support [he]
   Inuktitut Support [iu]
   Japanese Support [ja]
   Khmer Support [km]
   Konkani Support [kok]
   Korean Support [ko]
   Kurdish Support [ku]
   Lao Support [lo]
   Myanmar (Burmese) Support [my]
   Tajik Support [tg]
   Venda Support [ve]
Available Groups:
   Backup Client
   Backup Server
   CIFS file server
   Client management tools
   Console internet tools
   Debugging Tools
   Desktop Debugging and Performance Tools
   Desktop Platform
   Desktop Platform Development
   Development tools
   Directory Server
   Eclipse
   Emacs
   FCoE Storage Client
   FTP server
   Graphics Creation Tools
   Identity Management Server
   Infiniband Support
   Input Methods
   Java Platform
   KDE Desktop
   Large Systems Performance
   Mainframe Access
   Messaging Client Support
   MySQL Database client
   MySQL Database server
   NFS file server
   Network Storage Server
   Network file system client
   PHP Support
   PostgreSQL Database client
   PostgreSQL Database server
   Remote Desktop Clients
   Ruby Support
   Scientific support
   Server Platform
   Server Platform Development
   Smart card support
   Storage Availability Tools
   System Management
   System administration tools
   TeX support
   Technical Writing
   TurboGears application framework
   Virtualization
   Virtualization Client
   Virtualization Platform
   Virtualization Tools
   Web Servlet Engine
   Web-Based Enterprise Management
   iSCSI Storage Client
Available Language Groups:
   Afrikaans Support [af]
   Albanian Support [sq]
   Amazigh Support [ber]
   Assamese Support [as]
   Azerbaijani Support [az]
   Basque Support [eu]
   Belarusian Support [be]
   Bengali Support [bn]
   Brazilian Portuguese Support [pt_BR]
   Breton Support [br]
   Bulgarian Support [bg]
   Catalan Support [ca]
   Chhattisgarhi Support [hne]
   Chichewa Support [ny]
   Coptic Support [cop]
   Croatian Support [hr]
   Czech Support [cs]
   Danish Support [da]
   Dutch Support [nl]
   English (UK) Support [en_GB]
   Esperanto Support [eo]
   Estonian Support [et]
   Faroese Support [fo]
   Fijian Support [fj]
   Filipino Support [fil]
   Finnish Support [fi]
   French Support [fr]
   Frisian Support [fy]
   Friulian Support [fur]
   Gaelic Support [gd]
   Galician Support [gl]
   German Support [de]
   Greek Support [el]
   Gujarati Support [gu]
   Hiligaynon Support [hil]
   Hindi Support [hi]
   Hungarian Support [hu]
   Icelandic Support [is]
   Indonesian Support [id]
   Interlingua Support [ia]
   Irish Support [ga]
   Italian Support [it]
   Kannada Support [kn]
   Kashmiri Support [ks]
   Kashubian Support [csb]
   Kazakh Support [kk]
   Kinyarwanda Support [rw]
   Latin Support [la]
   Latvian Support [lv]
   Lithuanian Support [lt]
   Low Saxon Support [nds]
   Luxembourgish Support [lb]
   Macedonian Support [mk]
   Maithili Support [mai]
   Malagasy Support [mg]
   Malay Support [ms]
   Malayalam Support [ml]
   Maltese Support [mt]
   Manx Support [gv]
   Maori Support [mi]
   Marathi Support [mr]
   Mongolian Support [mn]
   Nepali Support [ne]
   Northern Sotho Support [nso]
   Norwegian Support [nb]
   Occitan Support [oc]
   Oriya Support [or]
   Persian Support [fa]
   Polish Support [pl]
   Portuguese Support [pt]
   Punjabi Support [pa]
   Romanian Support [ro]
   Russian Support [ru]
   Sanskrit Support [sa]
   Sardinian Support [sc]
   Serbian Support [sr]
   Sindhi Support [sd]
   Sinhala Support [si]
   Slovak Support [sk]
   Slovenian Support [sl]
   Somali Support [so]
   Southern Ndebele Support [nr]
   Southern Sotho Support [st]
   Spanish Support [es]
   Swahili Support [sw]
   Swati Support [ss]
   Swedish Support [sv]
   Tagalog Support [tl]
   Tamil Support [ta]
   Telugu Support [te]
   Tetum Support [tet]
   Thai Support [th]
   Tibetan Support [bo]
   Tsonga Support [ts]
   Tswana Support [tn]
   Turkish Support [tr]
   Turkmen Support [tk]
   Ukrainian Support [uk]
   Upper Sorbian Support [hsb]
   Urdu Support [ur]
   Uzbek Support [uz]
   Vietnamese Support [vi]
   Walloon Support [wa]
   Welsh Support [cy]
   Xhosa Support [xh]
   Zulu Support [zu]
Done
需要一定的时间

Redhat Linux6.5下搭建本地yum源