Mac M1探索AnythingLLM+SearXNG

发布于:2025-08-14 ⋅ 阅读:(20) ⋅ 点赞:(0)

SearXNG 能聚合来自多达 200 多个搜索服务,可私有化部署,并提供了灵活自定义选项。

AnythingLLM+SearXNG,刚好能解决AnythingLLM因为网络限制导致web search不可用的问题。

1 安装docker

下载mac m1版本的docker并安装。

https://docs.docker.com/desktop/setup/install/mac-install/

更新docker mirror信息

docker pull docker-0.unsee.tech/istio/distroless

由于SearXNG依然不能正常pull,进一步

修改docker mirror,具体位置

内容如下

{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "features": {
    "buildkit": true
  },
  "registry-mirrors": [
    "https://docker.1panel.dev",
    "https://docker.fxxk.dedyn.io",
    "https://docker.xn--6oq72ry9d5zx.cn",
    "https://docker.m.daocloud.io",
    "https://a.ussh.net",
    "https://docker.zhai.cm"
  ]
}

然后docker就能正常pull了

2 安装SearXNG

1)docker安装SearXNG

这里选择docker命令进行部署。

mkdir my-searxng
cd my-searxng
export PORT=8080
docker pull searxng/searxng
docker run --rm \
           -d -p ${PORT}:8080 \
           -v "${PWD}/searxng:/etc/searxng" \
           -e "BASE_URL=http://localhost:$PORT/" \
           -e "INSTANCE_NAME=searxng" \
             searxng/searxng

部署过程中有可能会遇到如下问题,解决方案参考附录

“error while creating mount source path '/host_mnt/Users/username/xxxanythingllm/searxng/my-searxng/searxng': mkdir /host_mnt/Users/username/xxx: operation not permitted.”

2)测试SearXNG

部署完成,可以在浏览器访问了,链接如下

http://127.0.0.1:8080

SearXNG默认不启用bing和baidu,可以在如下链接页面设置,找到bing和baidu并勾选。

http://127.0.0.1:8080/preferences

点击右下角Save后就可以正常访问了。

3)配置SearXNG

为了AnythingLLM 通过接口调用 SearXNG,需要SearXNG 支持返回 json 格式数据,具体为修改 settings.yml 文件,在 search.formats 部分(大约在第 30 行),添加 - json 配置项。

然后重启SearXNG docker容器

docker restart <container-id>

重启后,访问如下链接看能否返回json数据。

http://127.0.0.1:8080/search?q=llm&format=json

正常情况应该返回如下数据

3 AnythingLLM+SearXNG

假设AnythingLLM和Ollama已安装,考虑到mac m1受限算力,采用qwen3:4b小模型。

详情请参考Mac M1探索AnythingLLM+Ollama+知识库问答-CSDN博客

这里直接说明在AnythingLLM中配置SearXNG的过程。

1)AnythingLLM中配置SearXNG

如下图所示,在AnythongLLM的WebSearch中选择SearXNG,填写BaseUrl,然后Save保存。

http://192.168.66.107:8080/search

不能用http://127.0.0.1:8080/search,必须填写容器宿主机(安装docker机器)的被分配真实ip。

AnythingLLM不能通过127.0.0.1定位到安装在docker容器中的SearXNG。填写宿主机真实IP,能确保SearXNG和AnythingLLM网络互通,宿主机ip地址获取参考附录。

2)测试 SearXNG 生效

在AnythongLLM的agent聊天页面,输入

@agent 请你帮我搜索 QwQ大模型

agent没有提示网络失败,所以AnythingLLM和SearXNG之间的网络是通的。

AnythongLLM回答不太符合预期,与本地LLM处理能力有关,这里LLM Qwen3:4b是小模型。

附录

---

mac m1 docker相关问题

1)container sharing问题

docker: Error response from daemon: error while creating mount source path '/host_mnt/Users/username/xxxanythingllm/searxng/my-searxng/searxng': mkdir /host_mnt/Users/username/xxx: operation not permitted.

方案: 将container的sharing从gRPC或virtualFS更改为osxfs

change the docker settings to use osxfs, instead of gRPC or Fuse.

https://github.com/docker/for-mac/issues/5390

2)容器ip获取

登录docker container机器,然后运行ifconfig

这里ip为172.17.0.2

3)宿主机ip获取

在安装docker容器的主机中,打开term,输入ifconfig,获取ip地址。

ifconfig

也可以通过其他方式获取,如直接查看网络连接,查看dockder软件中的宿主机信息。

reference

---

searxng-docker

https://github.com/searxng/searxng-docker

searxng

https://github.com/searxng/searxng

AnythingLLM + SearXNG 实现私有搜索引擎代理

https://zhuanlan.zhihu.com/p/29294534050

docker install

https://docs.docker.com/desktop/setup/install/mac-install/

colima使用docker compose问题(mac)

https://blog.csdn.net/m0_38113882/article/details/131550044

目前国内可用Docker镜像源汇总(截至2025年6月)

目前国内可用Docker镜像源汇总(截至2025年6月) - CoderJia

MacOS安装docker,并设置国内镜像源

https://www.haveyb.com/article/3245

使用SearXNG-搭建个人搜索引擎(附国内可用Docker镜像源)

https://blog.csdn.net/C_0010/article/details/143191038

host_mnt volume mount problem on Mac in the latest version with has reappeared #5390

https://github.com/docker/for-mac/issues/5390