ollama_testing
This commit is contained in:
parent
0105cb2b8a
commit
5c4af6fa02
@ -16,23 +16,21 @@ update_os
|
|||||||
|
|
||||||
msg_info "Installing Dependencies"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y \
|
$STD apt-get install -y \
|
||||||
gpg \
|
gpg \
|
||||||
git \
|
build-essential \
|
||||||
build-essential \
|
pkg-config
|
||||||
pkg-config \
|
|
||||||
cmake
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Installing Golang"
|
# msg_info "Installing Golang"
|
||||||
set +o pipefail
|
# set +o pipefail
|
||||||
temp_file=$(mktemp)
|
# temp_file=$(mktemp)
|
||||||
golang_tarball=$(curl -fsSL https://go.dev/dl/ | grep -oP 'go[\d\.]+\.linux-amd64\.tar\.gz' | head -n 1)
|
# golang_tarball=$(curl -fsSL https://go.dev/dl/ | grep -oP 'go[\d\.]+\.linux-amd64\.tar\.gz' | head -n 1)
|
||||||
curl -fsSL "https://golang.org/dl/${golang_tarball}" -o "$temp_file"
|
# curl -fsSL "https://golang.org/dl/${golang_tarball}" -o "$temp_file"
|
||||||
tar -C /usr/local -xzf "$temp_file"
|
# tar -C /usr/local -xzf "$temp_file"
|
||||||
ln -sf /usr/local/go/bin/go /usr/local/bin/go
|
# ln -sf /usr/local/go/bin/go /usr/local/bin/go
|
||||||
rm -f "$temp_file"
|
# rm -f "$temp_file"
|
||||||
set -o pipefail
|
# set -o pipefail
|
||||||
msg_ok "Installed Golang"
|
# msg_ok "Installed Golang"
|
||||||
|
|
||||||
msg_info "Setting up Intel® Repositories"
|
msg_info "Setting up Intel® Repositories"
|
||||||
mkdir -p /etc/apt/keyrings
|
mkdir -p /etc/apt/keyrings
|
||||||
@ -46,25 +44,42 @@ msg_ok "Set up Intel® Repositories"
|
|||||||
msg_info "Setting Up Hardware Acceleration"
|
msg_info "Setting Up Hardware Acceleration"
|
||||||
$STD apt-get -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools,intel-level-zero-gpu,level-zero,level-zero-dev}
|
$STD apt-get -y install {va-driver-all,ocl-icd-libopencl1,intel-opencl-icd,vainfo,intel-gpu-tools,intel-level-zero-gpu,level-zero,level-zero-dev}
|
||||||
if [[ "$CTTYPE" == "0" ]]; then
|
if [[ "$CTTYPE" == "0" ]]; then
|
||||||
chgrp video /dev/dri
|
chgrp video /dev/dri
|
||||||
chmod 755 /dev/dri
|
chmod 755 /dev/dri
|
||||||
chmod 660 /dev/dri/*
|
chmod 660 /dev/dri/*
|
||||||
$STD adduser $(id -u -n) video
|
$STD adduser $(id -u -n) video
|
||||||
$STD adduser $(id -u -n) render
|
$STD adduser $(id -u -n) render
|
||||||
fi
|
fi
|
||||||
msg_ok "Set Up Hardware Acceleration"
|
msg_ok "Set Up Hardware Acceleration"
|
||||||
|
|
||||||
msg_info "Installing Intel® oneAPI Base Toolkit (Patience)"
|
msg_info "Installing Intel® oneAPI Base Toolkit (Patience)"
|
||||||
$STD apt-get install -y --no-install-recommends intel-basekit-2024.1
|
$STD apt-get install -y intel-basekit-2025.1
|
||||||
msg_ok "Installed Intel® oneAPI Base Toolkit"
|
msg_ok "Installed Intel® oneAPI Base Toolkit"
|
||||||
|
|
||||||
msg_info "Installing Ollama (Patience)"
|
msg_info "Installing Ollama (Patience)"
|
||||||
$STD git clone https://github.com/ollama/ollama.git /opt/ollama
|
ARCH=$(uname -m)
|
||||||
cd /opt/ollama
|
OLLAMA_INSTALL_DIR="/usr/local/lib/ollama"
|
||||||
$STD go generate ./...
|
BINDIR="/usr/local/bin"
|
||||||
$STD go build .
|
mkdir -p "$OLLAMA_INSTALL_DIR"
|
||||||
|
curl --fail --show-error --location --progress-bar \
|
||||||
|
"https://ollama.com/download/ollama-linux-${ARCH}.tgz${OLLAMA_VERSION:+?version=$OLLAMA_VERSION}" |
|
||||||
|
tar -xzf - -C "$OLLAMA_INSTALL_DIR"
|
||||||
|
ln -sf "$OLLAMA_INSTALL_DIR/ollama" "$BINDIR/ollama"
|
||||||
|
#$STD git clone https://github.com/ollama/ollama.git /opt/ollama
|
||||||
|
#cd /opt/ollama
|
||||||
|
#$STD go generate ./...
|
||||||
|
#$STD go build .
|
||||||
msg_ok "Installed Ollama"
|
msg_ok "Installed Ollama"
|
||||||
|
|
||||||
|
msg_info "Creating ollama User and Group"
|
||||||
|
if ! id ollama >/dev/null 2>&1; then
|
||||||
|
useradd -r -s /usr/sbin/nologin -U -m -d /usr/share/ollama ollama
|
||||||
|
fi
|
||||||
|
$STD usermod -aG render ollama || true
|
||||||
|
$STD usermod -aG video ollama || true
|
||||||
|
$STD usermod -aG ollama $(id -u -n)
|
||||||
|
msg_ok "Created ollama User and adjusted Groups"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/ollama.service
|
cat <<EOF >/etc/systemd/system/ollama.service
|
||||||
[Unit]
|
[Unit]
|
||||||
@ -73,7 +88,7 @@ After=network-online.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=exec
|
Type=exec
|
||||||
ExecStart=/opt/ollama/ollama serve
|
ExecStart=/usr/local/bin/ollama serve
|
||||||
Environment=HOME=$HOME
|
Environment=HOME=$HOME
|
||||||
Environment=OLLAMA_INTEL_GPU=true
|
Environment=OLLAMA_INTEL_GPU=true
|
||||||
Environment=OLLAMA_HOST=0.0.0.0
|
Environment=OLLAMA_HOST=0.0.0.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user