安装createrepo 和 nginx

1
# yum -y install nginx createrepo

创建目录

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

初始化repodata

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

配置http服务

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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源

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