Think before you speak, read before you think.

建立一个yum源

by

in

使用的工具是createrepo

首先创建目录,

mkdir -p mirrors.jpuyy.com/centos/6.4/os/x86_64

并进入到此目录,执行

createrepo .

在当前目录下生成了repodata目录,记录了repo的信息。
最终的rpm包都要放到Packages下

目录结构参考http://mirrors.sohu.com。centos6的目录软链接到centos6.4

mirrors.jpuyy.com
└── centos
    ├── 6 -> 6.4
    ├── 6.0
    └── 6.4
        ├── centosplus
        ├── contrib
        ├── cr
        ├── extras
        ├── fasttrack
        ├── isos
        ├── os
        │   └── x86_64
        │       ├── EFI
        │       ├── images
        │       ├── isolinux
        │       ├── Packages
        │       │   ├── MariaDB-5.5.31-centos6-x86_64-client.rpm
        │       │   ├── MariaDB-5.5.31-centos6-x86_64-common.rpm
        │       │   ├── MariaDB-5.5.31-centos6-x86_64-devel.rpm
        │       │   ├── MariaDB-5.5.31-centos6-x86_64-server.rpm
        │       │   ├── MariaDB-5.5.31-centos6-x86_64-shared.rpm
        │       │   └── MariaDB-5.5.31-centos6-x86_64-test.rpm
        │       └── repodata
        │           ├── 0c2ce006b4ccb96b4d0947584daab68e971f25f0c59a2f856895a3dcc4760e0b-primary.xml.gz
        │           ├── 2a827a63089cb7561b755baff2c1ae4c202cd74a1a92e1274e85f9e4dac569a0-other.sqlite.bz2
        │           ├── 3e5e63e57c07f479edc526404f28c63c1ad097670cde380d3866b63090d6f3e0-filelists.xml.gz
        │           ├── 44a30e7cd6fd27e8f820ba7a50d329c99428ea68b4f0904475c5ee8961c1c8ec-primary.sqlite.bz2
        │           ├── b3d59bc4f2a6c3c198798e188b4a0d0af99692efaa88f989c47df4c036fea210-filelists.sqlite.bz2
        │           ├── f94e27df58d67783e29dd0aeca51ff7ffec2bc501e0f82e0a4c7d843dcb2cb6c-other.xml.gz
        │           └── repomd.xml
        ├── updates
        └── xen4

这里的repo使用http提供服务,所以在nginx下,如果要酷一些的页面,可以编译nginx,添加fancyindex模块,http://wiki.nginx.org/NginxNgxFancyIndex

server {
    listen 80;
    server_name mirrors.jpuyy.com;
    location / {
        root /data/mirrors.jpuyy.com/;
        autoindex on;
    }
}

在需要使用此源服务器上,添加/etc/yum.repos.d/jpuyy-mirrors.repo,写入

[mirror-of-jpuyy]
name=mirror-of-jpuyy
baseurl=http://mirrors.jpuyy.com/centos/$releasever/os/$basearch/
enabled=1
gpgcheck=0

 

 


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *