Deploying firmware and package updates may pose significant challenges on system administrators (SAs). These challenges can even become cumbersome depending on the size of a network or the number of systems a SA manages. In datacenter environments for instance, the challenges might create a need of having a centralized package distribution system from which updates are either pulled or pushed. Depending upon your needs, this centralized deployment system might be a sophisticated commercial software (developed solely for this purpose) or simply a test server, where all packages are compile and tested, which is also setup to play the role of LPYR. There are numerous advantages of having such a system. However, instead of bugging you with a list of advantages, let me just provide you with a quick run down on how to setup a LPYR. Then, once you have one already deployed, you may evaluate it for yourself and come up with your own list of its benefits.
Here we go again:
1. Verify if ‘createrepo’ is already installed. If it is installed, skip step 2 and continue from step 3. Otherwise, proceed to the next step.
[root@rep-serv ~]# rpm -qi createrepo
2. If ‘createrepo’ isn’t already installed, since it isn’t by default; install it.
[root@rep-serv ~]# yum -y install createrepo
3. Launch your favorite text editor (for me it’s ‘vim’) to create a simple bash script called ‘repo-setup.sh’.
[root@rep-serv ~]# vim repo-setup.sh
4. Copy, paste and save the following bash script into newly created file (repo-setup.sh):
#!/bin/sh -e
mkdir -p /packages/centos/6/{SRPMS,updates,i386,x86_64}
destdir="/packages/centos/6"
for arch in i386 x86_64 updates
do
chown -R root:root ${destdir}/${arch}
chmod -R o-w+r ${destdir}/${arch}
pushd ${destdir}/${arch} >/dev/null 2>&1
createrepo .
popd >/dev/null 2>&1
done
Info: The script creates a directory structure, setups its ownership and permissions as necessary; and creates the repository using ‘createrepo’ command.
5. Once saved, make it executable.
[root@rep-serv ~]# chmod u+x repo-setup.sh
6. Execute ‘repo-setup.sh.
[root@rep-serv ~]# ./repo-setup.sh
Info: Up to this point, basically, you have created the repository: if you do a ‘ls -lart’ of the directory structure ‘/packages/centos/6/*’ created by the script, you shall see the appropriate repository files listed there. Yet, you need to finish the last touches – that is configuring the repository. In this document, I called the repository ‘local’, but you may call yours whatever you prefer. To make this repository available to clients we need to create the following repository file ‘local.repo’ under ‘/etc/yum.repos.d/’.
7. Launch your favorite text editor again (mine is ‘vim’) to create ‘/etc/yum.repos.d/local.repo’, your local repository’s configuration file:
[root@rep-serv ~]# vim /etc/yum.repos.d/local.repo
8. Copy the following, paste into ‘/etc/yum.repos.d/local.repo’ and save the file and exit :
[local] name=CentOS-$releasever - local packages for $basearch baseurl=file:///packages/centos/$releasever/$basearch #baseurl=ftp://internalhost.com/yumrepo/centos/$releasever/$basearch #baseurl=http://internalhost.com/localrepo/centos/$releasever/$basearch enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6-LocalRepo protect=1
Before going further, let me explain some of the keywords above listed in the file:
name: is self explanatory – repository’s name.
baseurl: is the physical location of the repository. In the above file, NFS location is enabled while FTP and HTTP locations are disabled (commented).
enable: basically is self explanatory. When set to 1, it’s on. And when set to 0, it is off.
gpgcheck: enables or disables GPG-Key checking; can be turned either on or off by using (1 or 0).
gpgkey: gives the physical location of the public-ascii-gpg-key file.
protect: is basically something that yum uses to protect a repository from updating from other repositories. In this case it’s turned on, so this repository shall not update its files by downloading newer files from a mirror repository. This brings me to the concept of synchronizing to mirrors, which I am not going to explain further but simply show how it can be done next in case you want this feature.
Synchronize to a mirror of your choice: list of mirror.
9. Following command triggers sync activity of the local repo with usc.edu’s mirrors (it basically gets all the updates from usc.edu mirror).
[root@rep-serv ~]# rsync -avrt rsync://mirrors.usc.edu/centos/6/updates/i386 –exclude=debug/ /packages/centos/6/updates/
In order for the protect feature to work, ‘yum-plugin-protectbase’ or ‘yum-protectbase’ must be installed. Basically for CentOS 4 and 6 you shall install ‘yum-plugin-protectbase’. For CentOS 5, however, you shall install ‘yum-protectbase’. They both do the same thing; the names are different because developers chose to give them different names.
10. Check if ‘protectbase pluin’ is installed:
[root@rep-serv ~]# rpm -qi yum-plugin-protectbase # For CentOS version 4 or 6 [root@rep-serv ~]# rpm -qi yum-protectbase # For CentOS version 5
11. If not installed, install it as following
[root@rep-serv ~]# yum install yum-plugin-protectbase # For CentOS version 4 or 6 [root@rep-serv ~]# yum install yum-protectbase # For CentOS version 5
At this point you’ve successfully setup you yum-repository. Thus, you can go ahead build a sample package, place it in the repository and test installing it any server in your network.
As I already said, your repository is set and ready to roll as far as repository is concerned. However, There are a couple of things that might be helpful to some people and they are: 1) Knowing how to generate GPG key and setup your newly created repository to actually use it. 2) Knowing how to build RPM using source code and spec files. Therefore, in the part 2 of this serie, I will delve with those essential points.
All rights reserved ©




























Great Info.. Going to try this…
I’ll right away take hold of your rss as I can’t to find your email subscription hyperlink or e-newsletter service. Do you’ve any? Please let me recognise so that I could subscribe. Thanks.
Well, I suggest that you sign up for the tuxers newsletter, so that you may recieve an email every time there is a new post…
Pingback: Setting up a Local Private Yum Repository (LPYR) On CentOS – PART2 | Tuxers
What’s up friends, its fantastic article on the topic of educationand completely explained, keep it up all the time.
Pingback: URL
Great worκ! Thіs is the kind of іnfo that аre mеant tо be shared аcгoss
the internet. Disgrаce on Gοogle foг no longeг positіoning this рοst higher!
Cοme on ovеr and dіscuss ωith my webѕite .
Thаnks =)
There are a handful of intriguing points on time in this post but I
dont be acquainted with if I see these center to heart.
There is certainly some validity then again Ill take hold opinion until I look into it further.
Fine post , thanks and that we want a large amount more!
Added onto FeedBurner likewise
Pingback: hello world
It іs in reality a great anԁ helpful pieсе of information.
I’m satisfied that you simply shared this helpful information with us. Please keep us up to date like this. Thanks for sharing.
Good article. I definitely loѵe this wеbsitе.
Keep writing!
Му рartneг and I ѕtumblеd οver hеre different page and thought I might as well
cheсk thіngs оut. I lіke ωhat I ѕee so nоw
i am follοwing уou. Look forwaгd to lookіng at your
web page again.
Greetingѕ! Very useful advice in this particular poѕt!
It’s the little changes which will make the greatest changes. Thanks for sharing!
When somеone writes an piеce of writing he/she
keeps thе thought οf a usеr in
hiѕ/her brain that how а usеr can κnow it.
So that’s why this post is perfect. Thanks!
Hey theгe! I κnοw this iѕ ѕomewhat off topic but I was
wondеring whіch blog platform are yοu using for this website?
I’m getting tired of WordPress because I’vе haԁ issuеѕ with hacκers аnd
I’m looking at options for another platform. I would be awesome if you could point me in the direction of a good platform.
Here is a simple rope that you may old on to and address your need:
http://en.wikipedia.org/wiki/Blog_software
Ηi! Woulԁ you mind if ӏ share
your blоg with my tωitter gгouρ? There’s a lot of folks that I think would really appreciate your content. Please let me know. Many thanks
Feel free to do that! The essential purpose of this blog is to share ideas or knowledge with others, so go ahead.
Heya! I realize this iѕ kind of οff-toρic but I neеdеd to аsκ.
Does managing a well-establіshed blog likе уourѕ
гequire a maѕsiνе amount ωork?
I’m completely new to running a blog but I do write in my journal daily. I’d
like tо start a blοg ѕo I can еasily shaгe
my ρersonal eхperіenсe and views online.
Pleaѕe let me know if you have any κinԁ of suggestions or tips
for new aspiгing blog owners. Thankyou!
Нey! Quіck questіon thаt’s entirely off topic. Do you know how to make your site mobile friendly? My weblog looks weird when viewing from my iphone 4. I’m
tryіng to find a theme or рlugin that might be ablе to гesolve this
issue. If you havе any suggestions, plеase share.
Thank you!
274566 34511Thanks for taking the time to discuss this topic. I truly appreciate it. I
I do not even know how I ended up here, but I thought this рost
Cheers!
wаѕ good. I dоn’t know who you are but certainly you are going to a famous blogger if you are not already
Hі theгe just wanteԁ tο give уou
a quiсk heads up. The words іn уour ροѕt seem to be running off the screen in Ie.
I’m not sure if this is a format issue or something to do with browser compatibility but I figured I’d post tο let you know.
Thе design look gгеat though!
Hoрe you get the prοblem fixеd soοn.
Manу thanks
great submit, very informative. I’m wondering why the other
experts of this sector do not notice this. You must continue your writing.
I am confident, you have a great readers’ base already!
Quаlіty роsts is the key to іnvite the
peoplе to visit the ωebsite, that’s what this web site is providing.
great thanks for the post.. very much needed
I leave a response whenever I like a article on a site or I have something to valuable to contribute to the conversation.
I actually do have
And, if you are writing at other social sites, I would like to follow anything new you have
It is triggered by the passion displayed in the post I read.
And on this article Setting up a Local Private Yum Repository (LPYR) On CentOS – PART1 |.
I was actually excited enough to drop a thought
some questions for you if you tend not to mind. Could it be just me or do some of these
comments look like written by brain dead folks?
to post. Would you list every one of all your social sites like your linkedin profile, Facebook page
or twitter feed?
No problem! I already have the facebook link added, so I am also adding the linkedin…
cheers
sir,
i was using centos 6.3 (86_64).im not getting any graphical interface.will you please help me to
1.yum in centos 6.3 (86_64)
2.installation of gnome desktop
Kapil, if your system is a server, there it’s recommended that you do not desktop at all. Regardless if you’re a newbie to Linux or not, installing desktop on server is not a good idea.
However, if you opt to do it anyway, do as you wish. Supposing that your system is connected to the Internet, all you need to do is launching the one following commands.
$ yum -y groupinstall gnome
or
$ yum -y install gnome-desktop
cheers