首先,下载一个yum库,我这里为了演示用的是局域网的。
[[email protected] yum.repos.d]# wget http://172.16.0.1/centos6.6.repo
[[email protected] yum.repos.d]# yum makecache
1安装lftp
[[email protected] yum.repos.d]# yum -y install lftp
[[email protected] xen]# lftp 172.16.0.1
lftp 172.16.0.1:~> cd /pub/Sources/6.x86_64/xen-4.1/
下载xen.rpm包
lftp 172.16.0.1:/pub/Sources/6.x86_64/xen-4.1> mget *.rpm
146543076 bytes transferred in 20 seconds (7.15M/s)
Total 41 files transferred
lftp 172.16.0.1:/pub/Sources/6.x86_64/xen-4.1>by
[[email protected] xen]# ll
total 143196
-rw-r--r--. 1 root root 29900 Feb 3 20:51 bridge-utils-1.5-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 36412 Feb 3 20:57 bridge-utils-debuginfo-1.5-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 26657636 Feb 3 20:50 kernel-xen-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 19565560 Feb 3 20:57 kernel-xen-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 9406304 Feb 3 20:50 kernel-xen-devel-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 8529216 Feb 3 20:57 kernel-xen-devel-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 33730316 Feb 3 20:50 kernel-xen-firmware-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 1028720 Feb 3 20:57 kernel-xen-firmware-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 908388 Feb 3 20:50 kernel-xen-headers-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 844524 Feb 3 20:57 kernel-xen-headers-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 10056 Feb 3 20:57 kernel-xen-release-6-4.noarch.rpm
-rw-r--r--. 1 root root 1100320 Feb 3 20:49 xen-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 1040052 Feb 3 20:55 xen-4.2.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 1040284 Feb 3 20:55 xen-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 3317700 Feb 3 20:49 xen-debuginfo-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 3228360 Feb 3 20:55 xen-debuginfo-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 172844 Feb 3 20:49 xen-devel-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 178800 Feb 3 20:55 xen-devel-4.2.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 179012 Feb 3 20:55 xen-devel-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 894736 Feb 3 20:49 xen-doc-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 1006460 Feb 3 20:55 xen-doc-4.2.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 1006680 Feb 3 20:55 xen-doc-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 4101312 Feb 3 20:49 xen-hypervisor-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 4526372 Feb 3 20:55 xen-hypervisor-4.2.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 4526488 Feb 3 20:55 xen-hypervisor-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 320672 Feb 3 20:49 xen-libs-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 353704 Feb 3 20:55 xen-libs-4.2.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 353916 Feb 3 20:55 xen-libs-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 68112 Feb 3 20:49 xen-licenses-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 46492 Feb 3 20:55 xen-licenses-4.2.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 46704 Feb 3 20:55 xen-licenses-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 365140 Feb 3 20:49 xen-ocaml-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 266368 Feb 3 20:55 xen-ocaml-4.2.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 266576 Feb 3 20:55 xen-ocaml-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 97024 Feb 3 20:49 xen-ocaml-devel-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 50188 Feb 3 20:55 xen-ocaml-devel-4.2.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 50400 Feb 3 20:55 xen-ocaml-devel-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 5117316 Feb 3 20:49 xen-runtime-4.1.3-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 6022804 Feb 3 20:55 xen-runtime-4.2.1-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 6022988 Feb 3 20:55 xen-runtime-4.2.1-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 28220 Feb 3 20:57 yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
安装createrepo
[[email protected] xen]# yum -y install createrepo
手动createrepo
[[email protected] xen]# createrepo /tmp/xen/
Spawning worker 0 with 41 pkgs
Workers Finished
Gathering worker results
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Sqlite DBs complete
生成repodata文件
[[email protected] xen]# ll
total 143200
-rw-r--r--. 1 root root 29900 Feb 3 20:51 bridge-utils-1.5-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 36412 Feb 3 20:57 bridge-utils-debuginfo-1.5-2.el6.x86_64.rpm
-rw-r--r--. 1 root root 26657636 Feb 3 20:50 kernel-xen-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 19565560 Feb 3 20:57 kernel-xen-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 9406304 Feb 3 20:50 kernel-xen-devel-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 8529216 Feb 3 20:57 kernel-xen-devel-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 33730316 Feb 3 20:50 kernel-xen-firmware-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 1028720 Feb 3 20:57 kernel-xen-firmware-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 908388 Feb 3 20:50 kernel-xen-headers-3.14.31-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 844524 Feb 3 20:57 kernel-xen-headers-3.7.4-1.el6xen.x86_64.rpm
-rw-r--r--. 1 root root 10056 Feb 3 20:57 kernel-xen-release-6-4.noarch.rpm
drwxr-xr-x. 2 root root 4096 Apr 10 23:49 repodata
[[email protected] xen]# cd repodata/
[[email protected] repodata]# ll
total 600
-rw-r--r--. 1 root root 34059 Apr 10 23:49 06a60ef483bbe1ef16ee805dd6aa5c267f377bd96a8665189802ae24c1700f2a-primary.sqlite.bz2
-rw-r--r--. 1 root root 9096 Apr 10 23:49 0ee035862fdfe66191c967548b67c24285b9dcbdcd95c68129e2651b45e9e9fe-other.xml.gz
-rw-r--r--. 1 root root 14984 Apr 10 23:49 380c4ae399723f1473239115e8c931aa966f1778e8a73f3e611a986e4e40072c-other.sqlite.bz2
-rw-r--r--. 1 root root 219934 Apr 10 23:49 a3af28ff67cecac208d866acc111e1a9de8d7ee2d430d70dda2203b5d671a2e0-filelists.xml.gz
-rw-r--r--. 1 root root 12453 Apr 10 23:49 bba66b2e8d46d69646a2232f35214d938b0b1315d946d93ab2248f0612449874-primary.xml.gz
-rw-r--r--. 1 root root 305222 Apr 10 23:49 bd35b0033af44093a54434cfc57865064e4b01b88e033f3865e5a6a4a4ef829e-filelists.sqlite.bz2
-rw-r--r--. 1 root root 2997 Apr 10 23:49 repomd.xml
[[email protected] repodata]#
为了演示效果,我们提前安装vsftpd,并且测试。而后将会禁用此yum源
[[email protected] repodata]# yum -y install vsftpd
[[email protected] repodata]# service vsftpd start
Starting vsftpd for vsftpd: [ OK ]
[[email protected] repodata]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[[email protected] repodata]#
为了减去不必要的麻烦,我们挂载centos6.6并且作为本地yum
[[email protected] repodata]# mount /dev/cdrom /opt/
mount: block device /dev/sr0 is write-protected, mounting read-only
[[email protected] repodata]#
创建本地xen yum源,顺便将其他repo文件改名。
[[email protected] repodata]# vim /etc/yum.repos.d/local-media.repo
[cdrom]
name=Centos6.6 DVD1
baseurl=file:///opt
gpgcheck=0
enabed=1
[base-xen]
name=local-xen.rpm
baseurl=file:///tmp/xen
gpgcheck=0
enabed=1
[[email protected] repodata]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
repo id repo name status
base-xen local-xen.rpm 41
cdrom Centos6.6 DVD1 6,518
repolist: 6,559
[[email protected] repodata]# yum list all xen*
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Available Packages
xen.x86_64 4.2.1-2.el6 base-xen
xen-debuginfo.x86_64 4.2.1-2.el6 base-xen
xen-devel.x86_64 4.2.1-2.el6 base-xen
xen-doc.x86_64 4.2.1-2.el6 base-xen
xen-hypervisor.x86_64 4.2.1-2.el6 base-xen
xen-libs.x86_64 4.2.1-2.el6 base-xen
xen-licenses.x86_64 4.2.1-2.el6 base-xen
xen-ocaml.x86_64 4.2.1-2.el6 base-xen
xen-ocaml-devel.x86_64 4.2.1-2.el6 base-xen
xen-runtime.x86_64 4.2.1-2.el6 base-xen
[[email protected] repodata]#
执行yum -y install xen
[[email protected] repodata]# yum -y install xen
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package xen.x86_64 0:4.2.1-2.el6 will be installed
base-xen/filelists_db | 298 kB 00:00 ...
cdrom/filelists_db | 6.0 MB 00:00 ...
--> Processing Dependency: xen-runtime = 4.2.1-2.el6 for package: xen-4.2.1-2.el6.x86_64
--> Processing Dependency: yajl for package: xen-4.2.1-2.el6.x86_64
--> Processing Dependency: python-lxml for package: xen-4.2.1-2.el6.x86_64
--> Processing Dependency: libxenstore.so.3.0()(64bit) for package: xen-4.2.1-2.el6.x86_64
--> Processing Dependency: libxenguest.so.4.2()(64bit) for package: xen-4.2.1-2.el6.x86_64
--> Processing Dependency: libxenctrl.so.4.2()(64bit) for package: xen-4.2.1-2.el6.x86_64
--> Running transaction check
---> Package python-lxml.x86_64 0:2.2.3-1.1.el6 will be installed
---> Package xen-libs.x86_64 0:4.2.1-2.el6 will be installed
--> Processing Dependency: xen-licenses for package: xen-libs-4.2.1-2.el6.x86_64
---> Package xen-runtime.x86_64 0:4.2.1-2.el6 will be installed
--> Processing Dependency: xen-hypervisor-abi = 4.2 for package: xen-runtime-4.2.1-2.el6.x86_64
--> Processing Dependency: /usr/bin/qemu-img for package: xen-runtime-4.2.1-2.el6.x86_64
--> Processing Dependency: libSDL-1.2.so.0()(64bit) for package: xen-runtime-4.2.1-2.el6.x86_64
---> Package yajl.x86_64 0:1.0.7-3.el6 will be installed
--> Running transaction check
---> Package SDL.x86_64 0:1.2.14-3.el6 will be installed
---> Package qemu-img.x86_64 2:0.12.1.2-2.445.el6 will be installed
--> Processing Dependency: libusbredirparser.so.1()(64bit) for package: 2:qemu-img-0.12.1.2-2.445.el6.x86_64
--> Processing Dependency: libgfxdr.so.0()(64bit) for package: 2:qemu-img-0.12.1.2-2.445.el6.x86_64
--> Processing Dependency: libgfrpc.so.0()(64bit) for package: 2:qemu-img-0.12.1.2-2.445.el6.x86_64
--> Processing Dependency: libgfapi.so.0()(64bit) for package: 2:qemu-img-0.12.1.2-2.445.el6.x86_64
---> Package xen-hypervisor.x86_64 0:4.2.1-2.el6 will be installed
---> Package xen-licenses.x86_64 0:4.2.1-2.el6 will be installed
--> Running transaction check
---> Package glusterfs-api.x86_64 0:3.6.0.28-2.el6 will be installed
--> Processing Dependency: glusterfs = 3.6.0.28-2.el6 for package: glusterfs-api-3.6.0.28-2.el6.x86_64
---> Package glusterfs-libs.x86_64 0:3.6.0.28-2.el6 will be installed
---> Package usbredir.x86_64 0:0.5.1-1.el6 will be installed
--> Running transaction check
---> Package glusterfs.x86_64 0:3.6.0.28-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
xen x86_64 4.2.1-2.el6 base-xen 1.0 M
Installing for dependencies:
SDL x86_64 1.2.14-3.el6 cdrom 193 k
glusterfs x86_64 3.6.0.28-2.el6 cdrom 1.3 M
glusterfs-api x86_64 3.6.0.28-2.el6 cdrom 56 k
glusterfs-libs x86_64 3.6.0.28-2.el6 cdrom 263 k
python-lxml x86_64 2.2.3-1.1.el6 cdrom 2.0 M
qemu-img x86_64 2:0.12.1.2-2.445.el6 cdrom 793 k
usbredir x86_64 0.5.1-1.el6 cdrom 40 k
xen-hypervisor x86_64 4.2.1-2.el6 base-xen 4.3 M
xen-libs x86_64 4.2.1-2.el6 base-xen 346 k
xen-licenses x86_64 4.2.1-2.el6 base-xen 46 k
xen-runtime x86_64 4.2.1-2.el6 base-xen 5.7 M
yajl x86_64 1.0.7-3.el6 cdrom 27 k
Transaction Summary
====================================================================================================================================
Install 13 Package(s)
Total download size: 16 M
Installed size: 58 M
Is this ok [y/N]: y
Downloading Packages:
-----------------------------------------------------------------------------------------------------------------------------------------------------
Total 45 MB/s | 16 MB 00:00
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Public key for glusterfs-3.6.0.28-2.el6.x86_64.rpm is not installed
[[email protected] repodata]#
在这里,我将ftp xen yum的机器地址改为172.16.249.22
下面的测试机IP为172.16.249.251
[[email protected] xen1]# ssh [email protected]
[email protected]‘s password:
Last login: Sat Apr 11 03:14:58 2015 from 172.16.249.22
[[email protected] ~]# mount /dev/cdrom1 /mnt/dvd6.6
[[email protected] ~]# vim /etc/yum.repos.d/172.16.249.22.repo
[basetest]
name=172.16.249.22.file
baseurl=ftp://172.16.249.22/pub/xen1
gpgcheck=0
enabed=1
[dvd6.6]
name=centos6.6
baseurl=file:///mnt/dvd6.6/
gpgcheck=0
enabed=1
[email protected] ~]# yum list all xen*
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
Available Packages
xen.x86_64 4.2.1-2.el6 basetest
xen-debuginfo.x86_64 4.2.1-2.el6 basetest
xen-devel.x86_64 4.2.1-2.el6 basetest
xen-doc.x86_64 4.2.1-2.el6 basetest
xen-hypervisor.x86_64 4.2.1-2.el6 basetest
xen-libs.x86_64 4.2.1-2.el6 basetest
xen-licenses.x86_64 4.2.1-2.el6 basetest
xen-ocaml.x86_64 4.2.1-2.el6 basetest
xen-ocaml-devel.x86_64 4.2.1-2.el6 basetest
xen-runtime.x86_64 4.2.1-2.el6 basetest
[[email protected] ~]#
[[email protected] ~]# yum install xen
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package xen.x86_64 0:4.2.1-2.el6 will be installed
--> Processing Dependency: xen-runtime = 4.2.1-2.el6 for package: xen-4.2.1-2.el6.x86_64
--> Processing Dependency: python-lxml for package: xen-4.2.1-2.el6.x86_64
--> Processing Dependency: libxenstore.so.3.0()(64bit) for package: xen-4.2.1-2.el6.x86_64
--> Processing Dependency: libxenguest.so.4.2()(64bit) for package: xen-4.2.1-2.el6.x86_64
--> Processing Dependency: libxenctrl.so.4.2()(64bit) for package: xen-4.2.1-2.el6.x86_64
--> Running transaction check
---> Package python-lxml.x86_64 0:2.2.3-1.1.el6 will be installed
---> Package xen-libs.x86_64 0:4.2.1-2.el6 will be installed
--> Processing Dependency: xen-licenses for package: xen-libs-4.2.1-2.el6.x86_64
---> Package xen-runtime.x86_64 0:4.2.1-2.el6 will be installed
--> Processing Dependency: xen-hypervisor-abi = 4.2 for package: xen-runtime-4.2.1-2.el6.x86_64
--> Processing Dependency: libSDL-1.2.so.0()(64bit) for package: xen-runtime-4.2.1-2.el6.x86_64
--> Running transaction check
---> Package SDL.x86_64 0:1.2.14-3.el6 will be installed
---> Package xen-hypervisor.x86_64 0:4.2.1-2.el6 will be installed
---> Package xen-licenses.x86_64 0:4.2.1-2.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
=====================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================
Installing:
xen x86_64 4.2.1-2.el6 basetest 1.0 M
Installing for dependencies:
SDL x86_64 1.2.14-3.el6 dvd6.6 193 k
python-lxml x86_64 2.2.3-1.1.el6 dvd6.6 2.0 M
xen-hypervisor x86_64 4.2.1-2.el6 basetest 4.3 M
xen-libs x86_64 4.2.1-2.el6 basetest 346 k
xen-licenses x86_64 4.2.1-2.el6 basetest 46 k
xen-runtime x86_64 4.2.1-2.el6 basetest 5.7 M
Transaction Summary
=====================================================================================================================================================
Install 7 Package(s)
Total download size: 14 M
Installed size: 51 M
Is this ok [y/N]:
vsftpd yum仓库搭建完成!