如何根據(jù)版本制作屬于自己的puppet yum源
專注于為中小企業(yè)提供網(wǎng)站建設(shè)、成都網(wǎng)站建設(shè)服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)中衛(wèi)免費做網(wǎng)站提供優(yōu)質(zhì)的服務。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了上1000+企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實現(xiàn)規(guī)模擴充和轉(zhuǎn)變。童鞋們在使用puppetlabs yum源安裝puppet的時候,會被選則最新版的puppet版本進行安裝,而在我們正在的生產(chǎn)環(huán)境的時候,并不需要最新版本,而是我們制定的一個版本,然后不同的版本依賴的包也不一樣,這樣種種的問題應該如何搞定呢,又應該如何制定自己的yum源呢。
另一個地址 www.kisspuppet.com
以RHEL5.7為例
童鞋們在使用puppetlabs yum源安裝puppet的時候,會被選則最新版的puppet版本進行安裝,而在我們正在的生產(chǎn)環(huán)境的時候,并不需要最新版本,而是我們制定的一個版本,然后不同的版本依賴的包也不一樣,這樣種種的問題應該如何搞定呢,又應該如何制定自己的yum源呢。 以RHEL5.7為例 1、先將對應的光盤創(chuàng)建為本地源
[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
[root@agent2 puppet]# wget http://yum.puppetlabs.com/el/57/products/x86_64/puppet-2.7.25-1.el5.noarch.rpm [root@agent2 puppet]# wget http://yum.puppetlabs.com/el/57/products/x86_64/puppet-server-2.7.25-1.el5.noarch.rpm [root@agent2 puppet]# wget http://yum.puppetlabs.com/el/57/products/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包,需要在以下網(wǎng)址去下載http://rubyforge.org/projects/rubygems/
[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
[root@agent2 yum.repos.d]# cat puppet.repo [puppet] name=puppet for rhel5.7 baseurl=file:///puppet enabled=1 gpgcheck=0 priority=2 #設(shè)置優(yōu)先級為本地光盤源之后
[root@agent2 ~]# wget yum.puppetlabs.com/el/57/products/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
[root@agent2 ~]# cat /etc/yum.repos.d/puppetlabs.repo [puppetlabs-products] name=Puppet Labs Products El 5 - $basearch baseurl=http://yum.puppetlabs.com/el/5/products/$basearch gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs enabled=1 gpgcheck=1 priority=3 #設(shè)置優(yōu)先級最低 [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 #設(shè)置優(yōu)先級最低 [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-products-source] name=Puppet Labs Products El 5 - $basearch - Source baseurl=http://yum.puppetlabs.com/el/5/products/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
[main] cachedir=/var/cache/yum keepcache=1 #設(shè)置保存下載的軟件緩存 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
yum會按照制定的優(yōu)先級去搜索,由于自定義puppet源比官方源優(yōu)先級高,所以會優(yōu)先選擇自定義的puppet源中的安裝包版本
[root@agent2 ~]# yum clean all Loaded plugins: priorities, product-id, security, subscription-manager Updating Red Hat repositories. Cleaning up Everything [root@agent2 ~]# yum install puppet Loaded plugins: priorities, product-id, security, subscription-manager Updating Red Hat repositories. puppet | 951 B 00:00 puppet/primary | 1.7 kB 00:00 puppet 3/3 puppetlabs-deps | 1.9 kB 00:00 puppetlabs-deps/primary_db | 43 kB 00:00 puppetlabs-products | 1.9 kB 00:00 puppetlabs-products/primary_db | 95 kB 00:03 rhel-base | 1.5 kB 00:00 rhel-base/primary | 913 kB 00:00 rhel-base 3261/3261 157 packages excluded due to repository priority protections Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package puppet.noarch 0:2.7.25-1.el5 set to be updated --> Processing Dependency: facter < 1:2.0 for package: puppet --> Processing Dependency: ruby(abi) >= 1.8 for package: puppet --> Processing Dependency: facter >= 1.5 for package: puppet --> Processing Dependency: ruby >= 1.8.5 for package: puppet --> Processing Dependency: ruby-shadow for package: puppet --> Processing Dependency: /usr/bin/ruby for package: puppet --> Processing Dependency: ruby-augeas for package: puppet --> Processing Dependency: libselinux-ruby for package: puppet --> Running transaction check ---> Package facter.x86_64 1:1.7.4-1.el5 set to be updated ---> Package libselinux-ruby.x86_64 0:1.33.4-5.7.el5 set to be updated ---> Package ruby.x86_64 0:1.8.5-19.el5_6.1 set to be updated ---> Package ruby-augeas.x86_64 0:0.4.1-2.el5 set to be updated --> Processing Dependency: augeas-libs >= 0.8.0 for package: ruby-augeas --> Processing Dependency: libaugeas.so.0(AUGEAS_0.8.0)(64bit) for package: ruby-augeas --> Processing Dependency: libaugeas.so.0(AUGEAS_0.11.0)(64bit) for package: ruby-augeas --> Processing Dependency: libaugeas.so.0(AUGEAS_0.10.0)(64bit) for package: ruby-augeas --> Processing Dependency: libaugeas.so.0(AUGEAS_0.1.0)(64bit) for package: ruby-augeas --> Processing Dependency: libaugeas.so.0(AUGEAS_0.12.0)(64bit) for package: ruby-augeas --> Processing Dependency: libaugeas.so.0()(64bit) for package: ruby-augeas ---> Package ruby-libs.x86_64 0:1.8.5-19.el5_6.1 set to be updated ---> Package ruby-shadow.x86_64 0:1.4.1-8.el5 set to be updated --> Running transaction check ---> Package augeas-libs.x86_64 0:0.10.0-4.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ========================================================================================================================= Package Arch Version Repository Size ========================================================================================================================= Installing: puppet noarch 2.7.25-1.el5 puppet 1.1 M Installing for dependencies: augeas-libs x86_64 0.10.0-4.el5 puppetlabs-deps 376 k facter x86_64 1:1.7.4-1.el5 puppet 87 k libselinux-ruby x86_64 1.33.4-5.7.el5 rhel-base 61 k ruby x86_64 1.8.5-19.el5_6.1 rhel-base 276 k ruby-augeas x86_64 0.4.1-2.el5 puppetlabs-deps 22 k ruby-libs x86_64 1.8.5-19.el5_6.1 rhel-base 1.6 M ruby-shadow x86_64 1.4.1-8.el5 puppetlabs-deps 10 k Transaction Summary ========================================================================================================================= Install 8 Package(s) Upgrade 0 Package(s) Total download size: 3.6 M Is this ok [y/N]: y Downloading Packages: (1/8): ruby-shadow-1.4.1-8.el5.x86_64.rpm | 10 kB 00:00 (2/8): ruby-augeas-0.4.1-2.el5.x86_64.rpm | 22 kB 00:00 (4/8): augeas-libs-0.10.0-4.el5.x86_64.rpm | 376 kB 00:03 ------------------------------------------------------------------------------------------------------------------------- Total 823 kB/s | 3.6 MB 00:04 warning: rpmts_HdrFromFdno: Header V3 RSA/SHA1 signature: NOKEY, key ID 4bd6ec30 puppetlabs-deps/gpgkey | 1.7 kB 00:00 Importing GPG key 0x4BD6EC30 "Puppet Labs Release Key (Puppet Labs Release Key)" from /etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs Is this ok [y/N]: y Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : ruby-libs 1/8 Installing : ruby 2/8 Installing : ruby-shadow 3/8 Installing : augeas-libs 4/8 Installing : ruby-augeas 5/8 Installing : libselinux-ruby 6/8 Installing : facter 7/8 Installing : puppet 8/8 duration: 668(ms) Installed products updated. Installed: puppet.noarch 0:2.7.25-1.el5 Dependency Installed: augeas-libs.x86_64 0:0.10.0-4.el5 facter.x86_64 1:1.7.4-1.el5 libselinux-ruby.x86_64 0:1.33.4-5.7.el5 ruby.x86_64 0:1.8.5-19.el5_6.1 ruby-augeas.x86_64 0:0.4.1-2.el5 ruby-libs.x86_64 0:1.8.5-19.el5_6.1 ruby-shadow.x86_64 0:1.4.1-8.el5 Complete!
[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
通過以上操作基本上可以搞定
創(chuàng)新互聯(lián)www.cdcxhl.cn,專業(yè)提供香港、美國云服務器,動態(tài)BGP最優(yōu)骨干路由自動選擇,持續(xù)穩(wěn)定高效的網(wǎng)絡(luò)助力業(yè)務部署。公司持有工信部辦法的idc、isp許可證, 機房獨有T級流量清洗系統(tǒng)配攻擊溯源,準確進行流量調(diào)度,確保服務器高可用性。佳節(jié)活動現(xiàn)已開啟,新人活動云服務器買多久送多久。