Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've finally gotten around to creating a local mirror, and due to a 'locked' symlink I can now run yum update on all machines and get them to pull the same packages etc so they are all in sync no matter when yum update is run. The problem I am having now is to ensure only the local mirror is used, as yum appears to default to another mirror, even when I use baseurl. Is it possible to lock down the repo config so yum will only pull from specified mirror, even if it's not available?

Example repo conf:

[base]
name=CentOS-$releasever - Base
baseurl=ftp://user:pass@repo.example.com/centos/locked/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[updates]
name=CentOS-$releasever - Updates
baseurl=ftp://user:pass@repo.example.com/centos/locked/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[extras]
name=CentOS-$releasever - Extras
baseurl=ftp://user:pass@repo.example.com/centos/locked/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
share|improve this question
    
is this the only file in /etc/yum/repos.d? –  dawud Aug 4 '13 at 5:52
    
No there are others, for epel, percona, remi. –  Mike Purcell Aug 4 '13 at 16:06

1 Answer 1

up vote 2 down vote accepted

With no extra plugin like rhnplugin, CentOS will look in /etc/yum.conf and by default all repositories are located under /etc/yum/repos.d. If you edit those files, set enabled directive to 0 under all the repositories you want to disable, ei all repositories who are not your local mirror, run a

yum clean all

and then a

yum repolist

it should display only your local repo.

share|improve this answer
    
Thanks, I'll give this a shot. The only repo I have enabled by default is the base centos config. I bet the reason why it's default to another mirror is I didn't clear yum cache like you mentioned. –  Mike Purcell Aug 4 '13 at 16:08
    
Clearing the cache worked. Just wish there was something more verbose I could add to the config file to indicate I do not want to try any other mirrors, other than what I specified. –  Mike Purcell Aug 4 '13 at 23:46
    
I don't know why it would try with any other mirror than those specified in the config file, however, if you want to explicitly check weather your custom mirror is OK before trying I don't know if there is such a thing, but writing a yum plugin for it should be simple enough. –  Petter H Aug 5 '13 at 20:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.