centos制作本地源

1. 列出所有源

复制

# yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
repo id repo name status
base/7/x86_64 CentOS-7 - Base - mirrors.aliyun.com 9,363
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 11,135
extras/7/x86_64 CentOS-7 - Extras - mirrors.aliyun.com 263
openstack-mitaka/7/x86_64 OpenStack Newton Repository 1,675
openstack-newton/7/x86_64 OpenStack Newton Repository 1,486
updates/7/x86_64 CentOS-7 - Updates - mirrors.aliyun.com 807
repolist: 24,729

2. 同步源(以openstack-newton为例)

复制

# yum install yum-utils -y #安装同步工具
# mkdir -p /opt/yum #同步目录
# reposync -d -r openstack-newton -p /opt/yum/ #开始同步,其他参数可以查看help

3. 创建本地源(生成元数据文件)

复制

# yum install createrepo -y #安装工具
# createrepo -v /opt/yum/openstack-newton/

4. 安装http服务,配置本地源

安装apache服务并设置开机自启

复制

# yum install httpd -y
# systemctl enable httpd.service

修改http默认目录

复制

# vim /etc/httpd/conf/httpd.conf

DocumentRoot "/opt/yum"  #修改此处
#
# Relax access to content within /var/www.
#
<Directory "/opt"> #修改此处
AllowOverride None
# Allow open access:
Require all granted

# Further relax access to the default document root:
<Directory "/opt/yum/"> #修改此处

重启httpd

复制

# systemctl restart httpd.service

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

相关文章

扫码关注云+社区

领取腾讯云代金券

年度创作总结 领取年终奖励