> For the complete documentation index, see [llms.txt](https://huataihuang.gitbook.io/cloud-atlas-draft/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://huataihuang.gitbook.io/cloud-atlas-draft/service/proxy/deploy_squid_on_macos.md).

# 在macOS上部署squid

[SquidMan](https://squidman.net/squidman/)是一个MacOS图形安装和管理Squid proxy cache的应用程序，是为了方便"个人"使用的代理服务器。

![SquidMan](https://3334459331-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeFI0OlHH4bg0gqJ3hR%2Fsync%2F1dc43463494c7ae2f296dac12020e187124ef3cf.png?generation=1589004736436939\&alt=media)

## 安装

* 从 [SquidMan](https://squidman.net/squidman/) 官方网站下载最新安装包 `SquidMan4.1.dmg` ，将这个应用拖放到 Applications 目录下进行安装。
* 在Launch中点击运行 `SquidMan` ，此时会提示需要安装一个 `Helper Tool Installation` :

![SquidMan Helper](https://3334459331-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeFI0OlHH4bg0gqJ3hR%2Fsync%2Fec001b784a68dbb8a7f8079827125cd038445f3c.png?generation=1589004735531564\&alt=media)

* 点击安装Helper，会提示当前系统还没有安装Squid子系统，则点击 `OK` 按钮进行安装:

![SquidMan Helper install squid](https://3334459331-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeFI0OlHH4bg0gqJ3hR%2Fsync%2Fb7f628e8f206f35d71e383d055ae7d050206a528.png?generation=1589004736187808\&alt=media)

* 安装Squid之后，SquidMan会提示 `sucessfully reinstalled` :

![SquidMan Helper install squid成功](https://3334459331-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeFI0OlHH4bg0gqJ3hR%2Fsync%2F99a46d1494d7c990cf3a1e4c3d5506785b9b8778.png?generation=1589004735717259\&alt=media)

## 配置

* 基本上所见所得，我只修改了一下代理服务端口，采用squid常用的3128端口

![SquidMan preferences](https://3334459331-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeFI0OlHH4bg0gqJ3hR%2Fsync%2F9c4bd03816ed6609509dea6089623ebebbc6d3aa.png?generation=1589004736170744\&alt=media)

* 保存配置修改，然后点击 `Start Squid` 按钮，启动squid

![SquidMan启动squid](https://3334459331-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeFI0OlHH4bg0gqJ3hR%2Fsync%2F42c3ac54442f903bbf90b26c85584f2165f79671.png?generation=1589004735887425\&alt=media)

### 配置允许客户端

* 在apt上配置了代理指向macOS上的squid服务器：

```bash
Acquire::http::Proxy "http://192.168.6.1:3128/";
Acquire::https::Proxy "http://192.168.6.1:3128/";
```

* 升级提示报错

```
Err:13 https://repo.download.nvidia.com/jetson/common r32 InRelease
  Invalid response from proxy: HTTP/1.1 403 Forbidden  Server: squid/4.7  Mime-Version: 1.0  Date: Thu, 16 Apr 2020 09:13:08 GMT  Content-Type: text/html;charset=utf-8  Content-Length: 3512  X-Squid-Error: ERR_ACCESS_DENIED 0  Vary: Accept-Language  Content-Language: en  X-Cache: MISS from localhost  Via: 1.1 localhost (squid/4.7)  Connection: keep-alive     [IP: 192.168.6.1 3128]
...
Err:15 http://ports.ubuntu.com/ubuntu-ports bionic InRelease
  403  Forbidden [IP: 192.168.6.1 3128]
```

这是因为没有配置允许的客户端IP地址，需要在 `SquidMan Preferences` 中设置 `Clients` :

![squid设置client](https://3334459331-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LeFI0OlHH4bg0gqJ3hR%2Fsync%2F7194f49eed82cacf98c0914fabb024f36b8b7e88.png?generation=1589004735363189\&alt=media)

* 然后再次客户端访问则正常访问

## 参考

* [How to Set Up a Proxy Server on Your Mac Using SquidMan](https://howchoo.com/g/mwi3ntu1mjq/how-to-set-up-a-proxy-server-on-mac)
