新服务器从0开始搭配Ubuntu+Conda+Docker+Dify

新到一台服务器,4090显卡,需要投喂文件, 搭建个RAG, AI对话框出来,过程:

1 Ubuntu

下载: https://cn.ubuntu.com/download 24.4 记住这个版本号

注意:企业级硬盘要做raid1+raid5.

2 安装显卡驱动和CUDA Toolkit,

bash 复制代码
watch -n 3 -d nvidia-smi     #每隔3秒刷新一次

https://developer.nvidia.com/cuda-12-9-0-download-archive?target_os=Linux&target_arch=x86_64&Distribution=Ubuntu&target_version=24.04&target_type=runfile_local

选择到合适的版本

bash 复制代码
wget https://developer.download.nvidia.com/compute/cuda/12.9.0/local_installers/cuda_12.9.0_575.51.03_linux.run
sudo sh cuda_12.9.0_575.51.03_linux.run

打开终端,配置环境:

bash 复制代码
vim ~/.bashrc

最后添加:

bash 复制代码
export PATH=$PATH:/usr/local/cuda-12.9/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-12.9/lib64

打开终端输入:

bash 复制代码
source ~/.bashrc

最后终端输入nvcc -V即可查看CUDA版本:

3 安装 VPN

参考:

1 https://www.youtube.com/watch?v=1d-HT_xF94w

2 https://github.com/kjfx/vpn/releases/tag/linux

bash 复制代码
sudo apt update
sudo apt install bzip2 tar
sudo apt-get install curl

sudo -i #切换到root用户

bash 复制代码
export url='https://fastly.jsdelivr.net/gh/juewuy/ShellCrash@master' && wget -q --no-check-certificate -O /tmp/install.sh $url/install.sh  && bash /tmp/install.sh && source /etc/profile &> /dev/null

iptables -I INPUT -p tcp --dport 9999 -j ACCEPT   #如果开不了网页要放行端口

Clash管理地址(将IP替换成自己服务器IP):http://192.168.1.1:9999/ui

4 安装Miniconda

bash 复制代码
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

按照提示完成安装:

Enter 阅读许可协议。

输入 yes 接受许可协议。

选择安装路径(默认路径为 ~/miniconda3)。

输入 yes 初始化 Miniconda。

bash 复制代码
source ~/.bashrc  #激活 Conda
conda --version   #检查 Conda 是否安装成功

conda list
conda create -n myenv python=3.9

rm -rf ~/miniconda3   #卸载 Miniconda

5 安装 Git, 方法从github里拉文件

bash 复制代码
sudo apt install git

有时会提示:

已安装 gitlab-jh 软件包 post-installation 脚本 子进程返回错误状态 1 在处理时有错误发生: gitlab-jh

原因是系统里残留的 gitlab-jh 包阻塞了 apt,使安装或更新 git 时报错。

解决方案就是 移除 gitlab-jh,保持系统干净:

bash 复制代码
sudo dpkg --remove --force-remove-reinstreq gitlab-jh
sudo apt autoremove

git --version 查看安装是否正常

6 安装docker

bash 复制代码
sudo apt install apt-transport-https ca-certificates curl software-properties-common  #更新你的包列表并安装一些必要的包
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -  #添加 Docker 的官方 GPG 密钥
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" #添加 Docker 的存储库
sudo apt install docker-ce   #安装 Docker

参考:

https://blog.csdn.net/m0_57236802/article/details/131818211

7 安装 dify

bash 复制代码
git clone https://github.com/langgenius/dify.git
cd dify/docker
cp .env.example .env
docker compose up -d

有的提示80 ,443端口被占用:

改一下 .env文件:

bash 复制代码
EXPOSE_NGINX_PORT=8081
EXPOSE_NGINX_SSL_PORT=4431

这里很有意思的是,它也提示443端口也被占用:

一起改了, 再运行:

bash 复制代码
docker compose up -d
bash 复制代码
有问题可以link q:316853809
相关推荐
C_心欲无痕1 天前
ts - tsconfig.json配置讲解
linux·前端·ubuntu·typescript·json
HIT_Weston1 天前
93、【Ubuntu】【Hugo】搭建私人博客:面包屑(一)
linux·运维·ubuntu
唯情于酒1 天前
Docker学习
学习·docker·容器
cuijiecheng20181 天前
Linux下Beyond Compare过期
linux·运维·服务器
喵叔哟1 天前
20.部署与运维
运维·docker·容器·.net
HIT_Weston1 天前
92、【Ubuntu】【Hugo】搭建私人博客:侧边导航栏(六)
linux·运维·ubuntu
CodeAllen嵌入式1 天前
Windows 11 本地安装 WSL 支持 Ubuntu 24.04 完整指南
linux·运维·ubuntu
期待のcode1 天前
前后端分离项目 Springboot+vue 在云服务器上的部署
服务器·vue.js·spring boot
AI 智能服务1 天前
第6课__本地工具调用(文件操作)
服务器·人工智能·windows·php
松涛和鸣1 天前
49、智能电源箱项目技术栈解析
服务器·c语言·开发语言·http·html·php