Linux 配置YUM
2014年11月12日
9:23
首先检测 createrepo包是否安装
[root@ora11g ~]# rpm -q createrepo
package createrepo is not installed
发现没有安装 执行以下操作 安装 createrepo 包
[root@ora11g Server]# pwd
/yum/Server
[root@ora11g Server]# rpm -ivh createrepo*
warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing... ########################################### [100%]
1:createrepo ########################################### [100%]
Ok 安装成功!!!
[root@ora11g Server]# rpm -q createrepo
createrepo-0.4.11-3.el5
4) 创建yum repository 的xml-rpm-metadata
[root@localhost Server]# cd /media/Server
[root@ora11g Server]# createrepo -g /yum/Server/repodata/comps-rhel5-server-core.xml /yum/Server/
3285/3285 - cups-devel-1.3.7-30.el5.x86_64.rpm rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@ora11g Server]# createrepo -g /yum/VT/repodata/comps-rhel5-vt.xml /yum/VT
58/58 - kvm-83-249.el5.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@ora11g Server]# createrepo -g /yum/Cluster/repodata/comps-rhel5-cluster.xml /yum/Cluster
32/32 - Cluster_Administration-gu-IN-5.8-1.el5.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@ora11g Server]# createrepo -g /yum/VT/repodata/comps-rhel5-vt.xml /yum/ClusterStorage
39/39 - kmod-cmirror-xen-0.1.22-3.el5.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
创建本地yum客户端的repo文件, 以使用本地的yum repository
[root@ora11g Server]# vi /etc/yum.repos.d/yum.repo
[base]
name=Server
baseurl=file:///yum/Server
enabled=1
gpgcheck=0
[VT]
name=VT
baseurl=file:///yum/VT
enabled=1
gpgcheck=0
[Cluster]
name=Cluster
baseurl=file:///yum/Cluster
enabled=1
gpgcheck=0
[CS]
name=ClusterStorage
baseurl=file:///yum/ClusterStorage
enabled=1
gpgcheck=0
注意: 如果本地目录下有其他以.repo 结尾的配置文件,请先将其设置成enabled=0以免引起冲突。
6)测试使用本地的yum 包 安装 软件
[root@ora11g Server]# yum install vsftpd
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
CS | 1.1 kB 00:00
CS/primary | 8.7 kB 00:00
CS 39/39
Cluster | 1.1 kB 00:00
Cluster/primary | 6.0 kB 00:00
Cluster 32/32
VT | 1.1 kB 00:00
VT/primary | 19 kB 00:00
VT 58/58
base | 1.1 kB 00:00
base/primary | 1.1 MB 00:00
base 3285/3285
Setting up Install Process
Package vsftpd-2.0.5-24.el5.x86_64 already installed and latest version
Nothing to do
可以正常使用