1. 挂载光盘
root@instructor ~]# cd /root/
[root@instructor ~]# mkdir DVD
root@instructor ~]# mount -t iso9660 /dev/cdrom2 DVD
2. 安装vsftpd
[root@instructor ~]#cd DVD/Packages
[root@instructor ~]# rpm –ivh vsftpd*
root@instructor ~]#service vsftpd start #启动ftp
3. 建立ftp上的安装目录
[root@instructor ~]# cd /var/ftp/pub
[root@instructor ~]# mkdir rhel6
[root@instructor ~]# cd DVD
[root@instructor ~]# cp -rf * /var/ftp/pub/rhel6
[root@instructor ~]#cd – #返回 /var/ftp/pub
[root@instructor ~]#rm -f *.html #删除*.html
[root@instructor ~]# cd Server/repodata/
[root@instructor repodata]# rm -f TRANS.TBL #删除Server/repodata/TRANS.TBL
[root@instructor repodata]# rm -f /var/ftp/pub/rhel6/HighAvailability/repodata/TRANS.TBL
[root@instructor repodata]# rm -f /var/ftp/pub/rhel6/LoadBalancer/repodata/TRANS.TBL
[root@instructor repodata]# rm -f /var/ftp/pub/rhel6/ResilientStorage/repodata/TRANS.TBL
[root@instructor repodata]# rm -f /var/ftp/pub/rhel6/ScalableFileSystem/repodata/TRANS.TBL
4. 安装createrepo及yum
#安装creatrepo及其依赖包
[root@instructor repodata]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.x86_64.rpm
[root@instructor repodata]# rpm -ivh python-deltarpm-3.5-
0.5.20090913git.el6.x86_64.rpm
[root@instructor repodata]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
#安装yum及其依赖包
[root@instructor repodata]#rpm -ivh python-dateutil-1.4.1-6.el6.noarch.rpm
[root@instructor repodata]#rpm -ivh yum*
5. 生成repodata
[root@instructor repodata]# createrepo -g /var/ftp/pub/rhel6/repodata/repomd.xml
/var/ftp/pub/rhel6/
iso-8859-1 encoding on Ville Skytt?< ville.skytta@iki.fi> - 2.8.2-2
6828/20586 - HighAvailability/Packages/libisofs-0.6.32-1.el6.x86_64.rpm
iso-8859-1 encoding on Ville Skytt?< ville.skytta@iki.fi> - 2.8.2-2
10259/20586 - ResilientStorage/Packages/libisofs-0.6.32-1.el6.x86_64.rpm
iso-8859-1 encoding on Ville Skytt?< ville.skytta@iki.fi> - 2.8.2-2
13690/20586 - Server/Packages/libisofs-0.6.32-1.el6.x86_64.rpm
iso-8859-1 encoding on Ville Skytt?< ville.skytta@iki.fi> - 2.8.2-2
17121/20586 - Packages/libisofs-0.6.32-1.el6.x86_64.rpm
iso-8859-1 encoding on Ville Skytt?< ville.skytta@iki.fi> - 2.8.2-2
20552/20586 - ScalableFileSystem/Packages/libisofs-0.6.32-1.el6.x86_64.rpm
iso-8859-1 encoding on Ville Skytt?< ville.skytta@iki.fi> - 2.8.2-2
20586/20586 - ScalableFileSystem/Packages/libldb-0.9.10-23.el6.i686.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Could not remove old metadata dir: .olddata
Error was [Errno 20] Not a directory: '/var/ftp/pub/rhel6/.olddata'
Please clean up this directory manually.
[root@instructor rhel6]# cd cd
[root@instructor rhel6]# rm -f .olddata
6. 修改repo文件
-----在目录 /etc/yum.repos.d 中
[root@instructor yum.repos.d]# rm -f packagekit-media.repo
[root@instructor yum.repos.d]# vi yum.repo
#以下为yum.repo配置,locallhost ip是 192.168.1.128
[Server]
name=Red Hat Enterprise Linux $releasever - $basearch-Server
#baseurl=ftp://192.168.1.128/pub/rhel6
baseurl=ftp://instructor.example.com/pub/rhel6
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[local-HA]
name=Red Hat Enterprise Linux $releasever - $basearch-HighAvailability
#baseurl=ftp://192.168.1.128/pub/rhel6
baseurl=ftp://instructor.example.com/pub/rhel6
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[local-LB]
name=Red Hat Enterprise Linux $releasever - $basearch-LoadBalancer
#baseurl=ftp://192.168.1.128/pub/rhel6
baseurl=ftp://instructor.example.com/pub/rhel6
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[local-RS]
name=Red Hat Enterprise Linux $releasever - $basearch-ResilientStorage
#baseurl=ftp://192.168.1.128/pub/rhel6
baseurl=ftp://instructor.example.com/pub/rhel6
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[root@instructor yum.repos.d]# yum clean all
Loaded plugins: refresh-packagekit, rhnplugin
Cleaning up Everything
[root@instructor yum.repos.d]# yum update
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Server | 1.9 kB 00:00
Server/primary | 9.4 MB 00:00
Server 20586/20586
local-HA | 1.9 kB 00:00
local-HA/primary | 9.4 MB 00:00
local-HA 20586/20586
local-LB | 1.9 kB 00:00
local-LB/primary | 9.4 MB 00:00
local-LB 20586/20586
local-RS | 1.9 kB 00:00
local-RS/primary | 9.4 MB 00:00
local-RS 20586/20586
Setting up Update Process
No Packages marked for Update
yum update后报错:metadata (repomd.xml) for repository: InstallMedia时
注意以下两点
1. packagekit-media.repo删除
2. [root@instructor yum.repos.d]#cd /usr/lib/python2.6/site-packages/yum
[root@instructor yum.repos.d]# vi yumRepo.py
#在命令模式下输入:remove = 回车
#找到 remote = url + '/' + relative 说明yum源要符合url
#改为 remote = “/var/ftp/pub/rhel6” + '/' + relative 说明yum源符合file格式
7. 测试
[root@instructor yum.repos.d]# yum install binutils
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Package binutils-2.20.51.0.2-5.11.el6.x86_64 already installed and latest version
Nothing to do
[root@instructor yum.repos.d]# yum install compat-lib*
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package compat-libcap1.x86_64 0:1.10-1 set to be updated
---> Package compat-libf2c-34.x86_64 0:3.4.6-19.el6 set to be updated
---> Package compat-libgfortran-41.x86_64 0:4.1.2-39.el6 set to be updated
---> Package compat-libstdc++-296.i686 0:2.96-144.el6 set to be updated
--> Processing Dependency: libc.so.6 for package: compat-libstdc++-296-2.96-144.el6.i686
--> Processing Dependency: libgcc_s.so.1 for package: compat-libstdc++-296-2.96-144.el6.i686
--> Processing Dependency: libc.so.6(GLIBC_2.1) for package: compat-libstdc++-296-2.96-144.el6.i686
--> Processing Dependency: libm.so.6(GLIBC_2.0) for package: compat-libstdc++-296-2.96-144.el6.i686
--> Processing Dependency: libc.so.6(GLIBC_2.12) for package: compat-libstdc++-296-2.96-144.el6.i686
--> Processing Dependency: libc.so.6(GLIBC_2.1.3) for package:
compat-libstdc++-296-2.96-144.el6.i686
--> Processing Dependency: libgcc_s.so.1(GLIBC_2.0) for package: compat-libstdc++-296-2.96-144.el6.i686
--> Processing Dependency: libc.so.6(GLIBC_2.0) for package: compat-libstdc++-296-2.96-144.el6.i686
--> Processing Dependency: libm.so.6 for package: compat-libstdc++-296-2.96-144.el6.i686
---> Package compat-libstdc++-33.x86_64 0:3.2.3-69.el6 set to be updated
---> Package compat-libtermcap.x86_64 0:2.0.8-49.el6 set to be updated
--> Running transaction check
---> Package glibc.i686 0:2.12-1.7.el6 set to be updated
--> Processing Dependency: libfreebl3.so(N×××AWHASH_3.12.3) for package: glibc-2.12-1.7.el6.i686
--> Processing Dependency: libfreebl3.so for package: glibc-2.12-1.7.el6.i686
---> Package libgcc.i686 0:4.4.4-13.el6 set to be updated
--> Running transaction check
---> Package nss-softokn-freebl.i686 0:3.12.7-1.1.el6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=======================================================================================================================
Package Arch Version Repository Size
=======================================================================================================================
Installing:
compat-libcap1 x86_64 1.10-1 Server 17 k
compat-libf2c-34 x86_64 3.4.6-19.el6 Server 51 k
compat-libgfortran-41 x86_64 4.1.2-39.el6 Server 126 k
compat-libstdc++-296 i686 2.96-144.el6 Server 77 k
compat-libstdc++-33 x86_64 3.2.3-69.el6 Server 183 k
compat-libtermcap x86_64 2.0.8-49.el6 Server 16 k
Installing for dependencies:
glibc i686 2.12-1.7.el6 Server 4.3 M
libgcc i686 4.4.4-13.el6 Server 104 k
nss-softokn-freebl i686 3.12.7-1.1.el6 Server 109 k
Transaction Summary
=======================================================================================================================
Install 9 Package(s)
Upgrade 0 Package(s)
Total download size: 4.9 M
Installed size: 15 M
Is this ok [y/N]: y
Downloading Packages:
(1/9): compat-libcap1-1.10-1.x86_64.rpm | 17 kB 00:00
(2/9): compat-libf2c-34-3.4.6-19.el6.x86_64.rpm | 51 kB 00:00
(3/9): compat-libgfortran-41-4.1.2-39.el6.x86_64.rpm | 126 kB 00:00
(4/9): compat-libstdc++-296-2.96-144.el6.i686.rpm | 77 kB 00:00
(5/9): compat-libstdc++-33-3.2.3-69.el6.x86_64.rpm | 183 kB 00:00
(6/9): compat-libtermcap-2.0.8-49.el6.x86_64.rpm | 16 kB 00:00
(7/9): glibc-2.12-1.7.el6.i686.rpm | 4.3 MB 00:00
(8/9): libgcc-4.4.4-13.el6.i686.rpm | 104 kB 00:00
(9/9): nss-softokn-freebl-3.12.7-1.1.el6.i686.rpm | 109 kB 00:00
-----------------------------------------------------------------------------------------------------------------------
Total 7.4 MB/s | 4.9 MB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : libgcc-4.4.4-13.el6.i686 1/9
Installing : nss-softokn-freebl-3.12.7-1.1.el6.i686 2/9
Installing : glibc-2.12-1.7.el6.i686 3/9
Installing : compat-libgfortran-41-4.1.2-39.el6.x86_64 4/9
Installing : compat-libcap1-1.10-1.x86_64 5/9
Installing : compat-libf2c-34-3.4.6-19.el6.x86_64 6/9
Installing : compat-libstdc++-33-3.2.3-69.el6.x86_64 7/9
Installing : compat-libtermcap-2.0.8-49.el6.x86_64 8/9
Installing : compat-libstdc++-296-2.96-144.el6.i686 9/9
Installed:
compat-libcap1.x86_64 0:1.10-1 compat-libf2c-34.x86_64 0:3.4.6-19.el6
compat-libgfortran-41.x86_64 0:4.1.2-39.el6 compat-libstdc++-296.i686 0:2.96-144.el6
compat-libstdc++-33.x86_64 0:3.2.3-69.el6 compat-libtermcap.x86_64 0:2.0.8-49.el6
Dependency Installed:
glibc.i686 0:2.12-1.7.el6 libgcc.i686 0:4.4.4-13.el6 nss-softokn-freebl.i686 0:3.12.7-1.1.el6
Complete!