安装Squid来配置代理服务器。vim
[root@server ~]# yum -y install squid浏览器
[root@server ~]# vi /etc/squid/squid.conf服务器
# line 26: 添加一条新的ACLide
acl lan src 192.168.96.0/24ui
# line 54: 添加一条新的ACL云计算
http_access allow lanspa
# line 59: 修改代理
http_port 8080orm
# 在文件最后添加server
request_header_access Referer deny all
request_header_access X-Forwarded-For deny all
request_header_access Via deny all
request_header_access Cache-Control deny all
# specify hostname
visible_hostname server.example.com
# not display IP address
forwarded_for off
[root@server ~]# systemctl start squid
[root@server ~]# systemctl enable squid
[root@client ~]# vim /etc/profile
# 在文件最后添加 (将代理配置成环境变量)
MY_PROXY_URL="http://server.example.com:8080/"
HTTP_PROXY=$MY_PROXY_URL
HTTPS_PROXY=$MY_PROXY_URL
FTP_PROXY=$MY_PROXY_URL
http_proxy=$MY_PROXY_URL
https_proxy=$MY_PROXY_URL
ftp_proxy=$MY_PROXY_URL
export HTTP_PROXY HTTPS_PROXY FTP_PROXY http_proxy https_proxy ftp_proxy
[root@client ~]# source /etc/profile
# 以上配置就完成了,可是不一样的应用可能还须要单独配置
# 针对YUM
[root@client ~]# vim /etc/yum.conf
# 在最后添加
proxy=http://server.example.com:8080/
# 针对wget
[root@client ~]# vim /etc/wgetrc
# 在最后添加
http_proxy = http://server.example.com:8080/
https_proxy = http://server.example.com:8080/
ftp_proxy = http://server.example.com:8080/