sudo yum update -ysudo yum install -y \
git \
wget \
curl \
unzip \
python3 \
python3-pip \
gcc \
gcc-c++ \
make检查 Python 版本(建议 3.8–3.10):
python3 --version⚠️ CPU 跑 SD 非常慢,强烈建议 NVIDIA 显卡
lspci | grep -i nvidiasudo yum install -y epel-release
sudo yum install -y kmod-nvidia或去官网下载 run 文件(新手不推荐)
wget https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-repo-rhel7-11-8-local-11.8.0_520.61.05-1.x86_64.rpm
sudo rpm -i cuda-repo-*.rpm
sudo yum clean all
sudo yum install -y cuda验证:
nvidia-smipip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118验证:
python3 -c "import torch; print(torch.cuda.is_available())"True 说明成功cd ~
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui把模型放到:
models/Stable-diffusion/常用模型:
示例:
wget https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned.safetensors \
-O models/Stable-diffusion/v1-5.safetensors编辑 webui-user.sh:
nano webui-user.sh推荐配置:
export COMMANDLINE_ARGS="--skip-torch-cuda-test --no-half --listen --port 7860"bash webui.sh浏览器访问:
http://服务器IP:7860如果是本地:
http://127.0.0.1:7860✅ 解决方案:
✅ 使用 pyenv:
curl https://pyenv.run | bash
pyenv install 3.10.6
pyenv global 3.10.6只能 CPU 运行(非常慢):
export COMMANDLINE_ARGS="--cpu"docker run -it --gpus all \
-p 7860:7860 \
-v ~/sd-models:/app/models \
sdalci/stable-diffusion-webui系统更新
→ 显卡驱动 + CUDA
→ Python + PyTorch
→ 下载 WebUI
→ 下载模型
→ 启动如果你愿意,可以告诉我:
✅ CentOS 版本
✅ 是否有 GPU
✅ 显存大小
我可以 给你一套完全定制的安装方案 ✅