First, the way to build a Yum source
Yum sources generally fall into three categories: local Yum Source (file mode), FTP mode source, and HTTP mode yum source. The difference between the three ways is that the client accesses Yum only
Source in different ways.
Ii. quickly build a local Yum source (2 scripts)
[Email protected] ~]# vim yumresoure.sh
!/bin/bash
Mkdir-p/data/yum/ #创建目录用来备份yum的. Repo file
mv/etc/yum.repos.d/*/data/yum/ #备份yum的. Repo file
rm-rf/etc/yum.repos.d/* #删除原始yum的. Repo file
Echo [Rhel-data] >/etc/yum.repos.d/rhel-source.repo # Yum Source name
Echo name=rhel5 data >>/etc/yum.repos.d/rhel-source.repo
Echo baseurl=file:///media/server >>/etc/yum.repos.d/rhel-source.repo #yum源路径
echo enabled=1 >>/etc/yum.repos.d/rhel-source.repo #启用该yum源
echo gpgcheck=0 >>/etc/yum.repos.d/rhel-source.repo #不启用gpg检测
[Email protected] ~]# vim yum.sh
#!/bin/bash
Umount/dev/cdrom #卸载cdrom
Mount/dev/cdrom/media #将cdrom挂载到/media
[Email protected] ~]# bash yumresoure.sh
[Email protected] ~]# bash yum.sh
Third, testing
[email protected] ~]# Yum List|grep vsftpd
vsftpd.x86_64 2.0.5-28.el5 Rhel-data
Quickly build RHEL5.9 local Yum source