Enable Proxy Settings For Yum Command on CentOS 7 – RoseHosting

<img src="https://www.rosehosting.com/blog/wp-content/uploads/2018/07/enable-proxy-settings-for-yum-command-on-centos-7-1.jpg" alt=

“enable proxy settings for yum command on centOS 7” />

In this article, we will show you how to enable proxy settings for yum command on CentOS 7. Yum is a package management tool that works with RPM packages. It is available on RedHat Enterprise Linux, CentOS and earlier versions of Fedora, and is the most convenient way to handle operating system packages and their dependencies on these operating systems.

When only one server can be accessed through proxy servers, you must configure yum to use a proxy server so that you can install an RPM package or update currently installed yum packages. Setting up a proxy server so that the system user can access and use yum commands is a fairly easy and straightforward task, and it shouldn’t take more than 5 minutes to set it up. Start.

1. Configure proxy settings Edit the yum

configuration file ‘/etc/yum.conf’ and specify the proxy settings in the main section, for example

:[main] proxy=http://proxysever.yourdomain.com:3128 proxy_username=rhproxy proxy_password=D5znQs4P8Rmtw tolerant=1 errorlevel=1 cachedir=/var/cache/yum/$basearch/$releasever keepcache=0 debuglevel=2 logfile=/var/log/yum.log exactarch=1 obsoletes=1 gpgcheck=1 plugins=1 installonly_limit=5 bugtracker_url=http:// bugs.centos.org/set_

project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum distroverpkg=centos-release # This is the default, if you make this bigger yum you will not see if the # metadata is newer in the remote control and thus you will “gain” the bandwidth of not having to # download the new metadata and “pay” for it for not having the correct # information. # It is especially important to have correct metadata, for distributions like #Fedora that do not maintain old packages. If you don’t like this check # that interrupts the use of your command line, it’s much better to have something # manually check the metadata once an hour (yum-updatesd will do this). # metadata_expire=90m # PUT YOUR REPOSITORIES HERE OR IN separate files named file.repo # in /etc/yum.repos.d

Where:

proxy

  • is the URL of the proxy server (domain name or IP address) that yum should use, including the TCP port number. In this example, proxysever.yourdomain.com is the URL of the proxy server. Don’t forget to change 3128 with the actual port number of the proxy server.
  • proxy_username is the proxy server user name that will be used for the proxy URL. If it is unset, it inherits it from the global setting.
  • proxy_password is the proxy server password that will be used for the proxy URL. If it is unset, it inherits it from the global setting.

Be sure to use a strong password for the proxy password. Use a password that is not the same as any other user password on the system, especially the root user password.

Note that all users must have read access to the /etc/yum.conf file so that they can connect to the proxy server with those details when using yum commands.

2. Enable

proxy access only for a specific system user If for

some reason you want to enable proxy access only for a specific system user, you must add these lines to the user’s

shell profile:http_proxy=”http://proxysever.yourdomain.com:3128″ export http_proxy If the user

is using the default bash shell, the user profile should be set to ~/.bash_profile file. The configuration we use in this example should allow yum to use the proxy server proxysever.yourdomain.com, connecting to port 3128.

If the proxy server requires a user name and password, edit the user’s shell profile and add the user name and password to the proxy server URL:http_proxy=”http://rhproxy:D5znQs4P8Rmtw@proxysever.yourdomain.com:3128″ export http_proxy

Don’t forget to replace rhproxy, D5znQs4P8Rmtw, proxysever.yourdomain.com and 3128 with the actual proxy username, proxy user password, the proxy URL and proxy server port number, respectively.

3. Test

the settings

To check if the proxy settings are configured correctly, run some yum command, for example, try using

: yum clean all && yum search dovecot

The output of this command will show you a list with details of all available packages called

dovecot:# yum search dovecot =================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================== ============================================================================================================================================== dovecot-devel.x86_64 : Development files for dovecot dovecot-mysql.x86_64 : MySQL back-end for dovecot dovecot-pgsql.x86_64 : Postgres SQL back-end for dovecot dovecot-pigeonhole.x86_64 : Sieve and managesieve complement for dovecot dovecot. : Sieve and managesieve complement for dovecot dovecot. : Sieve and managesieve complement for dovecot dovecot. i686 : Secure IMAP and POP3 Server dovecot.x86_64 : Secure imap and POP3 Server Name matches only and summary, use “search all” for everything.

congratulations. You have successfully configured the proxy server for the yum command on CentOS 7.

Of course, you don’t have to enable proxy settings for the yum command on CentOS 7, if you use

one of our managed CentOS VPS hosting solutions, in which case you can simply ask our expert Linux administrators to set up the use of a proxy server so that you can use the yum command for yourself. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to enable proxy settings for yum command on CentOS 7, share it with your friends on social media or just leave a reply below. Thank you.

Contact US