Set up and use a proxy server on the Linux command line

Source: Internet
Author: User

Objective

When using Apt-get or git pull or wget, you often consider using a proxy server for reasons of domestic network limitations.
At this point, you need to set up the proxy at the command line without affecting the system's proxy settings.

Method

You can set up a proxy server in three ways
Method One
Run the command directly in the terminal

Export http_proxy=http://proxyaddress:port

The benefit of this approach is simple and straightforward, and the impact surface is small (only valid for the current terminal).
Method Two
Write proxy address to shell configuration file

VI ~/.BASHRC

Add the following to the end of the file

Http_proxy=http://proxyaddress:portexport http_proxy

Then ESC: WQ Save the file and then execute it in the terminal

SOURCE ~/.BASHRC

Or exit the current terminal and start a terminal again.
The advantage of this approach is to permanently save the proxy server, the next time it can be used directly.
Method Three
Change the configuration of the appropriate tool, such as apt

sudo VI /etc/apt/apt.conf

Add the following line to the end of the file

" Http://proxyAddress:port "

Save the apt.conf file.
Added
If the proxy server needs to log in, you can write the username and password directly.

Http_proxy=http://Username:[email protected]:p ort

Set up and use a proxy server on the Linux command line

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.