diff --git a/installer.conf b/installer.conf index 2a8032f..7b05a52 100644 --- a/installer.conf +++ b/installer.conf @@ -13,4 +13,5 @@ GROUP="open-webui" # The directory to install into. TARGET_DIR="/opt/open-webui" - +# The python version to use +PYTHON=python3.13 diff --git a/installer.sh b/installer.sh new file mode 100644 index 0000000..43c9659 --- /dev/null +++ b/installer.sh @@ -0,0 +1,46 @@ +#!/usr/bin/bash +# Install open-webui + +# Load the configuration +source ./installer.conf + +# Create the users +echo "Create users and groups" +getent group $GROUP > /dev/null 2&>1 || groupadd $GROUP +getent passwd $USER > /dev/null 2&>1 +if [ $? -ne 0 ]; then + useradd --system -s /usr/bin/nologin -g $GROUP $USER +fi + +# Start with creating the configuration file +echo "Writing configuration files..." +mkdir -p /etc/open-webui +cp open-webui.conf /etc/open-webui +sed -i 's/#TARGET_DIR#/${TARGET_DIR}/g' /etc/open-webui/open-webui.conf + +# Now create the target directory +echo "Creating target directory..." +mkdir -p $TARGET_DIR + +# And populate it +echo "Installing open-webui" +chown $USER:$GROUP $TARGET_DIR +cd $TARGET_DIR +sudo $PYTHON -m venv .venv +sudo -u $USER pip install --upgrade pip +sudo -u $USER pip open-webui +echo "Finished installing open-webui." + +# Now install the script file +echo "Installing the script" +mkdir -p /usr/local/bin +cp ./run-open-webui /usr/local/bin +chmod +x /usr/local/bin/run-open-webui + +# Install the systemd file +echo "Installing the service file" +cp ./open-webui.service /etc/systemd/system +sed -i '/#TARGET_DIR#/${TARGET_DIR}/g' /etc/systemd/system/open-webui.service +sed -i '/#USER#/${USER}/g' /etc/systemd/system/open-webui.service +sed -i '/#GROUP#/${GROUP}/g' /etc/systemd/system/open-webui.service +systemctl daemon-reload