This document describes how to use a proxy server to access the Internet on the Linux command line interface.
Use a proxy server to access the Internet on the Linux command line interface
2007-10-25 kenthy # qingdaonews.com
Use the proxy Server to access the Internet on the Linux command line interface-system environment: Red Hat Enterprise Linux Server release 5 (kernel 2.6.18-8. el5xen)
Use a proxy server to access the Internet on the Linux command line interface-software environment
Elinks-0.11.1-5.1.el5
Lynx-2.8.5-28.1
Wget-1.10.2-7.el5
Krb5-workstation-1.5-17
Prozilla-2.0.4.tar.bz2 http://prozilla.genesys.ro/downloads/prozilla/tarballs/prozilla-2.0.4.tar.bz2
Use the proxy server to access the Internet on the Linux command line interface-Target Function
Access the web site and download software on the Linux command line interface by specifying a Proxy Server
(Applicable to scenarios where a proxy server must be specified for certain LAN networks to access the Internet)
I. general proxy settings on the Linux command line interface
1. Set related environment variables in the profile file
# Vi/etc/profile
Http_proxy = http: // 192.168.20.20: 3128 # specify the proxy server addresses used by http, https, and ftp respectively.
Https_proxy = http: // 192.168.20.20: 3128
Ftp_proxy = http: // 192.168.000020: 3128
No_proxy = 192.168.20. # Do not use a proxy when accessing the LAN address 192.168.20.0/24). You can use commas to separate multiple addresses.
Export http_proxy https_proxy ftp_proxy no_proxy
Save and exit. log out and log on to the system again to take effect.
2. Test Results
You can use the wget command to download files through a proxy (the following command can recursively download the entire Chinese manual directory of FreeBSD ):
# Wget-krp-np http://cnsnap.cn.freebsd.org/doc/zh_CN.GB2312/books/handbook/
Elinks can be used to access a web site. It is suitable for accessing a text-based English website on a terminal)
When using lynx to access the Internet, it seems that if the proxy server uses Microsoft ISA, It is not supported.
[Note: apt-get and other tests are successful in Ubuntu 7.10.]
2. Use the proxy server to access the Internet on the Linux command line interface: Install the prozilla multi-thread download tool and proxy settings
1. Install prozilla
# Wget http://prozilla.genesys.ro/downloads/prozilla/tarballs/prozilla-2.0.4.tar.bz2
# Tar zxvf prozilla-2.0.4.tar.bz2-C/usr/src/
# Prozilla-2.0.4/cd/usr/src/
#./Configure
# Make & make install
[Error message:]
If the error "download_win.h: 55: Error: excessive limit 'dl _ Window: '" is reported during compilation, modify the error file as prompted and re-compile the file:
-- The source code in the/usr/src/prozilla-2.0.4/src/download_win.h file line 55th, from the original:
Void DL_Window: print_status (download_t * download, int quiet_mode );
Changed:
Void print_status (download_t * download, int quiet_mode );
2. Specify the proxy server address
# Vi ~ /. Prozilla/prozconfig
Httpproxy = 192.168.255.20: 3128
Httpproxyuser =
Httpproxypassword =
Httpproxytype = 7
Usehttpproxy = 1
Ftpproxy = 192.168.20.20: 3128
Ftpproxyuser =
Ftpproxypassword =
Ftpproxytype = 7
Useftpproxy = 1
3. Download example (with 10 concurrent threads specified ):
# Proz-k http://prozilla.genesys.ro/downloads/prozilla/tarballs/prozilla-2.0.4.tar.bz2
Iii. Appendix: Automatically log on to ftp and download the shell script of the file
1. vi autoftp1.sh
#! /Bin/bash
Ftp-iun 192.168.20.20 2121 2>/dev/null/tmp/ftp.txt
Ftp-iun </tmp/ftp.txt
Rm-rf/tmp/ftp.txt
The above method is to use the proxy server to access the Internet on the Linux command line interface. I hope it will help you.
- Special topics: proxy server settings and the latest proxy server address technology
- How to access linux Command lines in linux
- How to Create File commands in Linux
- Usage of cron and linux at commands in linux