Alishen's picture
Upload SD_install.sh
bfa9b0b
#!/bin/bash
# Update and upgrade system packages
sudo apt update && sudo apt upgrade -y
# Remove unused packages
sudo apt autoremove -y
# Install software-properties-common
sudo apt install software-properties-common -y
# Add deadsnakes PPA
sudo add-apt-repository ppa:deadsnakes/ppa -y
# Install Python 3.10
sudo apt install python3.10
# Clone the stable-diffusion-webui repository
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui
# Install google-perftools
sudo apt install -y google-perftools
# Check python versions
python --version
python3 --version
# Set up python alternatives
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
# Automatically select Python 3.10 for /usr/bin/python
echo 1 | sudo update-alternatives --config python
# Set up python3 alternatives
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
# Automatically select Python 3.10 for /usr/bin/python3
echo 1 | sudo update-alternatives --config python3
# Check python versions again
python3 --version
python --version
# Install python3.10 development and venv packages
sudo apt install python3.10-dev python3.10-venv
# Navigate to the cloned directory
cd stable-diffusion-webui/
# Update webui-user.sh using sed
sed -i 's/#export COMMANDLINE_ARGS=""/export COMMANDLINE_ARGS="--xformers"/' webui-user.sh
# Ensure the webui-user.sh script is executable
chmod +x webui-user.sh
# Execute the webui-user.sh script
./webui-user.sh