Use a proxy server to access the Internet on the Linux command line interface
Source: Internet
Author: User
On the Linux command line interface, use the proxy server to access the Internet-Linux Enterprise Application-Linux server application information. For more information, see the following. System Environment: Red Hat Enterprise Linux Server release 5 (kernel 2.6.18-8. el5xen)
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/downl... zilla-2.0.4.tar.bz2
Target Features:
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 command line interface
1. Set related environment variables in the profile file
# Vi/etc/profile
Http_proxy = 192.168.20.20: 3128 # specify the proxy server addresses used by http, https, and ftp respectively
Https_proxy = 192.168.20.20: 3128
Ftp_proxy = 192.168.20.20: 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 (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.
Ii. Install prozilla multi-thread download tool and proxy settings
1. Install prozilla
# Wget http://prozilla.genesys.ro/downl... zilla-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 10 http://prozilla.genesys.ro/downl... zilla-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.000020 2121 2>/dev/null <"EOF"
User ftp
Binary
LCD/tmp
Cd/files
Mget * .tar.gz
Bye
EOF
Or
2. vi autoftp2.sh
#! /Bin/bash
Host = 192.168.20.20
Port = 2121
Username = ftp
Password = ftp
Echo "open $ host $ port
User $ username $ password
Binary
LCD/tmp
Cd/files
Mget * .tar.gz
Bye ">/tmp/ftp.txt
Ftp-iun </tmp/ftp.txt
Rm-rf/tmp/ftp.txt
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