Page 1 of 1

How to add a new repository AND its GPG key ?

Posted: 2011/02/14 16:56:32
by pstein
Assume I want to add a new external Repository and its GPG key from terminal (in one cmd).

How do I do that in centOS?

In Ubuntu there is a command:

sudo add-apt-repository ppa:foobar/ppa

What is the corresponding command in CentOS?

How can I view the list of currently known Repositories of the local CentOS installation?

Peter

Re: How to add a new repository AND its GPG key ?

Posted: 2011/02/14 17:18:05
by falcon1620
Ok so here is a question I can answer! :-P

Usually when you want to add repositories you can just enter the command via rpm for example, if you wanted to add the RPM forge Repo, you'd enter this as the command.

[code]rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm[/code]

you can also import GPG keys by using for example...

[code]rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt[/code]

You can also set up software sources in the GUI, by going to Applications >> Add/Remove Software

and then in the Package Manager Window click on Edit >> Repos and manage them from there.

Also be sure to check out the CentOS Wiki, its a really great resource for questions like this and they have done a really nice job with documentation:

[url=http://wiki.centos.org/AdditionalResources/Repositories]http://wiki.centos.org/AdditionalResources/Repositories[/url]


:-D

Re: How to add a new repository AND its GPG key ?

Posted: 2011/02/15 09:07:08
by pstein
Ok, thank you.

So there is no joined statement (like in Ubunut) of add-repository AND add-gpg ?


How do I list all currently locally known repositories?

Peter

How to add a new repository AND its GPG key ?

Posted: 2011/02/15 12:42:01
by markkuk
[quote]
pstein wrote:
So there is no joined statement (like in Ubunut) of add-repository AND add-gpg ?[/quote]
If the repository provides a release RPM package, it normally contains both the repository definition file and the GPG key. Importing the key manually isn't required in that case.

[quote]
pstein wrote:
How do I list all currently locally known repositories?
[/quote]
[code]yum repolist all[/code]

Re: How to add a new repository AND its GPG key ?

Posted: 2011/02/16 07:40:42
by pstein
[quote]
If the repository provides a release RPM package, it normally contains both the repository definition file and the GPG key. Importing the key manually isn't required in that case.
[/quote]

Is it required, that the GPG Key is installed BEFORE the actual Repository?
Or can I do it afterwards as well?

How do I find out if a Repository Release RPM package already contains the GPG key?

How do I list all locally known GPG keys?

Peter

Re: How to add a new repository AND its GPG key ?

Posted: 2011/02/17 06:04:49
by AlanBartlett
[quote]
Is it required, that the GPG Key is installed BEFORE the actual Repository?
[/quote]
No.

[quote]
Or can I do it afterwards as well?
[/quote]
Yes.

[quote]
How do I find out if a Repository Release RPM package already contains the GPG key?
[/quote]
[b]rpm -qpl [i]repository-release[/i].rpm | less[/b]

[quote]
How do I list all locally known GPG keys?
[/quote]
[b]rpm -q gpg-pubkey[/b]

And, then, to answer the question you will probably ask --

[b]for K in $(rpm -q gpg-pubkey); do echo -e "$K\t\c"; rpm -qi $K | grep Sum | cut -c18- ; done[/b]

:-)