Skip to content

Move yum repositories from Artifactory or Nexus to CloudRepo

The RPMs your team builds move into a hosted yum repository in CloudRepo, and each remote repository becomes a yum proxy. dnf and zypper then install from your organization’s CloudRepo host. Your old server is only read. It keeps running, unchanged, until you repoint your machines.

In Artifactory In Nexus 3 In CloudRepo
Local RPM repository Hosted yum repository A hosted yum repository. You upload your RPMs to it.
Remote RPM repository Proxy yum repository A yum proxy of openSUSE, Rocky Linux, EPEL or PostgreSQL. Nothing to move: it reads the distribution’s repository.
Virtual RPM repository Group yum repository CloudRepo has no yum group. Point each machine at the hosted repository and at each proxy.

One yum proxy reads one repository. A Nexus proxy whose URL holds $releasever and $basearch serves every release of a mirror, so make one CloudRepo proxy for each repository your machines read. The other Artifactory and Nexus terms are on Artifactory and Nexus terms in CloudRepo.

CloudRepo signs each hosted repository’s index with your organization’s key, and never your packages: each RPM stays exactly as your build made it, so a package you signed keeps its signature. Your machines trust the new key once, as the setup below shows.

Create a hosted yum repository as Host your own RPMs shows, and a yum proxy for each remote repository as Pull Linux packages shows. You also need a repository token that can write to the hosted repository.

The tool can do steps 2 and 3 for you. cloudrepo-migrate reads each binary RPM from your hosted yum repository, uploads it to your hosted yum repository in CloudRepo, and reads it back to check it. It leaves the old repodata where it is, since CloudRepo builds and signs its own index. yum is off unless you add --include yum, from version 0.13.0: a run without it skips each yum repository and says so. Install the tool and set your credentials as Nexus 3 or Artifactory shows. Name your hosted repository as your old one is named, or map the two with --repo SOURCE=TARGET.

Used on this page only, never saved. Never enter a token or password here.

On Nexus 3, a dry run lists what would move and what it skips, and uploads nothing:

Terminal
cloudrepo-migrate nexus3 \
--nexus-url https://nexus.example.com \
--org your-org \
--include yum \
--dry-run

On Artifactory, the same flag moves a local RPM repository. It is experimental: it is tested against a stand-in for Artifactory’s API, not yet against a real Artifactory server.

Terminal
cloudrepo-migrate artifactory \
--artifactory-url https://artifactory.example.com/artifactory \
--org your-org \
--include yum \
--dry-run

When the list looks right, run the same command without --dry-run and go to step 4. Nexus 2 has no yum move. To move by hand, or from Nexus 2, export each local or hosted RPM repository. A remote, proxy, virtual or group repository has nothing to export.

Only the .rpm files move. Leave the old repodata: CloudRepo builds and signs its own index from the RPMs you upload.

First make a login file that only you can read:

Terminal
install -m 600 /dev/null ~/.cloudrepo.netrc

Save your login in it:

~/.cloudrepo.netrc
machine your-org.mycloudrepo.io login you@example.com password YOUR_REPOSITORY_TOKEN

This line uploads one RPM:

Terminal
curl --netrc-file ~/.cloudrepo.netrc --fail -T acme-agent-1.4.2-1.x86_64.rpm https://your-org.mycloudrepo.io/repositories/your-repo/

To upload every RPM you exported, run the same line for each one. Put your repository’s key or name in place of rpm-local:

Terminal
find export/rpm-local -name '*.rpm' | while IFS= read -r rpm; do
curl --netrc-file ~/.cloudrepo.netrc --fail -T "$rpm" https://your-org.mycloudrepo.io/repositories/your-repo/ || echo "FAILED: $rpm" >&2
done

CloudRepo files each package by its own name, version and architecture, whatever the file is called. A package can be up to 2 GiB. You can run the loop again after a failure: an RPM CloudRepo already holds with the same bytes is answered as already stored, and a different RPM under a name and version it already holds is refused with 409.

Each old address, as Sonatype’s and JFrog’s examples write it, and the address that replaces it:

baseurl in Nexus or Artifactory baseurl on CloudRepo
http://<serveraddress:port>/repository/yum-proxy/$releasever/os/$basearch/ https://your-org.mycloudrepo.io/repositories/your-repo
http://localhost:8081/artifactory/targetCentos/ https://your-org.mycloudrepo.io/repositories/your-repo

The Nexus form is from Sonatype’s yum page and the Artifactory form from JFrog’s RPM page. Put the CloudRepo repository that replaces each old one in place of your-repo.

Then write each machine’s repository file as CloudRepo’s pages show: for the hosted repository, Set up dnf or Set up zypper, which name its signing key; for a proxy, Pull Linux packages with zypper and dnf. Remove the old server’s repository file, or set enabled=0 in it, so the machine reads CloudRepo alone. A build image or a Dockerfile that writes a repository file needs the same change, and Beyond the files lists the other places to look.

On a machine that reads only CloudRepo, install one of your own packages. Put its name in place of acme-agent. With dnf:

Terminal
sudo dnf install -y acme-agent

With zypper:

Terminal
sudo zypper -n install acme-agent

dnf and zypper check the signed index on the way. Leave the old server running until every machine installs this way.

View as Markdown