A Linux host uses a proxy server for network connection.

Source: Internet
Author: User
Tags git commands

A Linux host uses a proxy server for network connection.

We all know how to set up a connection to the proxy server in Windows, browser ----> tool ------> internet Options -----> connection ---> lan Settings -------> check "use proxy server for lan" to configure the IP address and port number of the proxy server. OK. In Windows, you can browse the webpage through the proxy server.

But in Linux, how do we connect to the network through the proxy server?

As we all know, Linux Command windows are prevalent, and many programs only have command line windows. This results in different settings for each program to connect to the network through the proxy server. The following is a simple configuration of some common network connection settings in Linux Through the proxy server.

[General proxy server settings]

For most Linux console programs, such as apt-get and aptitude commands, git commands, and wget commands, these programs use the http_proxy and ftp_proxy environment variables to obtain the configuration of the proxy service.

Add two variables to your configuration file (you can add them in/etc/profile,/etc/bashrc ,~ /Bashrc ,~ /. Profile, etc. You can set it according to your own situation. It is recommended ~ /Set in bashrc)

Export http_proxy = http: // username: password @ proxyserver: port/

Export ftp_proxy = http: // username: password @ proxyserver: port/

If your proxy server requires a user name and password for access, enter username and password. If not, you can omit it. For example:

Export http_proxy = http: // abcde: 123456@192.168.100.1: 8080

Export ftp_proxy = http: // abcde: 123456@192.168.100.1: 8080

Proxy Server logon Username: abcde password: 123456

Proxy server address: 192.168.100.1 port: 8080 (can be specified in the proxy server)

Save and exit.

Exit the terminal, or directly source ~ /. The bashrc is loaded into the file and the environment variable takes effect.

[Subversion proxy server configuration]

To configure the subversion proxy server, you need to modify the $ HOME/. subversion/servers file and add the following to the [global] section of this file:

Http-proxy-host = 192.168.100.1

Http-proxy-port = 8080

Http-proxy-username = abcde

Http-proxy-password = 123456

Now svn can use the proxy server to access the version library.

[Yum proxy server configuration]

If you want to allow yum in CentOS to update programs through the proxy server, you need to modify the file/etc/yum. conf and add the following to the file:

Proxy = http: // abcde: 123456@192.168.100.1: 8080

Now you can use yum.

This article permanently updates the link address:

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.