Merge pull request #596 from jmorganca/mxyng/install.sh

update install.sh
This commit is contained in:
Michael Yang 2023-09-25 17:59:13 -07:00 committed by GitHub
commit 110ae89a6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,6 +82,7 @@ Group=ollama
Restart=always Restart=always
RestartSec=3 RestartSec=3
Environment="HOME=/usr/share/ollama" Environment="HOME=/usr/share/ollama"
Environment="PATH=$PATH"
[Install] [Install]
WantedBy=default.target WantedBy=default.target
@ -92,7 +93,9 @@ EOF
status "Enabling and starting ollama service..." status "Enabling and starting ollama service..."
$SUDO systemctl daemon-reload $SUDO systemctl daemon-reload
$SUDO systemctl enable ollama $SUDO systemctl enable ollama
$SUDO systemctl restart ollama
start_service() { $SUDO systemctl restart ollama; }
trap start_service EXIT
;; ;;
esac esac
} }
@ -114,6 +117,11 @@ check_gpu() {
esac esac
} }
if check_gpu nvidia-smi; then
status "NVIDIA GPU installed."
exit 0
fi
if ! check_gpu lspci && ! check_gpu lshw; then if ! check_gpu lspci && ! check_gpu lshw; then
warning "No NVIDIA GPU detected. Ollama will run in CPU-only mode." warning "No NVIDIA GPU detected. Ollama will run in CPU-only mode."
exit 0 exit 0
@ -225,3 +233,6 @@ if ! lsmod | grep -q nvidia; then
$SUDO modprobe nvidia $SUDO modprobe nvidia
fi fi
status "NVIDIA GPU installed."