"Proxmox VM Debian 12: AUTOMATIC1111 Stable Diffusion Setup Guide"
Expire never
Posted on 01/07/2025
Posted on 01/07/2025
"Log in as root, install sudo, add your user to the sudo group, "then exit the root shell and reconnect via SSH using your regular username." step 1 #!/bin/bash set -e echo "Step 1: Update & upgrade the system" sudo apt update && sudo apt upgrade -y echo "Step 2: Remove any existing NVIDIA drivers" sudo apt autoremove --purge -y nvidia* echo "Step 3: Install required packages for NVIDIA and build dependencies" sudo apt install -y build-essential linux-headers-$(uname -r) wget libssl-dev zlib1g-dev \ libncurses5-dev libncursesw5-dev libreadline-dev libsqlite3-dev libgdbm-dev libdb5.3-dev \ libbz2-dev libexpat1-dev liblzma-dev tk-dev libffi-dev uuid-dev echo "Step 4: Blacklist Nouveau driver" echo "blacklist nouveau" | sudo tee /etc/modprobe.d/blacklist-nouveau.conf echo "options nouveau modeset=0" | sudo tee -a /etc/modprobe.d/blacklist-nouveau.conf echo "Step 5: Update initramfs" sudo update-initramfs -u echo "Step 6: Download NVIDIA driver 575.64" sudo wget -O /tmp/NVIDIA-Linux-x86_64-575.64.run https://download.nvidia.com/XFree86/Linux-x86_64/575.64/NVIDIA-Linux-x86_64-575.64.run echo "Step 7: Make NVIDIA installer executable" sudo chmod +x /tmp/NVIDIA-Linux-x86_64-575.64.run echo "Step 8: Run NVIDIA installer (follow the prompts!)" sudo /tmp/NVIDIA-Linux-x86_64-575.64.run echo "Step 9: Install Vulkan libraries" sudo apt install -y libvulkan1 vulkan-tools vulkan-validationlayers echo "Step 10: Verify Vulkan installation" if ! vulkaninfo >/dev/null 2>&1; then echo "Warning: vulkaninfo command failed. Please verify Vulkan installation." fi echo "Step 11: Download and install Python 3.10.6 if not installed" PYTHON_VERSION="3.10.6" if ! command -v python3.10 &>/dev/null; then echo "Downloading Python $PYTHON_VERSION source..." cd /usr/src sudo wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz sudo tar xzf Python-$PYTHON_VERSION.tgz cd Python-$PYTHON_VERSION echo "Configuring and compiling Python $PYTHON_VERSION..." sudo ./configure --enable-optimizations sudo make altinstall else echo "Python 3.10 already installed." fi echo "Step 12: Setup update-alternatives for python3" sudo update-alternatives --install /usr/bin/python3 python3 /usr/local/bin/python3.10 1 echo "If multiple python3 versions are installed, select the default manually with:" echo " sudo update-alternatives --config python3" echo "Installed Python version:" python3.10 --version echo "Setup complete! Please reboot your system to apply NVIDIA driver changes." REBOOT Sudo reboot now +++++++++++++++++++++ Step2 #!/bin/bash set -e # Variables PYTHON_CMD="python3.10" REPO_DIR="$HOME/stable-diffusion-webui" echo "Step 1: Install git if not installed" sudo apt install -y git echo "Step 2: Clone or update Stable Diffusion WebUI repository" if [ ! -d "$REPO_DIR" ]; then echo "Cloning repository..." git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git "$REPO_DIR" else echo "Repository exists, updating..." cd "$REPO_DIR" git pull origin master fi echo "Step 3: Configure environment variables for listening and python command" cd "$REPO_DIR" # Add environment variable to webui-user.sh if missing if ! grep -q 'export COMMANDLINE_ARGS="--listen"' webui-user.sh; then echo 'export COMMANDLINE_ARGS="--listen"' >> webui-user.sh fi if ! grep -q "python_cmd=\"$PYTHON_CMD\"" webui-user.sh; then echo "python_cmd=\"$PYTHON_CMD\"" >> webui-user.sh fi echo "Step 4: Run the WebUI" ./webui.sh +++++++++++++++++++++++++++ Step 3 When stablediff has finished, Open second terminal and copy past below. #!/bin/bash set -e # Detect the user who should run the service if [ "$SUDO_USER" ]; then USER="$SUDO_USER" else USER=$(whoami) fi SD_DIR="/home/$USER/stable-diffusion-webui" SERVICE_NAME="stable-diffusion.service" SERVICE_PATH="/etc/systemd/system/$SERVICE_NAME" echo "Creating systemd service for Stable Diffusion WebUI..." sudo tee "$SERVICE_PATH" > /dev/null <<EOF [Unit] Description=Stable Diffusion WebUI After=network.target [Service] Type=simple User=$USER WorkingDirectory=$SD_DIR ExecStart=$SD_DIR/webui.sh Restart=on-failure RestartSec=10 [Install] WantedBy=multi-user.target EOF echo "Reloading systemd daemon..." sudo systemctl daemon-reload echo "Enabling $SERVICE_NAME to start on boot..." sudo systemctl enable $SERVICE_NAME echo "Starting $SERVICE_NAME now..." sudo systemctl start $SERVICE_NAME echo "Service status:" sudo systemctl status $SERVICE_NAME --no-pager echo "Setup complete. Stable Diffusion WebUI will start automatically on boot."