Updating your container using Yellowdog Updater, Modified (YUM)

Ops Center Administrator Getting Started Guide

Version
11.0.x
Audience
anonymous
Part Number
MK-99ADM000-20
Complete the following steps to use Yellowdog Updater, Modified (YUM) to update your container:

Verify the following:

  • There are no backup or restore jobs running.
  • There are no Administrator jobs running.
  1. Connect to the container that requires updating:
    podman exec -it container_id bash
  2. Edit the YUM configuration file:
    If you need a proxy server only, without a user, add the following line to the [main] section of the /etc/yum.conf.
    PROXY=http://your.proxy.server:port
    If the proxy requires a user name and password, add the following lines to the yum.conf file.
    proxy_username=yum-user 
    proxy_password=yum-user-password 
    
  3. Save the repository.
    cd /etc/yum.repos.d
    mv hv.repo hv.repo.old
    touch hv.repo
  4. Copy the following contents to /etc/yum.repos.d/oracle-linux-ol7.repo:
    [ol7_latest]
    name=Oracle Linux $releasever Latest ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/latest/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=1
    [ol7_u0_base]
    name=Oracle Linux $releasever GA installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/0/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u1_base]
    name=Oracle Linux $releasever Update 1 installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/1/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u2_base]
    name=Oracle Linux $releasever Update 2 installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/2/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u3_base]
    name=Oracle Linux $releasever Update 3 installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/3/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u4_base]
    name=Oracle Linux $releasever Update 4 installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/4/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u5_base]
    name=Oracle Linux $releasever Update 5 installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/5/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u6_base]
    name=Oracle Linux $releasever Update 6 installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/6/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u7_base]
    name=Oracle Linux $releasever Update 7 installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/7/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u8_base]
    name=Oracle Linux $releasever Update 8 installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/8/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u9_base]
    name=Oracle Linux $releasever Update 9 installation media copy ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/9/base/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_optional_latest]
    name=Oracle Linux $releasever Optional Latest ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/optional/latest/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_addons]
    name=Oracle Linux $releasever Add ons ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/addons/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_MODRHCK]
    name=Latest RHCK with fixes from Oracle for Oracle Linux $releasever ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/MODRHCK/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    priority=20
    enabled=0
    [ol7_leapp]
    name=Leapp Upgrade Utilities for Oracle Linux $releasever ($basearch)
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/leapp/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_latest_archive]
    name=Oracle Linux $releasever Latest ($basearch) - Archive
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/latest/archive/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_optional_archive]
    name=Oracle Linux $releasever Optional ($basearch) - Archive
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/optional/archive/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_security_validation]
    name=Oracle Linux $releasever Update 3 ($basearch) Security Validations
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/security/validation/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
    [ol7_u8_security_validation]
    name=Oracle Linux $releasever Update 8 ($basearch) Security Validations
    baseurl=https://yum$ociregion.$ocidomain/repo/OracleLinux/OL7/8/security/validation/$basearch/
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
    gpgcheck=1
    enabled=0
  5. Perform software updates.
    yum install bind-utils
    Note: If the host name of the yum repository is resolved in IPv6, the container cannot connect to the repository and the yum command may fail. In that case, add the following line to the [main] section of the /etc/yum.conf file:

    ip_resolve=4

  6. Validate the domain.
    nslookup
    [root@hid yum.repos.d]# nslookup example.com
    Server: 172.17.24.20
    Address: 172.17.24.20#53
    
    Non-authoritative answer:
    Name: example.com
    Address: 10.7.42.0
    Name: example.com
    Address: 10.7.7.33
    Note: Each step from 2 to 5 can also be run for all containers at once. If you want to configure it all at once, skip step 1 and run commands from the host by referring to command examples below.

    For step 2

    --For setting the proxy:

    for containerid in $(podman container list -q) ; do podman exec -it ${containerid} bash -c "sed -i -e \"/^\[main\]$/a proxy=https://your.proxy.server:port\" /etc/yum.conf" ; done

    --For setting the proxy user:

    for containerid in $(podman container list -q) ; do podman exec -it ${containerid} bash -c "sed -i -e \"/^\[main\]$/a proxy_username=yum-user\" /etc/yum.conf" ; done

    --For setting the proxy password:

    for containerid in $(podman container list -q) ; do podman exec -it ${containerid} bash -c "sed -i -e \"/^\[main\]$/a proxy_password=yum-user-password\" /etc/yum.conf" ; done

    For step 3

    for containerid in $(podman container list -q) ; do podman exec -it ${containerid} bash -c "mv /etc/yum.repos.d/hv.repo /etc/yum.repos.d/hv.repo.old" ; done

    for containerid in $(podman container list -q) ; do podman exec -it ${containerid} bash -c "touch /etc/yum.repos.d/hv.repo" ; done

    For step 4

    To deploy the .repo file to all containers at once, deploy the same .repo file to the host as oracle-linux-ol7.repo, then navigate to that directory and run the following command from the host as an example.

    for containerid in $(podman container list -q) ; do podman cp ./oracle-linux-ol7.repo ${containerid}:/etc/yum.repos.d/oracle-linux-ol7.repo ; done

    For step 5

    for containerid in $(podman container list -q) ; do podman exec -it ${containerid} bash -c "yum install bind-utils" ; done

    If the host name of the yum repository is resolved in IPv6, the container cannot connect the repository and the yum command may fail. In that case, run the following commands.

    for containerid in $(podman container list -q) ; do podman exec -it ${containerid} bash -c "sed -i -e \"/^\[main\]$/a ip_resolve=4\" /etc/yum.conf" ; done

Your container is updated.