# Pull Linux packages with zypper and dnf

> Create a yum proxy in CloudRepo, then point zypper or dnf at it with a root-only credentials file. Signature checks stay on.

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.

> **Early access:** yum proxy repositories are in early access.
>
> A yum repository is a proxy for now.

## Create a yum proxy

In the [admin portal](https://admin.cloudrepo.io), 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 Service
- `dl.rockylinux.org`: Rocky Linux
- `dl.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](/docs/authenticate/repository-tokens.html) shows how to make one. Use the email address of the account that made the token as the username.

## 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:

`/etc/zypp/credentials.d/cloudrepo-your-repo`

```ini
username=you@example.com
password=YOUR_REPOSITORY_TOKEN
```

Then make the file readable by root alone, and add the repository:

**Terminal**

```bash
sudo chmod 600 /etc/zypp/credentials.d/cloudrepo-your-repo
sudo zypper addrepo --refresh 'https://your-org.mycloudrepo.io/repositories/your-repo?credentials=cloudrepo-your-repo' your-repo
sudo zypper refresh
```

The `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`:

**Terminal**

```bash
sudo zypper -n install jq
```

The `-n` flag answers zypper’s prompt for you, so the line also runs in a script.

## Set up dnf

Setting up EPEL? Follow [Install EPEL packages on Rocky Linux 9](#install-epel-packages-on-rocky-linux-9) instead. EPEL’s key has to be on the host first.

Save this file as root:

`/etc/yum.repos.d/your-repo.repo`

```ini
[your-repo]
name=your-repo (CloudRepo)
baseurl=https://your-org.mycloudrepo.io/repositories/your-repo
username=you@example.com
password=YOUR_REPOSITORY_TOKEN
enabled=1
gpgcheck=1
```

Then 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`:

**Terminal**

```bash
sudo dnf install -y jq
```

The `-y` flag answers dnf’s prompt for you, so the line also runs in a script.

## 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.org` with the path `/pub/rocky/9/extras/x86_64/os`: Rocky Linux 9’s extras, which carries `epel-release`. The steps call it `rocky-9-extras`. Put your proxy’s name in its place.
- `dl.fedoraproject.org/pub/epel` with the path `/9/Everything/x86_64`: EPEL 9 itself. The steps call it `your-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:

`/etc/yum.repos.d/rocky-9-extras.repo`

```ini
[rocky-9-extras]
name=rocky-9-extras (CloudRepo)
baseurl=https://your-org.mycloudrepo.io/repositories/rocky-9-extras
username=you@example.com
password=YOUR_REPOSITORY_TOKEN
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-Rocky-9
```

Make 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:

**Terminal**

```bash
sudo dnf install -y epel-release
```

`epel-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:

**Terminal**

```bash
sudo sed -i 's/^enabled=1/enabled=0/' $(rpm -ql epel-release | grep '\.repo$')
```

Now save the EPEL proxy’s file as root:

`/etc/yum.repos.d/your-repo.repo`

```ini
[your-repo]
name=your-repo (CloudRepo)
baseurl=https://your-org.mycloudrepo.io/repositories/your-repo
username=you@example.com
password=YOUR_REPOSITORY_TOKEN
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-9
```

Make 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`:

**Terminal**

```bash
sudo dnf install -y pwgen
```

dnf 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

Leave signature checks at your client’s defaults. Do not set `gpgcheck=0` or pass `--no-gpg-checks`.

---

The page: https://www.cloudrepo.io/docs/consume/yum.html
