一台普通电脑就能跑!openEuler 部署 Llama 完整教程

张开发
2026/4/3 16:18:01 15 分钟阅读
一台普通电脑就能跑!openEuler 部署 Llama 完整教程
在数据化信息时代ai的迅速发展是一个不错的出头本片文章是介绍任何怎么搭建配置llama过一个个人ai。或者是学习ai搭建方便后续发展一使用的iso镜像openEuler22.03 LTS SP3 x86_64 openEuler下载 | openEuler ISO镜像 | openEuler社区Ubuntu Server22.04 LTS Get Ubuntu Server | Download | UbuntuCentos Stream9 Download - The CentOS ProjectAlmalinx9.4 AlmaLinux OS - Forever-Free Enterprise-Grade Operating System文章作者使用的是openeuler版本二检查环境下面是对应的组件如果检查没有可以自主下载组件验证命令缺失时安装命令gccgcc --versionyum install -y gccgg --versionyum install -y gcc-cmakemake --versionyum install -y makecmakecmake --versionyum install -y cmakegitgit --versionyum install -y gitwgetwget --versionyum install -y wgetcurlcurl --versionyum install -y curlnetstatnetstat -iyum install -y net-toolspython3python3 --versionyum install -y python3pip3pip3 --versionyum install -y python3-pipfirewalldsystemctl status firewalldyum install -y firewalld检查完毕后就可以搭建部署llama需要的文件llama.cpp-master或者安装包llama-b8554-bin-310p-openEuler-x86.tar.gz模型使用qwen2.5-1.5b-instruct-q4_k_m.gguf可以通过链接进行下载或者自行下载三llama.cpp-master文件配置1、跟新系统安装包与必要的工具yum update -y yum install -y gcc gcc-c make cmake git wget curl net-tools2、进入llama.cpp-master目录进入文件目录在目录中创建一个名为build的文件夹方便存储后续要在build的bin目录中启动cd /root/llama.cpp-master mkdir build cd build3、编译llama.cpp在这里面可以使用两种方法一个是Cmake进行编译或者是makefile先查看自己的cup核心数量nproc然后进入目录进行进行编译第一个方法Cmake创建文件build目录进入目录开始编译文件cmake .. -DCMAKE_BUILD_TYPERelease -DLLAMA_AVX2ON make -j4然后让它慢慢编译即可第二个方法makefile直接在原目录中使用make即可cd /root/llama.cpp-master make -j44、测试模型推理检查编译完成的文件然后是不同的启动方法一个是使用cmake一个是使用makefilecmake的启动服务需要到build/bin目录中进行启动cd /root/llama.cpp-master/build/bin nohup ./llama-server -m /root/qwen2.5-1.5b-instruct-q4_k_m.gguf \ --host 0.0.0.0 --port 8080 -c 2048 -t 4 server.log 21 使用makefile编译直接在llama.cpp-master文件启动即可cd /root/llama.cpp-master nohup ./server -m /root/qwen2.5-1.5b-instruct-q4_k_m.gguf \ --host 0.0.0.0 --port 8080 -c 2048 -t 4 server.log 21 启动聊天在Linux端聊天cd /root/llama.cpp-master/build/bin ./llama-cli -m /root/qwen2.5-1.5b-instruct-q4_k_m.gguf \ --reverse-prompt User: \ -c 2048 -t 4实时监测使用在后台实时返回数据检查返回值这个是用与在远程链接服务链接的时候cd /root/llama.cpp-master/build/bin ./llama-server -m /root/qwen2.5-1.5b-instruct-q4_k_m.gguf \ --host 0.0.0.0 --port 8080 -c 2048 -t 4

更多文章