Fedora
Linux – How to Use dnf Command With A Proxy Server
My Fedora Linux 23 workstation based laptop can only be
accessed through our corporate proxy servers. How do I access and use dnf
command with a web proxy server on a Fedora Linux? How do I configure dnf to
use a proxy server only?
Dnf repositories ("repos") can be accessed through standard proxy servers such as Squid or any other proxy server. You need to configure the proxy server in /etc/dnf/dnf.conffile as follows:
Dnf repositories ("repos") can be accessed through standard proxy servers such as Squid or any other proxy server. You need to configure the proxy server in /etc/dnf/dnf.conffile as follows:
1. proxy=http://URL:PORT/ -
Proxy serer URL to the proxy server that yum should use. You must set a
complete URL, including the TCP port number. If your corporate proxy server
requires a username and password, specify these by adding following two
settings in dnf.conf file.
2. proxy_username=YOUR-PROXY-USERNAME-HERE (optional)-
Your proxy server username to use for the proxy URL.
3. proxy_password=YOUR-SUPER-secrete-PASSWORD-HERE (optional)
- Your proxy server password for this proxy URL.
Configuration:
Using dnf with a proxy server
First, login as root user and type (open the Terminal app if
you are using GUI based Fedora workstation):
# vi /etc/dnf/dnf.conf
OR
$ sudo vi /etc/dnf/dnf.conf
Add/append/edit the following settings in [main] section:
# vi /etc/dnf/dnf.conf
OR
$ sudo vi /etc/dnf/dnf.conf
Add/append/edit the following settings in [main] section:
proxy=http://server1.cyberciti.biz:3128
proxy_username=vivek
proxy_password=secretePasswordHere
Save and close the file. Here is my complete working config
/etc/dnf/dnf.conf file:
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=true
proxy=http://server1.cyberciti.biz:3128
proxy_username=vivek
proxy_password=secretePasswordHere
Please note that defining a proxy server, username, and
password in dnf.conf file meansall users connect to the proxy server with
those details when using dnf command:
# dnf update
# dnf install foo
# dnf update
# dnf install foo
How
do I enable proxy access for a specific user such as root user only?
Linux and UNIX-like system has environment variable called http_proxy. It allows you to connect text based session and
applications via the proxy server. Type the following command at shell prompt:
# export http_proxy="http://server1.cyberciti.biz:3128"
OR
# export http_proxy="http://PROXY=USERNAME=HERE:PROXY=PASSWORD=HERE@URL:PORT"
# export http_proxy="http://vivek:secretePassword@server1.cyberciti.biz:3128"
Feel free to add the above line in the to your shell profile file such as ~/.bash_profile. Seehow to set or export: http_proxy with special characters in password on a Unix or Linux based system for more information.
# export http_proxy="http://server1.cyberciti.biz:3128"
OR
# export http_proxy="http://PROXY=USERNAME=HERE:PROXY=PASSWORD=HERE@URL:PORT"
# export http_proxy="http://vivek:secretePassword@server1.cyberciti.biz:3128"
Feel free to add the above line in the to your shell profile file such as ~/.bash_profile. Seehow to set or export: http_proxy with special characters in password on a Unix or Linux based system for more information.
No comments:
Post a Comment