# yum -y install nginx createrepo

创建目录

# mkdir -p /yum/centos/6/{i386,x86_64}

初始化repodata

# createrepo -d /yum/centos/6/x86_64/
        Saving Primary metadata
        Saving file lists metadata
        Saving other metadata
        Generating sqlite DBs
        Sqlite DBs complete

配置http服务

# vi /etc/nginx/conf.d/virtual.conf

        server {
         listen 80;
         server_name node01.guai.im;
         access_log  /var/log/nginx/yum_access.log;
         error_log   /var/log/nginx/yum_error.log;
         location / {
               root /yum;
               autoindex  on;
          }
       }

# service nginx restart
Stopping nginx:                                            [  OK  ]
Starting nginx:                                            [  OK  ]

配置服务器的yum源

[testrepo]
name=test repo
baseurl=http://<servername>/centos/6/$basearch/
gpgcheck=0
enabled=1