Simplest Enterprise Continuous Integration Solutions

Saturday, February 25, 2012

Enterprise Linux: Local Yum Repository

Steps to create a Local Yum Repository for Puppetlabs Puppet Open Source on Red Hat 5

# Red Hat 5

[root@linux64-yum-repo-server ~]# uname -a
Linux linux64-yum-repo-server 2.6.18-194.el5 #1 SMP Mon Mar 29 22:10:29 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

# Puppetlabs yum.repo config file

[root@linux64-yum-repo-server ~]# cat /etc/yum.repos.d/puppetlabs.repo
[puppetlabs]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/el/5/products/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
[puppetlabs_dependencies]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/el/5/dependencies/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs

# install Apache httpd

[root@linux64-yum-repo-server ~]# yum install httpd
[root@linux64-yum-repo-server ~]# chkconfig httpd on
[root@linux64-yum-repo-server ~]# /etc/init.d/httpd start
Starting httpd:                                            [  OK  ]

# install yum-utils, createrepo 

[root@linux64-yum-repo-server ~]# yum install yum-utils createrepo

# get a temp copy of puppetlabs, puppetlabs_dependencies RPMS

[root@linux64-yum-repo-server ~]# reposync -r puppetlabs
puppetlabs                                                                                                              
[root@linux64-yum-repo-server yum.repos.d]# reposync -r puppetlabs_dependencies

# create Local Yum Repository folder structure

[root@linux64-yum-repo-server ~]# mkdir -p /var/www/html/puppet/el/5/products/x86_64

# move the temp local copy of RPMs into local yum repository folder

[root@linux64-yum-repo-server ~]# mv /root/puppetlabs/* /var/www/html/puppet/el/5/products/x86_64/ 
[root@linux64-yum-repo-server ~]# mkdir -p /var/www/html/puppet/el/5/dependencies/x86_64/
[root@linux64-yum-repo-server ~]# mv /root/puppetlabs_dependencies/* /var/www/html/puppet/el/5/dependencies/x86_64/

# create Local Yum Repository 

[root@linux64-yum-repo-server ~]# cd /var/www/html/puppet/el/5/products/x86_64/
[root@linux64-yum-repo-server x86_64]# createrepo -u http://linux64-yum-repo-server/puppet/el/5/products/x86_64/ -d .
80/80 - puppetlabs-release-5-1.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@linux64-yum-repo-server ~]# cd /var/www/html/puppet/el/5/dependencies/x86_64/ 
[root@linux64-yum-repo-server x86_64]# createrepo -u http://linux64-yum-repo-server/puppet/el/5/dependencies/x86_64/ -d .
24/24 - rubygem-stomp-doc-1.2.2-1.el5.noarch.rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@linux64-yum-repo-server ~]# ls -al /var/www/html/puppet
total 16
drwxr-xr-x 3 root root 4096 Feb  5 17:09 .
drwxr-xr-x 4 root root 4096 Feb  5 17:02 ..
drwxr-xr-x 3 root root 4096 Feb  5 16:57 el
-rw-r--r-- 1 root root 1711 Feb  5 17:11 RPM-GPG-KEY-puppetlabs

# Local Yum Repository Web



# generate Local Yum Repository associated yum.repo config file 

[root@linux64-yum-repo-server ~]# cat /etc/yum.repos.d/ puppetlabs.repo
[puppetlabs]
name=(local yum repo of) Puppet Labs Packages
baseurl=http://linux64-yum-repo-server/puppet/el/5/products/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://linux64-yum-repo-server/puppet/RPM-GPG-KEY-puppetlabs
[puppetlabs_dependencies]
name=(local yum repo of) Puppet Labs Packages
baseurl=http://linux64-yum-repo-server/puppet/el/5/dependencies/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://linux64-yum-repo-server/puppet/RPM-GPG-KEY-puppetlabs

# get Yum Repository List

[root@linux64-yum-repo-server ~]# yum repolist
Loaded plugins: security
repo id                                     repo name                                                                              status
el5_u5_base                                 Enterprise Linux 5 Update 5 installation media copy (x86_64)                           enabled: 4,372
puppetlabs                                  (local yum repo of) Puppet Labs Packages                                               enabled:    80
puppetlabs_dependencies                     (local yum repo of) Puppet Labs Packages                                               enabled:    24
repolist: 13,726

No comments:

Post a Comment