当前位置: 首页 > news >正文

南宁网站建设优化昆明网站建设工作室

南宁网站建设优化,昆明网站建设工作室,怒江州城乡建设局网站,is_category wordpress说明:这是我的学习笔记,很多内容转自网络,请查阅文章末尾的参考资料。 目录 安装 Ollama 和 DeepSeek没有root权限,如何安装?如果没有网络,如何安装?访问11434端口,没有显示 “Ollam…

说明:这是我的学习笔记,很多内容转自网络,请查阅文章末尾的参考资料。

目录

  • 安装 Ollama 和 DeepSeek
      • 没有root权限,如何安装?
      • 如果没有网络,如何安装?
      • 访问11434端口,没有显示 “Ollama is running"
      • localhost 访问拒绝的原因
  • 应用 AnythingLLM
  • 开发 LangChain + Ollama + DeepSeek
  • 参考资料

安装 Ollama 和 DeepSeek

  • Ollama官网,下载安装 Ollama
    安装完成以后,在浏览器中输入 http://localhost:11434/
    如果显示 “Ollama is running”,就说明安装成功。

  • Ollama Models网页 ,查看不同的 LLM 信息
    然后,在本地终端执行如下命令,可以自动下载 deepseek-r1:7b 模型(个人电脑适用)
    安装成功,就可以进行聊天对话了!

$ ollama run deepseek-r1:7b
pulling manifest 
... 
success
>>> how to run a test?
...
  • 配置和重启 ollama service
$ vim /etc/systemd/system/ollama.service
...
[Service]
...$ systemctl stop ollama.service
$ systemctl status ollama.service
$ systemctl restart ollama.service

没有root权限,如何安装?

特别说明:如果没有root 或者 sudo权限,需要按照下面的方法来安装

  • Why Ollama install script need SUDO? The install script does this because it needs to check for devices, drivers and set up an ollama user. The releases include pre-built binaries that will work without any sudo (e.g. just run ollama serve).
  • Ollama release 网页直接下载预编译好的二进制文件 (ollama-linux-amd64.tgz)
  • 解压并执行下面的命令运行即可(可能需要修改PATH环境变量)
$ tar xzf ollama-linux-amd64.tgz
...
$ ollama serve
$ ollama run deepseek-r1:7b

如果没有网络,如何安装?

  • 先用上面的方法,安装Ollama
  • 然后从一台已经安装好的机器上把model目录copy到没有网络的机器对应的目录

macOS: ~/.ollama/models
Linux: /usr/share/ollama/.ollama/models
Windows: C:\Users<username>.ollama\models

访问11434端口,没有显示 “Ollama is running"

curl http://localhost:11434/
curl http://localhost:11434/ -o ollama_page.html

This Page Cannot Be Displayed
The system cannot communicate with the external server ( localhost ). The Internet server may be busy, may be permanently down, or may be unreachable because of network problems.
Please check the spelling of the Internet address entered. If it is correct, try this request later.
If you have questions, please contact your organization’s network administrator and provide the codes shown below.

The error message you are encountering indicates that your Linux server is having trouble connecting to a service or application that is supposed to be running locally (on localhost). Here are some common reasons and troubleshooting steps you might consider:

  1. Service Not Running: Ensure that the service or application you are trying to access is running on your server. You can check the status of the service using commands like systemctl status <service-name> or ps aux | grep <service-name>.

  2. Port Issues: Verify that the service is listening on the expected port. Use commands like netstat -tuln or ss -tuln to see which ports are open and being used by services.

  3. Firewall Settings: Check if the firewall is blocking the connection to the service. Use iptables -L or firewalld commands to inspect and modify firewall rules as necessary.

  4. Configuration Errors: Review the configuration files for the service to ensure they are correctly set up to accept connections from localhost.

  5. DNS Resolution: Confirm that localhost is properly defined in the /etc/hosts file. It should typically map to 127.0.0.1.

  6. Network Issues: Ensure there are no network issues or restrictions that could be affecting the communication between services on your server.

  7. Logs: Check the logs for the specific service and system logs (e.g., /var/log/syslog or /var/log/messages) for any error messages that could provide more details.

localhost 访问拒绝的原因

针对“localhost拒绝访问”的问题,以下是一些可能的解决方法,你可以按照这些步骤逐一排查和尝试:

  1. 检查本地主机服务是否启动
    确保你尝试访问的本地服务(如Web服务器、数据库服务等)已经启动并且正在运行。例如,如果你在使用Apache或Nginx作为Web服务器,可以通过以下命令检查其运行状态(以Linux系统为例):
# 检查Apache服务器状态
sudo systemctl status apache2# 检查Nginx服务器状态
sudo systemctl status nginx

如果服务未启动,你可以使用sudo systemctl start apache2或sudo systemctl start nginx命令来启动服务。

  1. 检查防火墙设置是否阻止访问
    防火墙可能会阻止对localhost的访问。你可以检查防火墙规则,确保允许对本地主机的访问。以下是在Linux系统中检查防火墙状态的命令:
# 检查UFW防火墙状态(Ubuntu系统)
sudo ufw status# 检查iptables防火墙规则(通用Linux系统)
sudo iptables -L -v -n

如果发现防火墙阻止了访问,你可以添加相应的规则来允许访问。例如,使用UFW允许HTTP和HTTPS访问:

sudo ufw allow http
sudo ufw allow https
  1. 确认网络连接设置是否正确
    有时候,网络连接设置问题也可能导致无法访问localhost。你可以尝试使用ping命令来测试网络连接:
ping localhost

如果ping命令成功返回响应,说明网络连接基本正常。此外,你还可以检查网络适配器的设置,确保没有配置错误或冲突。

  1. 尝试重启本地主机服务
    有时候,重启本地主机服务可以解决一些暂时性的问题。你可以尝试重启你正在使用的服务,例如Web服务器、数据库服务等。重启服务的命令通常与启动服务的命令类似,只是将start替换为restart:
# 重启Apache服务器
sudo systemctl restart apache2# 重启Nginx服务器
sudo systemctl restart nginx
  1. 查看相关日志文件以获取更多错误信息
    如果以上步骤都没有解决问题,你可以查看相关日志文件以获取更多错误信息。日志文件通常包含有关问题的详细信息和可能的解决方案。例如,Apache服务器的错误日志文件通常位于/var/log/apache2/error.log,Nginx服务器的错误日志文件通常位于/var/log/nginx/error.log。

你可以使用以下命令来查看日志文件的内容:

# 查看Apache错误日志文件
sudo tail -f /var/log/apache2/error.log# 查看Nginx错误日志文件
sudo tail -f /var/log/nginx/error.log

应用 AnythingLLM

  • AnythingLLM官网,下载安装
  • 运行AnythingLLM
    在开始界面,“Search LLLM Providers”,选择我们刚才安装的 Ollama
  • 参考 AnythingLLM 手册,创建Workspace, 上传本地文档
    这样,一个本地知识库+LLM就搭建完成了!

开发 LangChain + Ollama + DeepSeek

# pip install langchain-ollama
from langchain_ollama.chat_models import ChatOllama
llm = ChatOllama(temperature=0.0,base_url="http://localhost:11434",model="deepseek-r1:14b"#model="deepseek-r1:7b"   # too simple#model="deepseek-r1:32b" # too slow
)

如果用终端调试,可以采用下面的方法,

$ curl http://localhost:11434/api/chat -d '{"model": "deepseek-r1:1.5b","messages": [{ "role": "user", "content": "why is the sky blue?" }]
}'

参考资料

  1. 用DeepSeek和AnythingLLM搭建个人知识库,简单又省事,关键还好用
  2. DeepSeek+本地知识库:真的太香了
  3. Building an End-to-End Gen AI App with DeepSeek-R1, Langchain, and Ollama
  4. LangChain - Run models locally
  5. LangChain - Ollama
  6. Enable installation without root priviledge
  7. windows离线ollama部署本地模型并配置continue实现离线代码补全
  8. Ollama使用指南
http://www.dtcms.com/a/484376.html

相关文章:

  • 网站上微信引流怎么做的微生成网站
  • 北京网站建设 奥美通全网营销赣州市经开区住房和建设局网站
  • 深圳企业黄页seo网站计划书
  • 如何制作自己的个人网站it外包服务包括哪些
  • 【小白笔记】for _ in range(N) 中,下划线 _
  • 成全视频免费高清观看在线动漫的青岛网络优化公司
  • 环保局网站建设烟台网站建设设计
  • 凡客品牌玉林网站seo
  • 写网站的教程企业品牌网站建设类型
  • 泾川县门户网站留言wordpress为何需要lamp环境
  • 宿迁新站seo哈尔滨城乡建设局网站
  • wordpress主题半边黑半边白怎么优化一个网站
  • 网站备案需要的资料江苏省建设主管部门网站
  • 正式做网站站点怎么新建深圳网站制作服务公
  • 广州网站建设哪家公司推广一手渠道
  • 如何做好购物网站北京seo薪资
  • 公司网站建设技术的发展wordpress建立网站
  • 网站建设和网络维护网站模板 电器
  • 建企业版网站多久网站开发有专利吗
  • 做淘客网站 名字医疗网站怎么做推广
  • 大学生创业做网站深圳网页制作培训
  • ps拼合网站截图怎么做整合营销公司
  • 自己创建网站怎么赚钱中国建设银行网站荆门网点查询系统
  • 濮阳新闻综合频道网站wordpress输密码访问
  • 做网站注意哪方面工作中网页开发方案
  • 网站建设中目录是什么意思开发公司空置房拨款合同
  • whois哪个网站好ps网页设计步骤及方法
  • 苏州建筑行业网站建设wordpress撤销更改
  • 什么网站可以接装修活楼盘建设信息网站
  • 广州网站开发十度网络最好南昌手机网站