A quick tutorial to configure proxy for YUM in RHEL, CentOS or Fedora Linux.

1. Enable proxy for yum in configuration file. (global)
If your server is connected to internet via proxy server then you can define it in configuration file located at /etc/yum.conf
. For definition you should have below details ready with you –
- Proxy server IP or hostname
- Port to be used for proxy connectivity
- User ID and password for authenticating you at proxy if enabled on proxy
Now, edit /etc/yum.conf
using any text editor like vi
and edit below parameters :
1 2 3 4 5 | proxy=http://kerneltalksproxy.com:3487 proxy_username=shrikant proxy_password=funWif#92cE |
where –
kerneltalksproxy.com : Proxy server name
3487 : Port
Username for proxy authentication : shrikant
Password for proxy authentiction : funWif#92cE
Save and exit. List repo to verify internet connectivity using yum repolist
.
Using this method you are configuring proxy within YUM configuration which will be used or available for all users on system whenever they use yum commands.
2. Using profile proxy (User specific)
If you dont want global proxy setup through /etc/yum.conf
file then you can opt to define proxy at user level by defining it in user’s individual profile files. Add below config in .profile
( .profile file has different names depends on which login shell you are using) of the user so that it will be loaded every time user logged in to system.
1 2 3 4 | http_proxy="http://shrikant:funWif#92cE@kerneltalksproxy.com:3487" export http_proxy |
If proxy dont need authentication then you can remove username, password portion and configure rest of the part –
1 2 3 4 | http_proxy="http://kerneltalksproxy.com:3487" export http_proxy |
So, this proxy setting will be available for all applications who uses system proxy (like curl, yum) under that user’s login. Ask user to login and verify proxy by refreshing yum repo.
Share Your Comments & Feedback: