aliyun本地yum仓库搭建新增mirros.repo配置文件

  • mirros.repo文件如下:

[base]
name=CentOS-Base
baseurl=http://192.168.18.105/base/Packages/
enabled=1
gpgcheck=0
 
[epel]
name=CentOS-Epel
baseurl=http://192.168.18.105/epel/Packages/
enabled=1
gpgcheck=0
 
[extras]
name=CentOS-Extras
baseurl=http://192.168.18.105/extras/Packages/
enabled=1
gpgcheck=0

[updates]
name=CentOS-Updates
baseurl=http://192.168.18.105/updates/Packages/
enabled=1
gpgcheck=0

###############################################################################拓展知识:
##yum仓库服务器搭建过程:
#仓库服务器上面的操作:
#root用户安装依赖
#安装web服务及搭建仓库的命令
yum install httpd yum-utils -y
yum install createrepo -y

#默认centos7没有epel仓库,所以提前安装epel库
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo && \
yum clean all && yum makecache


#从阿里云同步到本地rpm包,默认常用的4中类型仓库。
reposync -r base -p /var/www/html
reposync -r extras -p /var/www/html
reposync -r epel -p /var/www/html
reposync -r updates -p /var/www/html

#把下载好的rpm包,生成一个索引目录,为了更快的查找到它。
createrepo -p /var/www/html/base/Packages
createrepo -p /var/www/html/epel/Packages
createrepo -p /var/www/html/extras/Packages
createrepo -p /var/www/html/updates/Packages

#启动httpd服务,关闭默认防火墙
systemctl stop httpd
systemctl disable httpd
systemctl stop firewalld
systemctl disable firewalld
##########################################################

#客户端服务器
#需要使用此本地仓库的,服务器需要更改repo文件
#一般是机房无法上网的服务器使用此类本地仓库,所以删除其他所有repo文件,使用这一个即可!
cd /etc/yum.repos.d/
tar zcvf repos.tar.gz   ./*
rm -f CentOS-*
touch mirros.repo #填写四个仓库的信息
yum clean all && yum makecache

####################################################

####################################################

#自定义安装yum仓库,如k8s的yum源:

#首先下载阿里云的K8SyumY源的rpm包到本地:

for ALrpm in $(curl -s https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/|grep rpm|awk -F '"' '{print $4}'); do  wget  https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/Packages/$ALrpm && echo download! ; done

#创建k8s的yum源索引文件

createrepo -p /var/www/html/k8s/Packages

需要使用的节点服务器,配置yum源:

[k8s]
name=CentOS-K8s
baseurl=http://192.168.18.105/k8s/Packages
enabled=1
gpgcheck=0

yum clean all && yum makecache

##############################################################################类似的方法,还可以设置docker的yum源:

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ChengRuoFei

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值