sudo apt-get update sudo apt upgrade wget https://cn.download.nvidia.com/XFree86/Linux-x86_64/550.100/NVIDIA-Linux-x86_64-550.100.run sudo apt-get update sudo apt-get install g++ sudo apt-get install gcc sudo apt-get install make sudo apt-get remove --purge nvidia* sudo vim /etc/modprobe.d/blacklist.conf blacklist nouveau options nouveau modeset=0 sudo update-initramfs -u sudo reboot 这里需要等一会才能连上
sudo chmod 777 NVIDIA-Linux-x86_64-550.100.run sudo ./NVIDIA-Linux-x86_64-550.100.run 这里一直按回车就行,默认选择
nvidia-smi wget https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_550.54.14_linux.run 执行安装命令
sudo sh ./cuda_12.4.0_550.54.14_linux.run 



sudo vim ~/.bashrc export PATH="/usr/local/cuda-12.4/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda-12.4/lib64:$LD_LIBRARY_PATH" 按esc键退出编辑模式,输入:wq保存并退出
3.更新环境变量
source ~/.bashrc nvcc -V 
wget https://mirrors.cqupt.edu.cn/anaconda/miniconda/Miniconda3-py310_23.10.0-1-Linux-x86_64.sh bash Miniconda3-py310_23.10.0-1-Linux-x86_64.sh -u 直接一直enter键,到输入路径和yes
这边建议路径为:miniconda3
cd miniconda3/bin/ pwd 复制这里的路径
vim ~/.bashrc export PATH="/root/miniconda3/bin:$PATH" source ~/.bashrc conda init bash source ~/.bashrc conda -V 
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/ conda config --set show_channel_urls yes pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple sudo apt-get install libgoogle-perftools4 libtcmalloc-minimal4 -y conda create -n sd python=3.10.6 conda activate sd git clone https://mirror.ghproxy.com/https://github.com/AUTOMATIC1111/stable-diffusion-webui.git 在modules文件夹中找到 launch_utils.py 下的prepare_environment()函数,将其中涉及到 github 仓库的依赖,全部添加 https://mirror.ghproxy.com/镜像,如下图

export HF_ENDPOINT=https://hf-mirror.com echo 'export HF_ENDPOINT="https://hf-mirror.com"' >> ~/.bashrc 5.修改weiui.sh文件,将use_venv变量值改为0,使用当前环境
6.如果是root用户还要将can_run_as_root变量值改为1
./webui.sh --port 15026 --listen --enable-insecure-extension-access --xformers nohup bash ./webui.sh --port 15040 --listen --enable-insecure-extension-access --xformers & 相关参数解释
–port 15026: 设置服务器监听的端口为业务端口,默认端口是7860,这里设置为15026。
–listen: 让服务器监听网络连接。这样设置后,局域网内的其他计算机可以访问UI,如果配置了端口转发,互联网上的计算机也可以访问。
–enable-insecure-extension-access: 启用扩展标签,不考虑其他选项。
更多详细的命令行参数和设置请参考
参考网址https://profaneservitor.github.io/sdwui-docs/cli/


hfd 是huggingface 专用下载工具,基于成熟工具 git+aria2,可以做到稳定下载不断线。
wget https://hf-mirror.com/hfd/hfd.sh chmod a+x hfd.sh apt install aria2 apt install git-lfs ./hfd.sh gpt2 --tool aria2c -x 4 --hf_username YOUR_HF_USERNAME --hf_token hf_*** https://huggingface.co/settings/tokens(需要VPN)下一篇:数据挖掘-数据预处理