help with using Nexus repo as a Yum repo

3,757 views
Skip to first unread message

Andrew Simpson

unread,
Feb 14, 2017, 3:47:39 PM2/14/17
to Nexus Users
I'm new to nexus.  I have a remote build system that I don't controll.  The Nexus server has been configured to act as a yum repo.  I do not have the ability to run a "real" yum server at the moment without jumping through major hoops.

I want to be able to use Nexus to serve up a large number of RPMS as a yum repo.  However, I'm a little confused on how to actually use this.  I've read the documentation, but it's more geared toward configuring it for YUM, rather than using it.

So, I have a few hundred RPMS for RHEL 6 and 7 that we maintain and deploy, as well as the SRPMS, albeit the SRPMS are less important here.

1.  when looking at the artifact uploader on the website, I have selected to enter GAV parameters.  
Group=RPMS_EL7
Artifact=TestRPM
Version=1

There is an option for Packaging, but none of the options appear to be relevant for me.

2.  Then I add the file(s) for Upload by browsing.
someRPM-0.0.1.el7.rpm

3.  upload is complete and I can browse to the RPM via YUM. great.  However, the RPM is now named TestRPM-1.rpm instead of the name of the "artifact" that I uploaded.

4.  There are a bunch of Maven-metadata.xml files that I don't need/use.


So I have the following questions:
1.  Do I have to set the Artifact and version number to the actual RPM or is there a way to have nexus to be configured to use the uploaded RPM as-is?
2.  Is there a tool available for mass upload of RPMS?  I've looked around but only found a maven script that might/might not work for me.
I'm assuming that using a scripted uploader and curl would work well enough.
Something like:
myuploadScript.sh

FILENAME=myNewRPM-0.0.1.el7.rpm
curl -v -u admin:password --upload-file ${FILENAME} ${DESTINATION}

3.  What packaging format should I be using?
4.  Should I just give up this idea and instead go through the pain of setting up a yum server in a VM, which would require me to setup VPN solutions on ALL of our client machines?

Thanks!

Andrew Simpson

unread,
Feb 14, 2017, 5:23:57 PM2/14/17
to Nexus Users
as a note, using curl to upload the file seems to be a perfect solution, as it just dumps the file in whatever subdirectory I want without modification of the file name

I used:

curl -v -u username:password --upload-file someRPM-0.7.8-1.el7.rpm https://nexusserver.com/nexus/content/repositories/repoanme/RPMS/TEST/2/someRPM-0.7.8-1.el7.rpm

This created the subdirectories the way that I intended them and left the file name alone.  pretty simple really.

Peter Lynch

unread,
Feb 15, 2017, 1:41:35 PM2/15/17
to Andrew Simpson, Nexus Users
On Tue, Feb 14, 2017 at 4:47 PM, Andrew Simpson <simps...@gmail.com> wrote:
I'm new to nexus.  I have a remote build system that I don't controll.  The Nexus server has been configured to act as a yum repo.  I do not have the ability to run a "real" yum server at the moment without jumping through major hoops.

I want to be able to use Nexus to serve up a large number of RPMS as a yum repo.  However, I'm a little confused on how to actually use this.  I've read the documentation, but it's more geared toward configuring it for YUM, rather than using it.

So, I have a few hundred RPMS for RHEL 6 and 7 that we maintain and deploy, as well as the SRPMS, albeit the SRPMS are less important here.

1.  when looking at the artifact uploader on the website, I have selected to enter GAV parameters.  
Group=RPMS_EL7
Artifact=TestRPM
Version=1

There is an option for Packaging, but none of the options appear to be relevant for me.

2.  Then I add the file(s) for Upload by browsing.
someRPM-0.0.1.el7.rpm

3.  upload is complete and I can browse to the RPM via YUM. great.  However, the RPM is now named TestRPM-1.rpm instead of the name of the "artifact" that I uploaded.

This is a side effect of the upload UI. It renames whatever you upload to conform to a Maven 2 repository layout.
 

4.  There are a bunch of Maven-metadata.xml files that I don't need/use.

Again, YUM in Nexus 2.x is implemented on top of a Maven 2 repo format, and maven-metadata.xml are part of that format. This should not affect using the rpms with yum though.
 


So I have the following questions:
1.  Do I have to set the Artifact and version number to the actual RPM or is there a way to have nexus to be configured to use the uploaded RPM as-is?

Yes. But it must match exactly what the metadata inside the RMPM file says.
 
2.  Is there a tool available for mass upload of RPMS?  I've looked around but only found a maven script that might/might not work for me.
I'm assuming that using a scripted uploader and curl would work well enough.
Something like:
myuploadScript.sh

FILENAME=myNewRPM-0.0.1.el7.rpm
curl -v -u admin:password --upload-file ${FILENAME} ${DESTINATION}

 
Sure this works. Just don't expect Nexus UI search to find these RPMs ( since you didn't upload them with Maven 2 metadata and Nexus 2.x UI search works off Maven metadata ).
 
3.  What packaging format should I be using?

packaging is only relevant when the rpm is consumed by Maven builds. It affects what goes in any auto-generated pom.xml ( Maven 2 specific file )

 
4.  Should I just give up this idea and instead go through the pain of setting up a yum server in a VM, which would require me to setup VPN solutions on ALL of our client machines?


Yum in Nexus can work fine if you can live with the above issues.

In Nexus 3, we are working on a new implementation that will not be having similar issues.

 
Thanks!

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users+unsubscribe@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/30bb6588-f722-4d4b-b654-eca9123069fa%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

Andrew Simpson

unread,
Feb 15, 2017, 2:36:06 PM2/15/17
to Nexus Users, simps...@gmail.com
Hi Peter. 

Thanks for the information!  I have been tinkering with this all day and believe I can accomplish what I want to do within the single nexus repo by uploading everything via scripts (curl) and generating my own repodata files for each "yum repo".  I've tried it a few different ways and it seems to be working well enough!  I'm quite ok with the issues you pointed out.  

I am able to do something as follows:

+NexusRepoRoot/
++el7/
++++RPMS/
++++++rpmX
++++++repodata/
++++SRPMS/
++++++srpmX
++++el6/
++++RPMS/
++++++rpmX
++++++repodata/
++++SRPMS/
++++++srpmX
++someOtherPackages/
++++RPMS/
++++++rpmX
++++++repodata/
++++SRPMS/
++++++srpmX

A few quick tests shows that I can, indeed, use yum to get each rpm.

Thanks again for the feedback!

-Andrew
Thanks!
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
Message has been deleted

Stephen Park

unread,
Oct 4, 2018, 8:30:55 AM10/4/18
to Nexus Users, simps...@gmail.com
Hi Andrew,

I am very new to Nexus and YUM, and was wondering how you were able to download artifacts using YUM. I also have a YUM Nexus Repo and I haven't tried uploading them yet via curl, but I'm assuming they will work since you were able to do it successfully.

Thanks.

Rich Seddon

unread,
Oct 4, 2018, 8:44:37 AM10/4/18
to Nexus Users, simps...@gmail.com
Configuring yum so that it can download and install rpm's from Nexus Repo is covered in the docs here:


Regards,

Rich
Message has been deleted

Carl Park

unread,
Oct 4, 2018, 9:09:21 AM10/4/18
to Nexus Users, simps...@gmail.com
Was just reading this, thanks!

As far as uploading to Nexus goes, is there a good way to set credentials if I upload via curl through a CI server?

Right now, my plan is using Nexus user tokens to set in my CI server and calling those credentials to upload, but I was wondering if there was a more efficient method.


On Thursday, October 4, 2018 at 8:44:37 AM UTC-4, Rich Seddon wrote:

Fabrice Bacchella

unread,
Oct 4, 2018, 10:02:33 AM10/4/18
to Carl Park, Nexus Users, simps...@gmail.com


> Le 4 oct. 2018 à 15:09, Carl Park <shx...@gmail.com> a écrit :
>
> Was just reading this, thanks!
>
> As far as uploading to Nexus goes, is there a good way to set credentials if I upload via curl through a CI server?
>
> Right now, my plan is using Nexus user tokens to set in my CI server and calling those credentials to upload, but I was wondering if there was a more efficient method.


Depends of how you do that and what kind of authentication you do on nexus. I'm protecting nexus using RUT and was able to add a kerberos base SSO setup. And I then wrote a python script to resolve upload.
Reply all
Reply to author
Forward
0 new messages