网络yum 的创建
网络访问yum可以基于ftp服务器,http服务器。这里以ftp服务器为例。
1. 光盘挂载
[root@localhost ~]# mkdir /mnt/cdrom
  [root@localhost ~]# mount /dev/cdrom  /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only
2. 安装ftp
[root@localhost ~]# cd  /mnt/cdrom/Server/
[root@localhostServer]# rpm -ivh vsftpd-2.0.5-16.el5.i386.rpm
warning: vsftpd-2.0.5-16.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186
Preparing...                ########################################### [100%]
   1:vsftpd                 ########################################### [100%]
3. 启动ftp服务器
 [root@localhost Server]# service  vsftpd  start                
Starting vsftpd for vsftpd:                                [  OK  ]
[root@localhost Server]# ftp  127.0.0.1
Connected to 127.0.0.1.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (127.0.0.1:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> dir
227 Entering Passive Mode (127,0,0,1,134,181)
150 Here comes the directory listing.
drwxr-xr-x    2 0        0            4096 May 13  2009 pub
226 Directory send OK.
4. 切换到/var/ftp/,随便创建一个目录,比如叫rhel,然后将/mnt/cdrom/的所有东西拷贝到rhel目录下
[root@localhost Server]# cd /var/ftp/
[root@localhost ftp]# ll  
total 4
drwxr-xr-x 2 root root 4096 May 13  2009 pub
[root@localhost ftp]# mkdir  rhel
[root@localhost ftp]# cd  rhel/
[root@localhost rhel]# ll
total 0
[root@localhost rhel]# cp -a -r /mnt/cdrom/*  ./
5. 查看rhel目录的大小
 [root@localhost rhel]# cd ../
[root@localhost ftp]# du -sh rhel/
2.9G rhel/
6.安装createrepo包
    [root@localhost ~]# cd /mnt/cdrom/Server/
[root@localhost Server]# rpm  -q  cre*
package createrepo-0.4.11-3.el5.noarch.rpm is not installed
    [root@localhost Server]# 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%]
6. 如果你是第一次安装yum ,那么到这里就可以直接进行编辑
/etc/yum.repos.d文件,如果server目录下的包动过,那么就需要进行以下操作进行重组
   [root@localhost Server]# cd /var/ftp/rhel/
   [root@localhost rhel]# cd  Server/
   [root@localhostServer]# createrepo -g repodata/comps-rhel5-server-core.xml ./
   [root@localhostVT]# createrepo -g repodata/comps-rhel5-vt.xml  ./
   [root@localhostCluster]# createrepo -g repodata/comps-rhel5-cluster.xml  ./
   [root@localhostClusterStorage]# createrepo -g repodata/comps-rhel5-cluster-st.xml  ./
7. 切换到/etc/yum.repos.d
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# cp  rhel-debuginfo.repo  server1.repo

8编辑server1.repo文件,假设你的ftp是ftp://192.168.101.249
[rhel-server]
name=Red Hat Enterprise Linux server
baseurl=ftp://192.168.101.249/rhel/Server
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.101.249/rhel/RPM-GPG-KEY-redhat-release
[rhel-vt]
name=Red Hat Enterprise Linux vt
baseurl=ftp://192.168.101.249/rhel/VT
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.101.249/rhel/RPM-GPG-KEY-redhat-release
[rhel-cluster]
name=Red Hat Enterprise Linux cluster
baseurl=ftp://192.168.101.249/rhel/Cluster
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.101.249/rhel/RPM-GPG-KEY-redhat-release
[rhel-clustertorage]
name=Red Hat Enterprise Linux clusterstorage
baseurl=ftp://192.168.101.249/rhel/ClusterStorage
enabled=1
gpgcheck=1
gpgkey=ftp://192.168.101.249/rhel/RPM-GPG-KEY-redhat-release

9.最后执行  yum  list  all  即可。