分类: Python/Ruby
2012-05-04 15:13:52
环境 vmware + centos5.7
目录 /data/Centos/i386/
1、挂载文件
mkdir -p /mnt/soft
mount -o loop -t iso9660 /dev/cdrom /mnt/soft
cd /data/Centos/i386/
2.新建一个自定义的目录,用来放置你的RPM包,并复制一份。
mkdir -p /data/Centos/i386/
cp -rf /mnt/soft/CentOS/ /data/CentOS/i386/
3.将/mnt/soft下的repodata/ 拷贝到/data/Centos/i386/CentOS下
cp -rf /mnt/soft/repodata/ /data/Centos/i386/CentOS/
4.安装rpm -ivh /mnt/soft/CentOS/createrepo-0.4.11-3.el5.noarch.rpm (此包是用来安装服务端设置软件仓库及信息文件)
5.生成客户端所需的信息文件
createrepo -g /mnt/soft/repodata/comps.xml /data/Centos/i386/
6.将key文件(用于客户端与服务端的认证)拷入指定目录/data/Centos/i386 下
cp /mnt/soft/RPM-GPG-KEY-CentOS-5 /data/Centos/i386/
7.更改yum的配置文件,更改之前CentOS-Base.repo要做好备份
vim CentOS-Base.repo
[base]
name=CentOS5.7-base
baseurl=file:///data/Centos/i386/
enable=1
gpgcheck=1
gpgkey=file:///data/Centos/i386/RPM-GPG-KEY-CentOS-5
先执行下yum clean all
验证结果
[root@lx_web_s1 CentOS]# yum install zlib
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package zlib.i386 0:1.2.3-4.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
zlib i386 1.2.3-4.el5 base 51 k
Transaction Summary
================================================================================
Install 0 Package(s)
Update 1 Package(s)
Remove 0 Package(s)
Total download size: 51 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : zlib 1/2
Cleanup : zlib 2/2
Updated:
zlib.i386 0:1.2.3-4.el5
Complete!
这样安装/升级软件比网络源快很多