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.
What maps to what
Section titled “What maps to what”| 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.
1. Create your repositories
Section titled “1. Create your repositories”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.
2. Export your RPMs
Section titled “2. Export your RPMs”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.
On Nexus 3, a dry run lists what would move and what it skips, and uploads nothing:
cloudrepo-migrate nexus3 \ --nexus-url https://nexus.example.com \ --org your-org \ --include yum \ --dry-runOn 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.
cloudrepo-migrate artifactory \ --artifactory-url https://artifactory.example.com/artifactory \ --org your-org \ --include yum \ --dry-runWhen 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.
- Artifactory. Run the loop in step 3 of
Migrate from JFrog Artifactory, with
REPOset to the key of your local RPM repository. It saves every file underexport/<repository>/, therepodatafolder Artifactory creates included. - Nexus 3. Run the loop in step 3 of
Migrate from Sonatype Nexus Repository, with
REPOset to the name of your hosted yum repository. It saves every asset the assets API lists underexport/<repository>/. - Nexus 2. List your RPMs with your server’s API, as
Sonatype’s Nexus Repository 2 help shows, and download
each
.rpm.
Only the .rpm files move. Leave the old repodata: CloudRepo builds and signs its own index from the RPMs you
upload.
3. Upload them to CloudRepo
Section titled “3. Upload them to CloudRepo”First make a login file that only you can read:
install -m 600 /dev/null ~/.cloudrepo.netrcSave your login in it:
machine your-org.mycloudrepo.io login you@example.com password YOUR_REPOSITORY_TOKENThis line uploads one RPM:
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:
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" >&2doneCloudRepo 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.
4. Repoint your machines
Section titled “4. Repoint your machines”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.
5. Check the move
Section titled “5. Check the move”On a machine that reads only CloudRepo, install one of your own packages. Put its name in place of acme-agent. With
dnf:
sudo dnf install -y acme-agentWith zypper:
sudo zypper -n install acme-agentdnf and zypper check the signed index on the way. Leave the old server running until every machine installs this way.