目錄 /data/Centos/i386/html
一、掛載文件
mkdir -p /mnt/soft
mount -o loop -t iso9660 /dev/cdrom /mnt/soft
cd /data/Centos/i386/linux
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 (此包是用來安裝服務端設置軟件倉庫及信息文件)web
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/vim
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 Resolutionide
Dependencies Resolvedoop
================================================================================
Package Arch Version Repository Size
================================================================================
Updating:
zlib i386 1.2.3-4.el5 base 51 kthis
Transaction Summary
================================================================================
Install 0 Package(s)
Update 1 Package(s)
Remove 0 Package(s) url
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/2debug
Updated:
zlib.i386 0:1.2.3-4.el5
Complete! 這樣安裝/升級軟件比網絡源快不少。