redhat5上使用光盘创建yum源

1, 首先创建目录/var/REHL5
# mkdir -v /var/RHEL5
mkdir: created directory `/var/RHEL5'
2,创建光盘挂载点
#mkdir /media/cdrom
将光盘挂载到/media/cdrom上
#mount /dev/cdrom /media/cdrom
3, 将光盘中的内容拷贝到当创建的目录中
# cp -prf /media/cdrom/* /var/RHEL5/
4, 安装createrepo-0.4.11-3.el5.noarch.rpm包
# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm
warning: createrepo-0.4.11-3.el5.noarch.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]
5, 创建我们所需要的文件
#cd /var/RHEL5/Server
# createrepo -g repodata/comps-rhel5-server-core.xml ./
2292/2292 - kexec-tools-1.102pre-77.el5.i386.rpm                               
Saving Primary metadata
Saving file lists metadata
Saving other metadata
# cd /var/RHEL5/Cluster
# createrepo -g repodata/comps-rhel5-cluster.xml ./
32/32 - Cluster_Administration-pt-BR-5.2-1.noarch.rpm                          
Saving Primary metadata
Saving file lists metadata
Saving other metadata
# cd ../ClusterStorage/
# createrepo -g repodata/comps-rhel5-cluster-st.xml ./
39/39 - Global_File_System-as-IN-5.2-1.noarch.rpm                              
Saving Primary metadata
Saving file lists metadata
 
# cd ../VT/
# createrepo -g repodata/comps-rhel5-vt.xml ./
36/36 - python-virtinst-0.400.3-5.el5.noarch.rpm                               
Saving Primary metadata
Saving file lists metadata
Saving other metadata
6,编辑/etc/yum.repos.d/rhel-debuginfo.repo文件,做一下修改
[Server]
name=Server Local Sources
baseurl=file:///var/RHEL5/Server
enabled=1
gpgcheck=1
gpgkey=file:///var/RHEL5/RPM-GPG-KEY-redhat-release
 
[Cluster]
name=Cluster Local
baseurl=file:///var/RHEL5/Cluster
enabled=1
gpgcheck=1
gpgkey=file:///var/RHEL5/RPM-GPG-KEY-redhat-release
 
[ClusterStorage]
name=CluusterStorage Local
baseurl=file:///var/RHEL5/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=file:///var/RHEL5/RPM-GPG-KEY-redhat-release
 
[VT]
name=VT Local
baseurl=file:///var/RHEL5/VT
enabled=1
gpgcheck=1
gpgkey=file:///var/RHEL5/RPM-GPG-KEY-redhat-release
这里一定要注意路径,还有就是name可以随便,最好能见名知意
7, 到这里我们就创建好了,下面我们试一下
# yum install httpd
Loaded plugins: rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i386 0:2.2.3-31.el5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=================================================================================================
 Package             Arch               Version                       Repository            Size
=================================================================================================
Installing:
 httpd               i386               2.2.3-31.el5                  Server               1.2 M
Transaction Summary
=================================================================================================
Install      1 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        
Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : httpd                                                                     1/1
Installed:
  httpd.i386 0:2.2.3-31.el5                                                                     
Complete!
恩  ok了

你可能感兴趣的:(职场,yum,休闲,redhat5)