Follow these steps carefully for a successful installation.
Step 1: Set Up Environment
Make sure you are in the Sagemaker directory. Remember, everything you do outside this directory won’t get saved.
Step 2: Install Miniconda
Miniconda is crucial for creating isolated Python environments. Install it using the following commands:
ls (to check which directory you are in)
cd SageMaker
wget <https://repo.anaconda.com/miniconda/Miniconda3-py310_23.5.2-0-Linux-x86_64.sh> -O "miniconda.sh"
bash "miniconda.sh" -b -u -p "miniconda"
Activate the base environment with this command:
source miniconda/bin/activate
Step 3: Install Automatic1111
Make sure you activate the environment
cd SageMaker
source miniconda/bin/activate
git clone <https://github.com/AUTOMATIC1111/stable-diffusion-webui.git>
cd stable-diffusion-webui
bash webui.sh --xformers
![](https://decodingdatascience.com/wp-content/uploads/2024/06/Screenshot-2024-06-10-131247-1024x251.png)
If you see this “Running on local URL: http://127.0.0.1:7860 or http://127.0.0.1:7861” then you can proceed to the next step.
Step 4: Install Ngrok for Hosting in a New Terminal
Ngrok is used for exposing local servers to the internet. Install it with these commands:
OPEN A NEW TERMINAL
cd SageMaker
source miniconda/bin/activate
pip install ngrok
pip install pyngrok
Run ngrok
to check if it’s installed.
Sign up on https://ngrok.com/ and copy the authtoken code snippet.
![Untitled](https://prod-files-secure.s3.us-west-2.amazonaws.com/d35db53f-a6e2-4466-a18d-ee0089395412/9ec4ea5c-048a-4758-ad9e-0fdbddab65ed/Untitled.png)
Paste the auth token and press enter
Finally, run this command based on which UI you are running:
ngrok http 127.0.0.1:7860
or
ngrok http *your local URL*
![Group 35250 (2).png](https://prod-files-secure.s3.us-west-2.amazonaws.com/d35db53f-a6e2-4466-a18d-ee0089395412/71bb8914-a452-4d21-ae93-e884e24c8ba5/Group_35250_(2).png)
Click the link forwarding to open a new tab.
![black.png](https://prod-files-secure.s3.us-west-2.amazonaws.com/d35db53f-a6e2-4466-a18d-ee0089395412/e019e2c6-86a7-4db5-9c22-ac88c6ad19c1/black.png)
Congrats! You’re all set.
How to open Automatic 1111 again after stopping the instance
Step 1 – Activate your environment
Activate your environment
cd SageMaker
source miniconda/bin/activate
cd stable-diffusion-webui
python launch.py
If you see this “Running on local URL: http://127.0.0.1:7860 ” then you can proceed to the next step.
![](https://decodingdatascience.com/wp-content/uploads/2024/06/Screenshot-2024-06-24-114040-1024x458.png)
Step 2 – Open a new terminal
Activate your environment
cd SageMaker
source miniconda/bin/activate
copy the authtoken code snippet.
![](https://decodingdatascience.com/wp-content/uploads/2024/06/Screenshot-2024-06-24-120045-1024x399.png)
Paste the Authtoken and press enter
Finally, run this command
ngrok http 127.0.0.1:7860
or
ngrok http *your local URL*
![Group 35250 (2).png](https://prod-files-secure.s3.us-west-2.amazonaws.com/d35db53f-a6e2-4466-a18d-ee0089395412/71bb8914-a452-4d21-ae93-e884e24c8ba5/Group_35250_(2).png)
Click the link forwarding to open a new tab.
![black.png](https://prod-files-secure.s3.us-west-2.amazonaws.com/d35db53f-a6e2-4466-a18d-ee0089395412/e019e2c6-86a7-4db5-9c22-ac88c6ad19c1/black.png)
Congrats! You’re all set.