阿里镜像仓库搭建

【阿里镜像仓库搭建】追风赶月莫停留,平芜尽处是春山。这篇文章主要讲述阿里镜像仓库搭建相关的知识,希望能为你提供帮助。
一、仓库服务端配置
安装必要软件

#yum install -y wgetpcre-devel lib \\
zlib-developenssl openssl-devel createrepo yum-utils
#yum -y install nginx

创建索引
#mkdir /opt/yumrepo/centos/7/os/x86_64 -p
#createrepo /opt/yumrepo/centos/7/os/x86_64/

配置nginx
#cat /etc/nginx/conf.d/yum.conf
server
listen8080 default_server;
server_name_;
root/opt/yumrepo/centos/7/os/;
include /etc/nginx/default.d/*.conf;
location /
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
index index.html;


error_page 404 /404.html;
location = /40x.html

error_page 500 502 503 504 /50x.html;
location = /50x.html


设置阿里云镜像为本地yum源
#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

同步base和epel源到自建的yum仓库地址
#reposync -r base -p /opt/yumrepo/centos/7/os/
#reposync -r epel -p /opt/yumrepo/centos/7/os/


同步完成以后,更新仓库索引
#createrepo--update /opt/yumrepo/centos/7/os/base/
#createrepo--update /opt/yumrepo/centos/7/os/epel/



二、客户端测试
配置yum源指向
#cat /etc/yum.repos.d/base.repo
[base]
name=centos-base
baseurl=http://10.2.67.152:8080/base/
enabled=1
gpgcheck=0

[epel]
name=centos-epel
baseurl=http://10.2.67.152:8080/epel/
enabled=1
gpgcheck=0

重新生成缓存
#yum clean all & & yum makecache

客户端测试
#yum repolist


测试可以通过命令列出软件包,表示部署正常。

    推荐阅读