Este conteúdo não está disponível no idioma selecionado.

Chapter 13. Changing proxy settings


RHUI can use a proxy server to sync Red Hat content through. If no proxy server is specified while installing RHUI, none is used. Otherwise, this proxy server is used with all RHUI repositories that you add. This chapter describes how the proxy server configuration can be changed.

13.1. Configuring a new proxy server or unconfiguring an existing proxy server

Follow these steps if you wish to:

  • start using a proxy server in a RHUI environment that was installed with no proxy server configuration
  • edit the current proxy server configuration, for example, if the server hostname has changed
  • stop using the proxy server that a RHUI environment was installed with

Procedure

There are two ways to configure (or unconfigure) proxy server settings.

  • First option: Rerun the installer to update the global RHUI tools configuration and answers file:

    rhui-installer --rerun --proxy-protocol <PROTOCOL> \
                           --proxy-hostname <HOSTNAME> \
                           --proxy-port <PORT> \
                           --proxy-username <USERNAME> \
                           --proxy-password <PASSWORD>
    Copy to Clipboard Toggle word wrap
  • Second option: Create (or edit) the local overrides file, /root/.rhui/rhui-tools-custom.conf, so that it contains:

    [proxy]
    proxy_protocol: <PROTOCOL>
    proxy_host: <HOSTNAME>
    proxy_port: <PORT>
    proxy_user: <USERNAME>
    proxy_pass: <PASSWORD>
    Copy to Clipboard Toggle word wrap
    Note

    This option was introduced in RHUI 4.11.

    In either case, the parameters are as follows:

    • PROTOCOL is either http or https if configuring the proxy server; if unconfiguring it:

      • if rerunning the installer, do not use the --proxy-protocol argument
      • if using the local file, leave the value empty
    • HOSTNAME is the new proxy server hostname; if clearing the configuration:

      • if rerunning the installer, use an empty string in double quotes ("")
      • if using the local file, leave the value empty
    • PORT is the TCP port where the proxy server is listening, typically 3128; if clearing the configuration:

      • if rerunning the installer, do not use the --proxy-port argument
      • if using the local file, leave the value empty
    • USERNAME is an optional parameter. Only use it if the proxy server requires credentials. If it does not or you are clearing the configuration:

      • if rerunning the installer, use ""
      • if using the local file, leave the value empty or do not use the proxy_user: option at all
    • PASSWORD ditto.

      Examples:

    • Start using a proxy server, and this server requires no credentials.

      • With the installer:

        rhui-installer --rerun --proxy-protocol http --proxy-hostname squid.example.com --proxy-port 3128
        Copy to Clipboard Toggle word wrap
      • With the local file:

        [proxy]
        proxy_host: squid.example.com
        proxy_protocol: http
        proxy_port: 3128
        Copy to Clipboard Toggle word wrap
    • Change the proxy server hostname, everything else remains the same.

      • With the installer:

        rhui-installer --rerun --proxy-hostname newsquid.example.com
        Copy to Clipboard Toggle word wrap
      • With the local file:

        [proxy]
        proxy_host: newsquid.example.com
        Copy to Clipboard Toggle word wrap
    • Stop using the proxy server.

      • With the installer:

        rhui-installer --rerun --proxy-hostname ""
        Copy to Clipboard Toggle word wrap
      • With the local file:

        [proxy]
        proxy_protocol:
        proxy_host:
        proxy_port:
        Copy to Clipboard Toggle word wrap
        Important

        This new configuration will only affect Red Hat repositories added after the configuration is updated. To apply this new configuration to existing repositories, it is necessary to remove, add, and re-synchronize the repositories.

        This will cause an outage that will last from the moment you remove them until you re-sync them. However, already synchronized packages will not have to be re-downloaded from the Red Hat CDN. RHUI will mainly have to parse all the repodata files and determine which package belongs where. This can take up to several hours.

        Although there are technical means outside of rhui-manager whereby the proxy fields can be modified for the existing repositories—or rather, for the so-called remotes—using such means is unsupported.

  • Make sure you have a list (or lists) of your repositories so that you can add them again. If you do not have such a list, you can use rhui-manager to generate a file with all your currently added Red Hat repositories.

    To generate a list of Red Hat repositories, first create a raw list with one ID per line:

    rhui-manager --noninteractive repo list --redhat_only --ids_only > /root/rawlist
    Copy to Clipboard Toggle word wrap
  • Then create a YAML file with repositories. Start by creating a stub:

    echo -e "name: all Red Hat repositories\nrepo_ids:" > /root/repo_list.yml
    Copy to Clipboard Toggle word wrap
  • Next, append the repositories from the raw list as YAML list items:

    sed "s/^/  - /" /root/rawlist >> /root/repo_list.yml
    Copy to Clipboard Toggle word wrap
  • Delete all Red Hat repositories from your RHUI:

    Use the text user interface, or delete them one by one on the command line. For the latter, you can use the raw list created earlier:

    while read repo; do rhui-manager --noninteractive repo delete --repo_id $repo; done < /root/rawlist
    Copy to Clipboard Toggle word wrap
    Note

    Repositories are deleted in asynchronous background tasks: queued and executed by available Pulp workers. It may take tens of minutes, or hours, to actually delete all the repositories. Be patient.

  • When the repositories have been deleted, re-add them. They will be added with the new proxy settings (or with no proxy URL) this time. It is also necessary to re-synchronize the repositories. You can add and re-synchronize them in one step on the command line:

    rhui-manager --noninteractive repo add_by_file --file /root/repo_list.yml --sync_now
    Copy to Clipboard Toggle word wrap

    Alternatively, use your own methods to synchronize the repositories, for example, in a specific order. Lastly, you can also simply wait for the synchronization to start automatically: in six hours, or in any other time defined as repo_sync_frequency in /etc/rhui/rhui-tools.conf.

    Important

    In any case, the repositories will not be available in the meantime.

Verification

The rhui-manager tool does not display information about the proxy server that is used with a repository. However, you can use the pulpcore-manager tool as outlined below:

env PULP_SETTINGS=/etc/pulp/settings.py /usr/bin/pulpcore-manager shell << EOM
from pulpcore.app.models import Remote
rem = Remote.objects.get(name="rhel-8-for-x86_64-baseos-rhui-rpms-8")
print(rem.proxy_url)
EOM
Copy to Clipboard Toggle word wrap

The output should look like this for a configured proxy server:

http://squid.example.com:3128
Copy to Clipboard Toggle word wrap

or None if no proxy server is configured with the specified repository.

Voltar ao topo
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2025 Red Hat