# From: https://github.com/AUTOMATIC1111/stable-diffusion-webui # Non-interactive export DEBIAN_FRONTEND=noninteractive # Install dependencies sudo add-apt-repository ppa:deadsnakes/ppa -y sudo apt update -y sudo apt install python3.11 -y sudo apt install wget git python3-venv libgl1 libglib2.0-0 google-perftools -y # Then set up env variable in launch script export python_cmd="python3.11" # Get the webui script cd /home/ubuntu wget -q https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui/master/webui.sh sudo chmod +x webui.sh sudo chown ubuntu:ubuntu webui.sh # Run the webui script as ubuntu user sudo -u ubuntu ./webui.sh # SSH tunnel with 7860 port # ssh -L 7860:localhost:7860 -i /path/to/key.pem ubuntu@instance-ip # Debugging: # cat /var/log/cloud-init-output.log