如何根据指定软件版本制作属于自己的puppet yum源
发布网友
发布时间:2022-04-26 20:47
我来回答
共1个回答
热心网友
时间:2023-10-31 10:43
1、先将对应的光盘创建为本地源
童鞋们在使用puppetlabs yum源安装puppet的时候,会被选则最新版的puppet版本进行安装,而在我们正在的生产环境的时候,并不需要最新版本,而是我们制定的一个版本,然后不同的版本依赖的包也不一样,这样种种的问题应该如何搞定呢,又应该如何制定自己的yum源呢。
以RHEL5.7为例
1、先将对应的光盘创建为本地源
2、安装制作yum仓库的软件包和yum-priorities管理包
[root@agent2 yum.repos.d]# yum install createrepo yum-priorities
[root@agent2 yum.repos.d]# rpm -qa | egrep "createrepo|yum-priorities"
yum-priorities-1.1.16-16.el5
createrepo-0.4.11-3.el5
3、去puppetlabs官网yum.puppetlabs.com下载对应的puppet安装包到本地
[root@agent2 puppet]# wget http://yum.puppetlabs.com/el/57/procts/x86_64/puppet-2.7.25-1.el5.noarch.rpm
[root@agent2 puppet]# wget http://yum.puppetlabs.com/el/57/procts/x86_64/puppet-server-2.7.25-1.el5.noarch.rpm
[root@agent2 puppet]# wget http://yum.puppetlabs.com/el/57/procts/x86_64/facter-1.7.4-1.el5.x86_64.rpm
[root@agent2 puppet]# ll
total 1272
-rw-r--r-- 1 root root 88979 Dec 18 2013 facter-1.7.4-1.el5.x86_64.rpm
-rw-r--r-- 1 root root 1175323 Jan 7 2014 puppet-2.7.25-1.el5.noarch.rpm
-rw-r--r-- 1 root root 25374 Jan 7 2014 puppet-server-2.7.25-1.el5.noarch.rpm
备注:rhel6上没有rubygems rpm包,需要在以下网址去下载http://rubyforge.org/projects/rubygems/
4、本地制作puppet源
[root@agent2 puppet]# createrepo .
3/3 - puppet-2.7.25-1.el5.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@agent2 puppet]# ll
total 1276
-rw-r--r-- 1 root root 88979 Dec 18 2013 facter-1.7.4-1.el5.x86_64.rpm
-rw-r--r-- 1 root root 1175323 Jan 7 2014 puppet-2.7.25-1.el5.noarch.rpm
-rw-r--r-- 1 root root 25374 Jan 7 2014 puppet-server-2.7.25-1.el5.noarch.rpm
drwxr-xr-x 2 root root 4096 Oct 2 10:43 repodata
5、编写puppet的repo文件
[root@agent2 yum.repos.d]# cat puppet.repo
[puppet]
name=puppet for rhel5.7
baseurl=file:///puppet
enabled=1
gpgcheck=0
priority=2 #设置优先级为本地光盘源之后
6、安装官方puppetlabs源
[root@agent2 ~]# wget yum.puppetlabs.com/el/57/procts/x86_64/puppetlabs-release-5-7.noarch.rpm
[root@agent2 ~]# rpm -vih puppetlabs-release-5-7.noarch.rpm
[root@agent2 ~]# ll /etc/yum.repos.d/
total 16
-rw-r--r-- 1 root root 98 Oct 2 10:45 base.repo
-rw-r--r-- 1 root root 1250 Apr 13 06:41 puppetlabs.repo #由官方源安装而成
-rw-r--r-- 1 root root 90 Oct 2 10:44 puppet.repo
-rw-r--r-- 1 root root 67 Oct 2 10:37 redhat.repo
7、修改puppetlabs源优先级
[root@agent2 ~]# cat /etc/yum.repos.d/puppetlabs.repo
[puppetlabs-procts]
name=Puppet Labs Procts El 5 - $basearch
baseurl=http://yum.puppetlabs.com/el/5/procts/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=1
gpgcheck=1
priority=3 #设置优先级最低
[puppetlabs-deps]
name=Puppet Labs Dependencies El 5 - $basearch
baseurl=http://yum.puppetlabs.com/el/5/dependencies/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=1
gpgcheck=1
priority=3 #设置优先级最低
[puppetlabs-devel]
name=Puppet Labs Devel El 5 - $basearch
baseurl=http://yum.puppetlabs.com/el/5/devel/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1
[puppetlabs-procts-source]
name=Puppet Labs Procts El 5 - $basearch - Source
baseurl=http://yum.puppetlabs.com/el/5/procts/SRPMS
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
failovermethod=priority
enabled=0
gpgcheck=1
[puppetlabs-deps-source]
name=Puppet Labs Source Dependencies El 5 - $basearch - Source
baseurl=http://yum.puppetlabs.com/el/5/dependencies/SRPMS
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1
[puppetlabs-devel-source]
name=Puppet Labs Devel El 5 - $basearch - Source
baseurl=http://yum.puppetlabs.com/el/5/devel/SRPMS
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1
8、修改yum保存下载的安装包为本地缓存
[main]
cachedir=/var/cache/yum
keepcache=1 #设置保存下载的软件缓存
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h
# Default.
# installonly_limit = 3
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
9、安装puppet软件
yum会按照制定的优先级去搜索,由于自定义puppet源比官方源优先级高,所以会优先选择自定义的puppet源中的安装包版本
10、复制yum缓存下来的安装包至之前创建的puppet本地源,然后更新repo即可
[root@agent2 ~]# tree /var/cache/yum/puppetlabs-deps/packages/
/var/cache/yum/puppetlabs-deps/packages/
|-- augeas-libs-0.10.0-4.el5.x86_64.rpm
|-- ruby-augeas-0.4.1-2.el5.x86_64.rpm
`-- ruby-shadow-1.4.1-8.el5.x86_64.rpm
0 directories, 3 files
[root@agent2 ~]# createrepo --update /puppet/
6/6 - packages/ruby-augeas-0.4.1-2.el5.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
通过以上操作基本上可以搞定
本文出自 “ kisspuppet.com” 博客
热心网友
时间:2023-10-31 10:43
1、先将对应的光盘创建为本地源
童鞋们在使用puppetlabs yum源安装puppet的时候,会被选则最新版的puppet版本进行安装,而在我们正在的生产环境的时候,并不需要最新版本,而是我们制定的一个版本,然后不同的版本依赖的包也不一样,这样种种的问题应该如何搞定呢,又应该如何制定自己的yum源呢。
以RHEL5.7为例
1、先将对应的光盘创建为本地源
2、安装制作yum仓库的软件包和yum-priorities管理包
[root@agent2 yum.repos.d]# yum install createrepo yum-priorities
[root@agent2 yum.repos.d]# rpm -qa | egrep "createrepo|yum-priorities"
yum-priorities-1.1.16-16.el5
createrepo-0.4.11-3.el5
3、去puppetlabs官网yum.puppetlabs.com下载对应的puppet安装包到本地
[root@agent2 puppet]# wget http://yum.puppetlabs.com/el/57/procts/x86_64/puppet-2.7.25-1.el5.noarch.rpm
[root@agent2 puppet]# wget http://yum.puppetlabs.com/el/57/procts/x86_64/puppet-server-2.7.25-1.el5.noarch.rpm
[root@agent2 puppet]# wget http://yum.puppetlabs.com/el/57/procts/x86_64/facter-1.7.4-1.el5.x86_64.rpm
[root@agent2 puppet]# ll
total 1272
-rw-r--r-- 1 root root 88979 Dec 18 2013 facter-1.7.4-1.el5.x86_64.rpm
-rw-r--r-- 1 root root 1175323 Jan 7 2014 puppet-2.7.25-1.el5.noarch.rpm
-rw-r--r-- 1 root root 25374 Jan 7 2014 puppet-server-2.7.25-1.el5.noarch.rpm
备注:rhel6上没有rubygems rpm包,需要在以下网址去下载http://rubyforge.org/projects/rubygems/
4、本地制作puppet源
[root@agent2 puppet]# createrepo .
3/3 - puppet-2.7.25-1.el5.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@agent2 puppet]# ll
total 1276
-rw-r--r-- 1 root root 88979 Dec 18 2013 facter-1.7.4-1.el5.x86_64.rpm
-rw-r--r-- 1 root root 1175323 Jan 7 2014 puppet-2.7.25-1.el5.noarch.rpm
-rw-r--r-- 1 root root 25374 Jan 7 2014 puppet-server-2.7.25-1.el5.noarch.rpm
drwxr-xr-x 2 root root 4096 Oct 2 10:43 repodata
5、编写puppet的repo文件
[root@agent2 yum.repos.d]# cat puppet.repo
[puppet]
name=puppet for rhel5.7
baseurl=file:///puppet
enabled=1
gpgcheck=0
priority=2 #设置优先级为本地光盘源之后
6、安装官方puppetlabs源
[root@agent2 ~]# wget yum.puppetlabs.com/el/57/procts/x86_64/puppetlabs-release-5-7.noarch.rpm
[root@agent2 ~]# rpm -vih puppetlabs-release-5-7.noarch.rpm
[root@agent2 ~]# ll /etc/yum.repos.d/
total 16
-rw-r--r-- 1 root root 98 Oct 2 10:45 base.repo
-rw-r--r-- 1 root root 1250 Apr 13 06:41 puppetlabs.repo #由官方源安装而成
-rw-r--r-- 1 root root 90 Oct 2 10:44 puppet.repo
-rw-r--r-- 1 root root 67 Oct 2 10:37 redhat.repo
7、修改puppetlabs源优先级
[root@agent2 ~]# cat /etc/yum.repos.d/puppetlabs.repo
[puppetlabs-procts]
name=Puppet Labs Procts El 5 - $basearch
baseurl=http://yum.puppetlabs.com/el/5/procts/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=1
gpgcheck=1
priority=3 #设置优先级最低
[puppetlabs-deps]
name=Puppet Labs Dependencies El 5 - $basearch
baseurl=http://yum.puppetlabs.com/el/5/dependencies/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=1
gpgcheck=1
priority=3 #设置优先级最低
[puppetlabs-devel]
name=Puppet Labs Devel El 5 - $basearch
baseurl=http://yum.puppetlabs.com/el/5/devel/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1
[puppetlabs-procts-source]
name=Puppet Labs Procts El 5 - $basearch - Source
baseurl=http://yum.puppetlabs.com/el/5/procts/SRPMS
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
failovermethod=priority
enabled=0
gpgcheck=1
[puppetlabs-deps-source]
name=Puppet Labs Source Dependencies El 5 - $basearch - Source
baseurl=http://yum.puppetlabs.com/el/5/dependencies/SRPMS
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1
[puppetlabs-devel-source]
name=Puppet Labs Devel El 5 - $basearch - Source
baseurl=http://yum.puppetlabs.com/el/5/devel/SRPMS
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs
enabled=0
gpgcheck=1
8、修改yum保存下载的安装包为本地缓存
[main]
cachedir=/var/cache/yum
keepcache=1 #设置保存下载的软件缓存
debuglevel=2
logfile=/var/log/yum.log
distroverpkg=redhat-release
tolerant=1
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
# Note: yum-RHN-plugin doesn't honor this.
metadata_expire=1h
# Default.
# installonly_limit = 3
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
9、安装puppet软件
yum会按照制定的优先级去搜索,由于自定义puppet源比官方源优先级高,所以会优先选择自定义的puppet源中的安装包版本
10、复制yum缓存下来的安装包至之前创建的puppet本地源,然后更新repo即可
[root@agent2 ~]# tree /var/cache/yum/puppetlabs-deps/packages/
/var/cache/yum/puppetlabs-deps/packages/
|-- augeas-libs-0.10.0-4.el5.x86_64.rpm
|-- ruby-augeas-0.4.1-2.el5.x86_64.rpm
`-- ruby-shadow-1.4.1-8.el5.x86_64.rpm
0 directories, 3 files
[root@agent2 ~]# createrepo --update /puppet/
6/6 - packages/ruby-augeas-0.4.1-2.el5.x86_64.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
通过以上操作基本上可以搞定
本文出自 “ kisspuppet.com” 博客