Pull Linux packages with zypper and dnf
A yum proxy puts a Linux distribution’s repository behind your organization’s CloudRepo host. zypper
(SUSE, openSUSE) and dnf (Rocky, RHEL, Fedora) both read it. zypper reads your token from its credentials
file, and dnf reads it from the repository’s .repo file. Only root can read either file, and the token never
goes in a URL.
Create a yum proxy
Section titled “Create a yum proxy”In the admin portal, create a repository with yum as the Format and Proxy as the Kind. Then pick the host it reads from:
download.opensuse.org: openSUSE Leap, Tumbleweed and the openSUSE Build Servicedl.rockylinux.org: Rocky Linuxdl.fedoraproject.org/pub/epel: EPEL (Extra Packages for Enterprise Linux)download.postgresql.org/pub/repos/yum: PostgreSQL (PGDG) yum repositories
In Repository path, type the folder on that host that holds repodata/, for example
/distribution/leap/15.6/repo/oss. One yum proxy reads one repository. For PostgreSQL 16 on RHEL 9, Rocky
Linux 9 or AlmaLinux 9, the path is /16/redhat/rhel-9-x86_64.
zypper and dnf need a repository token that covers the proxy. Repository Tokens shows how to make one. Use the email address of the account that made the token as the username.
Set up zypper
Section titled “Set up zypper”Save the credentials as root in a file named for the repository. Using one file per repository lets a host store a token for each CloudRepo repository it reads:
username=you@example.compassword=YOUR_REPOSITORY_TOKENThen make the file readable by root alone, and add the repository:
sudo chmod 600 /etc/zypp/credentials.d/cloudrepo-your-reposudo zypper addrepo --refresh 'https://your-org.mycloudrepo.io/repositories/your-repo?credentials=cloudrepo-your-repo' your-reposudo zypper refreshThe credentials=cloudrepo-your-repo part names the file. zypper reads the token from it and keeps it out of the URL. zypper checks the repository signature and every package signature, just as it does for the distribution’s own repositories.
Install a package to check it works. This line installs jq:
sudo zypper -n install jqThe -n flag answers zypper’s prompt for you, so the line also runs in a script.
Set up dnf
Section titled “Set up dnf”Setting up EPEL? Follow Install EPEL packages on Rocky Linux 9 instead. EPEL’s key has to be on the host first.
Save this file as root:
[your-repo]name=your-repo (CloudRepo)baseurl=https://your-org.mycloudrepo.io/repositories/your-repousername=you@example.compassword=YOUR_REPOSITORY_TOKENenabled=1gpgcheck=1Then run sudo chmod 600 /etc/yum.repos.d/your-repo.repo, so only root can read the token.
gpgcheck=1 keeps dnf’s package signature check on. If the distribution’s own .repo file has a
gpgkey= line, copy it here too.
Install a package to check it works. This line installs jq:
sudo dnf install -y jqThe -y flag answers dnf’s prompt for you, so the line also runs in a script.
Install EPEL packages on Rocky Linux 9
Section titled “Install EPEL packages on Rocky Linux 9”EPEL signs its packages with its own key, and a Rocky Linux 9 host does not have that key yet. With only the dnf
steps above, dnf install stops at GPG check FAILED. These five steps add the key through CloudRepo, from Rocky
Linux’s own epel-release package, so the host never has to reach a public mirror.
First, make two yum proxies:
dl.rockylinux.orgwith the path/pub/rocky/9/extras/x86_64/os: Rocky Linux 9’s extras, which carriesepel-release. The steps call itrocky-9-extras. Put your proxy’s name in its place.dl.fedoraproject.org/pub/epelwith the path/9/Everything/x86_64: EPEL 9 itself. The steps call ityour-repo.
On another architecture, put its name in place of x86_64 in both paths. Make one repository token that covers
both proxies. It goes in both files.
Save the extras proxy’s file as root:
[rocky-9-extras]name=rocky-9-extras (CloudRepo)baseurl=https://your-org.mycloudrepo.io/repositories/rocky-9-extrasusername=you@example.compassword=YOUR_REPOSITORY_TOKENenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9Make it readable by root alone with sudo chmod 600 /etc/yum.repos.d/rocky-9-extras.repo. The gpgkey= line
names the key file that comes with Rocky Linux 9.
Add EPEL’s key. epel-release comes from your extras proxy and puts EPEL 9’s key file on the host:
sudo dnf install -y epel-releaseepel-release also adds .repo files that point at public EPEL mirrors. A host that only connects to CloudRepo cannot reach them, so turn them off:
sudo sed -i 's/^enabled=1/enabled=0/' $(rpm -ql epel-release | grep '\.repo$')Now save the EPEL proxy’s file as root:
[your-repo]name=your-repo (CloudRepo)baseurl=https://your-org.mycloudrepo.io/repositories/your-repousername=you@example.compassword=YOUR_REPOSITORY_TOKENenabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9Make it readable by root alone with sudo chmod 600 /etc/yum.repos.d/your-repo.repo. The gpgkey= line names
EPEL 9’s key file, which epel-release put on the host.
Do not name a CloudRepo repository epel, epel-testing or epel-cisco-openh264. epel-release’s files use
those names, so running the sed line again would turn yours off too.
Now install a package from EPEL. This line installs pwgen:
sudo dnf install -y pwgendnf checks pwgen against EPEL’s key and imports the key on this first install. The -y flag answers both
prompts for you.
Keep signature checks on
Section titled “Keep signature checks on”Leave signature checks at your client’s defaults. Do not set gpgcheck=0 or pass --no-gpg-checks.