squid八爪鱼安装部署

简介

本次安装版本为4.17版本,在此之前安装5.9版本启动时起不来,然后还不报错(目前来看原因应该是缺少squid用户的问题),所以退而求次,安装4.17版本

步骤

1、上传squid-4.17.tar.gz到服务器data目录下
2、解压并建立squid文件夹

[root@zonghe03 data]# mkdir squid
[root@zonghe03 data]# tar zxvf squid-4.15.tar.gz
[root@zonghe03 data]# ll
total 10544
drwx------  2 root root   16384 Jul  7 11:11 lost+found
drwxr-xr-x  8 root root    4096 Jul  7 15:52 squid
drwxr-xr-x 16 1000 1000    4096 Jul  7 15:40 squid-4.17
-rw-r--r--  1 root root 5292674 Jul  7 15:37 squid-4.17.tar.gz
drwxr-xr-x 16 1000 1000    4096 Jul  7 15:17 squid-5.9
-rw-r--r--  1 root root 5471615 Jul  6 18:05 squid-5.9.tar.gz

3、进入解压后的squid-4.17 进行配置 安装

[root@zonghe03 data]# cd squid-4.17
[root@zonghe03 squid-4.17]# ./configure --prefix=/data/squid --sysconfdir=/data/squid/config --enable-linux-netfilter
[root@zonghe03 data]# make
[root@zonghe03 data]# make install

4、进入data/sbin启动 这时候就出现问题了

[root@zonghe03 sbin]# ./squid 
WARNING: Cannot write log file: /data/squid/var/logs/cache.log
/data/squid/var/logs/cache.log: Permission denied
         messages will be sent to 'stderr'.

根据报错然后结合百度知道是缺少squid且没权限的问题,那我们就进行建用户和赋权限
5、查看是否有squid用户

[root@zonghe03 data]# cat /etc/passwd
发现没有
进行建用户
[root@zonghe03 squid]# useradd -M -s /sbin/nologin squid
[root@zonghe03 squid]# cat /etc/passwd
这时候就有squid用户了
[root@zonghe03 squid]# chown -R squid:squid /data/squid/
[root@zonghe03 squid]# ll
total 24
drwxr-xr-x 2 squid squid 4096 Jul  7 15:52 bin
drwxr-xr-x 2 squid squid 4096 Jul  7 15:52 config
drwxr-xr-x 2 squid squid 4096 Jul  7 15:52 libexec
drwxr-xr-x 2 squid squid 4096 Jul  7 15:52 sbin
drwxr-xr-x 5 squid squid 4096 Jul  7 15:52 share
drwxr-xr-x 5 squid squid 4096 Jul  7 15:52 var
[root@zonghe03 data]# chmod -R 777 squid/
查看版本
[root@zonghe03 squid]# ./sbin/squid -v
Squid Cache: Version 4.17
Service Name: squid
configure options:  '--prefix=/data/squid' '--sysconfdir=/data/squid/config' '--enable-linux-netfilter' --enable-ltdl-convenience

6、启动

[root@zonghe03 squid]# ./sbin/squid
[root@zonghe03 squid]# ps -ef |grep squid
root     18874     1  0 16:05 ?        00:00:00 ./sbin/squid
nobody   18876 18874  0 16:05 ?        00:00:00 (squid-1) --kid squid-1
nobody   18877 18876  0 16:05 ?        00:00:00 (logfile-daemon) /data/squid/var/logs/access.log
root     18920 19687  0 16:05 pts/1    00:00:00 grep --color=auto squid

7、配置客户端进行验证

在另一台机器的profice进行配置
[root@zonghe02 ~]# vim /etc/profile
http_proxy=http://172.xx.xxx.xx:3128
https_proxy=http://172.xx.xxx.xx:3128
no_proxy=172.xx.xxx.,xx.255.xx.xx
[root@zonghe02 ~]# source /etc/profile
[root@zonghe02 ~]# curl www.baidu.com
<!DOCTYPE html>
<!--STATUS OK--><html> <head><meta http-equiv=content-type content=text/html;charset=utf-8><meta http-equiv=X-UA-Compatible content=IE=Edge><meta content=always name=referrer><link rel=stylesheet type=text/css href=http://s1.bdstatic.com/r/www/cache/bdorz/baidu.min.css><title>缇搴︿镐革间綘灏辩ラ</title></head> <body link=#0000cc> <div id=wrapper> <div id=head> <div class=head_wrapper> <div class=s_form> <div class=s_form_wrapper> <div id=lg> <img hidefocus=true src=//www.baidu.com/img/bd_logo1.png width=270 height=129> </div> <form id=form name=f action=//www.baidu.com/s class=fm> <input type=hidden name=bdorz_come value=1> <input type=hidden name=ie value=utf-8> <input type=hidden name=f value=8> <input type=hidden name=rsv_bp value=1> <input type=hidden name=rsv_idx value=1> <input type=hidden name=tn value=baidu><span class="bg s_ipt_wr"><input id=kw name=wd class=s_ipt value maxlength=255 autocomplete=off autofocus></span><span class="bg s_btn_wr"><input type=submit id=su value=缇搴︿镐?class="bg s_btn"></span> </form> </div> </div> <div id=u1> <a href=http://news.baidu.com name=tj_trnews class=mnav>姘榛</a> <a href=http://www.hao123.com name=tj_trhao123 class=mnav>hao123</a> <a href=http://map.baidu.com name=tj_trmap class=mnav>灏?/a> <a href=http://v.baidu.com name=tj_trvideo class=mnav>瑙棰</a> <a href=http://tieba.baidu.com name=tj_trtieba class=mnav>璐村</a> <noscript> <a href=http://www.baidu.com/bdorz/login.gif?login&amp;tpl=mn&amp;u=http%3A%2F%2Fwww.baidu.com%2f%3fbdorz_come%3d1 name=tj_login class=lb>缁褰</a> </noscript> <script>document.write('<a href="http://www.baidu.com/bdorz/login.gif?login&tpl=mn&u='+ encodeURIComponent(window.location.href+ (window.location.search === "" ? "?" : "&")+ "bdorz_come=1")+ '" name="tj_login" class="lb">缁褰</a>');</script> <a href=//www.baidu.com/more/ name=tj_briicon class=bri style="display: block;">驽や骇?/a> </div> </div> </div> <div id=ftCon> <d
iv id=ftConw> <p id=lh> <a href=http://home.baidu.com>?                                                                                        蹇
璇?/a>&nbsp; <a href=http://jianyi.baidu.com/ class=cp-feedback>=c棣</a>&nbsp;浜琁CP030173&nbsp; <img src=//www.baidu.com/img/gs.gif> </p> </div> </div> </div> </body> </html>
[root@zonghe02 ~]# 1;2c     

8、同时在代理服务的日志能够看到相应记录

[root@zonghe03 logs]# pwd
/data/squid/var/logs
[root@zonghe03 logs]# cat access.log 
1688717347.290    160 172.xx.xxx.xx TCP_MISS/200 2842 GET http://www.baidu.com/ - HIER_DIRECT/xx.156.xx.xx text/html
1688717467.415    149 172.xx.xxx.xx TCP_MISS/200 2842 GET http://www.baidu.com/ - HIER_DIRECT/xx.156.xx.18 text/html

猜你喜欢

转载自blog.csdn.net/csdn_mycsdn/article/details/131599765
今日推荐