From d294a11bc9d7e7094870698173e152c32758e63c Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 25 Sep 2023 16:11:21 -0700 Subject: [PATCH 1/3] start service on exit instead of immediately --- scripts/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 82eca656..dbc5ff6a 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -92,7 +92,9 @@ EOF status "Enabling and starting ollama service..." $SUDO systemctl daemon-reload $SUDO systemctl enable ollama - $SUDO systemctl restart ollama + + start_service() { $SUDO systemctl restart ollama; } + trap start_service EXIT ;; esac } From d5ad41dd7b95434d313695d48951e01ce0558414 Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 25 Sep 2023 17:56:25 -0700 Subject: [PATCH 2/3] fix path for wsl user --- scripts/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install.sh b/scripts/install.sh index dbc5ff6a..2c713d40 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -82,6 +82,7 @@ Group=ollama Restart=always RestartSec=3 Environment="HOME=/usr/share/ollama" +Environment="PATH=$PATH" [Install] WantedBy=default.target From 5e388f931e4b30a911ee5fe49421e89f6c5f81bb Mon Sep 17 00:00:00 2001 From: Michael Yang Date: Mon, 25 Sep 2023 17:56:43 -0700 Subject: [PATCH 3/3] check cuda installed before installing --- scripts/install.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index 2c713d40..ba2e8853 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -117,6 +117,11 @@ check_gpu() { esac } +if check_gpu nvidia-smi; then + status "NVIDIA GPU installed." + exit 0 +fi + if ! check_gpu lspci && ! check_gpu lshw; then warning "No NVIDIA GPU detected. Ollama will run in CPU-only mode." exit 0 @@ -228,3 +233,6 @@ if ! lsmod | grep -q nvidia; then $SUDO modprobe nvidia fi + + +status "NVIDIA GPU installed."