Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux Installer Script #871

Closed
wants to merge 29 commits into from
Closed
Changes from 4 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ea1ecc4
Linux installer script
justinh-rahb Feb 23, 2024
84126e3
Merge branch 'open-webui:main' into installer
justinh-rahb Feb 23, 2024
d950e38
Merge branch 'open-webui:main' into installer
justinh-rahb Feb 23, 2024
ee348e7
Merge branch 'open-webui:main' into installer
justinh-rahb Feb 25, 2024
cdded36
Merge branch 'open-webui:main' into installer
justinh-rahb Mar 4, 2024
26f8b72
Merge branch 'open-webui:main' into installer
justinh-rahb Mar 18, 2024
ff05d23
Merge branch 'open-webui:main' into installer
justinh-rahb Mar 19, 2024
1fd9f3b
Merge branch 'open-webui:main' into installer
justinh-rahb Apr 16, 2024
2869bfb
Refacs
justinh-rahb Apr 16, 2024
501c3f8
More refac
justinh-rahb Apr 16, 2024
be44c3d
Add `--no-ollama` flag
justinh-rahb Apr 16, 2024
13806fa
Add repo clone function and `INSTALL_PATH`
justinh-rahb Apr 16, 2024
ee8a91b
Refac clone function
justinh-rahb Apr 16, 2024
b8285d5
Restore `install_openwebui_docker()`
justinh-rahb Apr 16, 2024
2ed6ccd
Don't exit after Ollama install
justinh-rahb Apr 16, 2024
ecb1cbd
Refac
justinh-rahb Apr 16, 2024
7c91829
`run-ollama-docker.sh` already asks for GPUs
justinh-rahb Apr 16, 2024
0f607b4
Fix path issue
justinh-rahb Apr 16, 2024
ac90019
`git pull` if repo exists
justinh-rahb Apr 16, 2024
7c056f0
`install.sh` bootstrap script
justinh-rahb Apr 16, 2024
25f218a
Deploy `install.sh` to GH Pages
justinh-rahb Apr 16, 2024
30b5d57
Configure Ollama envvars
justinh-rahb Apr 16, 2024
4174683
Add systemd service for WebUI
justinh-rahb Apr 16, 2024
054a4a9
Include systemd service file
justinh-rahb Apr 16, 2024
c92f8f3
Copy `.env.example` to `/etc/open-webui/env` for systemd
justinh-rahb Apr 16, 2024
32caf80
Messages
justinh-rahb Apr 16, 2024
608eb97
Merge branch 'open-webui:main' into installer
justinh-rahb Apr 17, 2024
af72b27
Merge branch 'open-webui:main' into installer
justinh-rahb Apr 27, 2024
06ae271
Merge branch 'open-webui:main' into installer
justinh-rahb May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
162 changes: 162 additions & 0 deletions install-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#!/bin/bash

# Parse command-line arguments for the --no-docker flag
for arg in "$@"
do
case $arg in
--no-docker)
NO_DOCKER=1
shift # Remove --no-docker from processing
;;
*)
# Unknown option
;;
esac
done

# Function to check if Docker is installed
check_docker() {
echo "Checking for Docker..."
if ! command -v docker &> /dev/null; then
echo "Docker could not be found. Would you like to install Docker? (y/n)"
read -r choice
if [ "$choice" = "y" ]; then
install_docker
else
justinh-rahb marked this conversation as resolved.
Show resolved Hide resolved
echo "Docker is required for the Docker-based installation. Proceeding with Docker-less installation."
dockerless_install
exit 0
fi
else
echo "Docker is already installed."
fi
}

# Function to install Docker
install_docker() {
echo "Installing Docker..."
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
sudo docker run --rm hello-world
if [ $? -ne 0 ]; then
echo "Docker installation failed. Please check the error messages above."
exit 1
fi
echo "Docker has been successfully installed."
justinh-rahb marked this conversation as resolved.
Show resolved Hide resolved
}

# Function to install Node.js
install_nodejs() {
echo "Node.js not found. Installing Node.js version 20..."
curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
justinh-rahb marked this conversation as resolved.
Show resolved Hide resolved
}

# Function to install Miniconda for Python
install_miniconda() {
echo "Installing Miniconda for Python dependencies..."
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh
bash miniconda.sh -b -p $HOME/miniconda
source "$HOME/miniconda/etc/profile.d/conda.sh"
conda init
conda create -y -n openwebui python=3.11
conda activate openwebui
}

# Function for Docker-less installation
dockerless_install() {
echo "Starting Docker-less installation..."

# Node.js Installation
if ! command -v node &> /dev/null; then
install_nodejs
fi

# Miniconda and Python Environment Setup
install_miniconda

cp -RPp .env.example .env

if command -v npm &> /dev/null; then
npm install
npm run build
else
echo "npm is not available after Node.js installation. Exiting."
exit 1
fi

cd ./backend
pip install -r requirements.txt -U
sh start.sh
echo "Open WebUI has been installed and started without Docker."
}

# Function to install Open WebUI with Docker
install_openwebui_docker() {
echo "Installing Open WebUI with Docker..."
docker pull ghcr.io/open-webui/open-webui:latest
docker run -d -p 3000:8080 --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:latest
echo "Open WebUI has been installed and started with Docker. Access it at http://localhost:3000"
}

# Main script starts here
echo "Starting the Open WebUI installation script..."

if [ "$NO_DOCKER" -eq 1 ]; then
justinh-rahb marked this conversation as resolved.
Show resolved Hide resolved
echo "Proceeding with Docker-less installation due to --no-docker flag."
dockerless_install
echo "Installation process has completed."
exit 0
fi

# Step 1: Check for Docker
check_docker

# Step 2: Ask about Ollama installation
echo "Would you like to install Ollama inside Docker? (y/n)"
read -r install_ollama

if [ "$install_ollama" = "y" ]; then
# Commands to install Ollama in Docker go here.
echo "Do you want Ollama in Docker with GPU support? (y/n): "
read -r use_gpu
echo "Installing Ollama with Docker..."
if [ "$use_gpu" = "y" ]; then
./run-ollama-docker.sh --enable-gpu
else
./run-ollama-docker.sh
fi
else
# If not installing Ollama, ask about using Docker Compose for both
echo "Would you like to deploy Open WebUI and Ollama together using Docker Compose? (y/n)"
read -r deploy_compose

if [ "$deploy_compose" = "y" ]; then
echo "Enable GPU support? (y/n)"
read -r enable_gpu

compose_cmd="./run-compose.sh"

if [ "$enable_gpu" = "y" ]; then
compose_cmd+=" --enable-gpu"
fi

echo "Running: $compose_cmd"
eval "$compose_cmd"
else
# If not using Docker Compose, install Open WebUI with Docker alone
install_openwebui_docker
fi
fi

echo "Installation process has completed."