Skip to content

Instantly share code, notes, and snippets.

@dermodmaster
Created August 29, 2024 11:44
Show Gist options
  • Save dermodmaster/1d6ffa29cf71b9a3478890e09dc05199 to your computer and use it in GitHub Desktop.
Save dermodmaster/1d6ffa29cf71b9a3478890e09dc05199 to your computer and use it in GitHub Desktop.
Install ComfyUi easily with FLUX-Dev on AWS EC2 instance
#!/bin/bash
# Used EC2 Image: Techlatest.net-nvidia-aiml-cuda-vm-v01-prod-b2r3n6vwasdcy
# 1. Check if script is run with sudo
if [ "$EUID" -ne 0 ]; then
echo "Please run as root (using sudo)"
exit 1
fi
# 2. Change the password of ubuntu, for jupyterhub login
echo "Changing the password for user 'ubuntu'. These credentials are used for the jupyterhub, running on port 80 in this image."
sudo passwd ubuntu
# 3. Git clone the repository
echo "Cloning ComfyUI-Installer repository..."
git clone https://github.com/dermodmaster/ComfyUI-Installer
# 4. Go to the folder ComfyUI-Installer
cd ComfyUI-Installer || { echo "Failed to enter ComfyUI-Installer directory"; exit 1; }
# 5. Update package lists
echo "Updating package lists..."
sudo apt update
# 6. Install required packages
echo "Installing necessary packages..."
sudo apt install -y python3 python3-pip python3-venv python-is-python3
# 7. Check GPU type and run appropriate install script
if lspci | grep -i nvidia > /dev/null; then
echo "NVIDIA GPU detected. Running NVIDIA install script..."
sudo bash install-nvidia.sh
elif lspci | grep -i amd > /dev/null; then
echo "AMD GPU detected. Running AMD install script..."
sudo bash install-amd.sh
else
echo "No supported GPU detected (NVIDIA or AMD). Exiting..."
exit 1
fi
# 8. Ask if FluxDEV should be installed
read -p "Do you want to install FluxDEV from HuggingFace (Comfy-Org/flux1-dev)? (y/n): " install_flux
if [ "$install_flux" == "y" ]; then
echo "Installing FluxDEV..."
wget https://huggingface.co/Comfy-Org/flux1-dev/resolve/main/flux1-dev-fp8.safetensors -P ComfyUI/models/checkpoints/
fi
# 9. Run the application with listening enabled
echo "Running the application with listening enabled (for 0.0.0.0/0!!!) ..."
./launch.sh --listen 0.0.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment