The following article will teach you how to allow your Linux system to use a proxy server for command line tools like wget and yum.
The http_proxy variable tells the system what proxy server it should used to fetch URLs on the command line. This allows you to manually download a file via http, https and ftp and also allows most other command line programs to get files from the internet (for example the yum command to update you Linux system).
To set the http_proxy variable just have to assign a value to it like so:
You must give the value in the URL:PORT format like above. Now if you request a resource from the internet on the command line it will work fine. A simple test would be to fetch our homepage.
$ wget https://www.putorius.net
After running the above command you should have an index.html file which is our homepage you just downloaded.
If you set the variable like mentioned above it will only work for the current shell. If you close the terminal, log out, or create a new shell (terminal window) the variable will not work. For it to work on all new shells you must export it, or what is known and make it a global variable, like so:
or on one line:
http_proxy=http://myproxy.domain.com:8080; export http_proxy
This will still only be useful for all child shells. To make this setting survive a reboot you can put the command in your .bashrc file. This will actually set the variable and export it every time you open a shell.
echo "http_proxy=http://myproxy.domain.com:8080" >> ~/.bashrc
Or you can manually edit the ~/.bashrc file and add the line about with your favorite text editor.
Once you update the bashrc file, you need to source it to load the new file.
Setting it in the ~/.bashrc file is only going to work for the one user who’s home directory the .bashrc file resides in. To make this a global variable for all users place it in the /etc/bashrc file.
echo "http_proxy=http://myproxy.domain.com:8080; export http_proxy" >> /etc/bashrc
How to use WGET with a Proxy Server
How to Configure System Proxy Settings in Red Hat Enterprise Linux
This site uses Akismet to reduce spam. Learn how your comment data is processed.
Hello every body.
I have set my proxy setting in system->prefernces->network proxy. But my firefox is still offline. What should i do
That is a very vague question, there can be 1,000 things that will possibly make your system offline.
I have zorin 10 I need a proxy to read my English newspaper.
Could you please point me in the direction of instructions on how to configure proxy in plain language. ie; press this button and enter this where x= so and so and y= so and so. I have no idea what your insructions refer to 'myproxy.domain.com:8080'You can not see how I do not know what myproxy means domain what domain where? I have no idea. I have the GUI but can not understand what to put in there either. Any help would be appreciated.
Join Our Newsletter
- Bash Scripting (17)
- Basic Commands (50)
- Featured (7)
- Just for Fun (5)
- Linux Quick Tips (98)
- Linux Tutorials (60)
- Miscellaneous (15)
- Network Tools (6)
- Reviews (2)
- Security (32)
Leave a Reply