1、安装squid

yum install squid

2、备份配置文件

cp /etc/squid/squid.conf /etc/squid/squid.conf.bak

3、编辑配置文件

vi /etc/squid/squid.conf

4、允许所有用户使用代理

修改:http_accessdeny all为:http_access allow all

5、设置squid代理IP和端口

修改:http_port3128为:http_port xxx.xxx.xxx.xxx:3128
注:xxx.xxx.xxx.xxx为本机ip地址
image.png

6、检查配置参数是否有错

squid -k parse

7、初始化缓存

squid –z
image.png

8、启动服务

service squid start

9、查看端口是否打开

netstat –ntpl|grep squid

10、安装htpassword

yum -y install httpd-tools

11、利用htpassword命令添加用户

htpasswd -bc htpasswd.user admin 123456