Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
ed94a3dd
Unverified
Commit
ed94a3dd
authored
Sep 25, 2023
by
Michael Yang
Committed by
GitHub
Sep 25, 2023
Browse files
Merge pull request #589 from jmorganca/mxyng/install.sh
update install.sh
parents
0fb52684
f14f62ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
11 deletions
+21
-11
scripts/install.sh
scripts/install.sh
+21
-11
No files found.
scripts/install.sh
View file @
ed94a3dd
...
@@ -35,7 +35,7 @@ SUDO=
...
@@ -35,7 +35,7 @@ SUDO=
if
[
"
$(
id
-u
)
"
-ne
0
]
;
then
if
[
"
$(
id
-u
)
"
-ne
0
]
;
then
# Running as root, no need for sudo
# Running as root, no need for sudo
if
!
command
-v
sudo
>
/dev/null
;
then
if
!
command
-v
sudo
>
/dev/null
;
then
error
"
Ollama install.sh requires elevated privilege
s. Please re-run as root."
error
"
This script requires superuser permission
s. Please re-run as root."
fi
fi
SUDO
=
"sudo"
SUDO
=
"sudo"
...
@@ -43,7 +43,11 @@ fi
...
@@ -43,7 +43,11 @@ fi
MISSING_TOOLS
=
$(
required_tools curl
awk grep sed tee
xargs
)
MISSING_TOOLS
=
$(
required_tools curl
awk grep sed tee
xargs
)
if
[
-n
"
$MISSING_TOOLS
"
]
;
then
if
[
-n
"
$MISSING_TOOLS
"
]
;
then
error
"The following tools are required but missing:
$MISSING_TOOLS
"
status
"ERROR: The following tools are required but missing:"
for
MISSING_TOOL
in
$MISSING_TOOLS
;
do
echo
" -
$MISSING_TOOL
"
done
exit
1
fi
fi
status
"Downloading ollama..."
status
"Downloading ollama..."
...
@@ -81,12 +85,15 @@ Environment="HOME=/usr/share/ollama"
...
@@ -81,12 +85,15 @@ Environment="HOME=/usr/share/ollama"
[Install]
[Install]
WantedBy=default.target
WantedBy=default.target
EOF
EOF
if
[
"
$(
systemctl is-system-running
||
echo
'not running'
)
"
=
'running'
]
;
then
SYSTEMCTL_RUNNING
=
"
$(
systemctl is-system-running
)
"
status
"Enabling and starting ollama service..."
case
$SYSTEMCTL_RUNNING
in
$SUDO
systemctl daemon-reload
running|degraded
)
$SUDO
systemctl
enable
ollama
status
"Enabling and starting ollama service..."
$SUDO
systemctl restart ollama
$SUDO
systemctl daemon-reload
fi
$SUDO
systemctl
enable
ollama
$SUDO
systemctl restart ollama
;;
esac
}
}
if
command
-v
systemctl
>
/dev/null
;
then
if
command
-v
systemctl
>
/dev/null
;
then
...
@@ -118,7 +125,7 @@ install_cuda_driver_yum() {
...
@@ -118,7 +125,7 @@ install_cuda_driver_yum() {
$SUDO
$PACKAGE_MANAGER
-config-manager
--add-repo
https://developer.download.nvidia.com/compute/cuda/repos/
$1$2
/
$(
uname
-m
)
/cuda-
$1$2
.repo
$SUDO
$PACKAGE_MANAGER
-config-manager
--add-repo
https://developer.download.nvidia.com/compute/cuda/repos/
$1$2
/
$(
uname
-m
)
/cuda-
$1$2
.repo
;;
;;
dnf
)
dnf
)
$SUDO
dnf
config-manager
--add-repo
https://developer.download.nvidia.com/compute/cuda/repos/
$1$2
/
$(
uname
-m
)
/cuda-
$1$2
.repo
$SUDO
$PACKAGE_MANAGER
config-manager
--add-repo
https://developer.download.nvidia.com/compute/cuda/repos/
$1$2
/
$(
uname
-m
)
/cuda-
$1$2
.repo
;;
;;
esac
esac
...
@@ -156,7 +163,9 @@ install_cuda_driver_apt() {
...
@@ -156,7 +163,9 @@ install_cuda_driver_apt() {
status
'Installing CUDA driver...'
status
'Installing CUDA driver...'
$SUDO
dpkg
-i
$TEMP_DIR
/cuda-keyring.deb
$SUDO
dpkg
-i
$TEMP_DIR
/cuda-keyring.deb
$SUDO
apt-get update
$SUDO
apt-get update
$SUDO
DEBIAN_FRONTEND
=
noninteractive apt-get
-y
install
cuda-drivers
-q
[
-n
"
$SUDO
"
]
&&
SUDO_E
=
"
$SUDO
-E"
||
SUDO_E
=
DEBIAN_FRONTEND
=
noninteractive
$SUDO_E
apt-get
-y
install
cuda-drivers
-q
}
}
if
[
!
-f
"/etc/os-release"
]
;
then
if
[
!
-f
"/etc/os-release"
]
;
then
...
@@ -184,7 +193,8 @@ if ! check_gpu nvidia-smi || [ -z "$(nvidia-smi | grep -o "CUDA Version: [0-9]*\
...
@@ -184,7 +193,8 @@ if ! check_gpu nvidia-smi || [ -z "$(nvidia-smi | grep -o "CUDA Version: [0-9]*\
centos|rhel
)
install_cuda_driver_yum
'rhel'
$OS_VERSION
;;
centos|rhel
)
install_cuda_driver_yum
'rhel'
$OS_VERSION
;;
rocky
)
install_cuda_driver_yum
'rhel'
$(
echo
$OS_VERSION
|
cut
-c1
)
;;
rocky
)
install_cuda_driver_yum
'rhel'
$(
echo
$OS_VERSION
|
cut
-c1
)
;;
fedora
)
install_cuda_driver_dnf
$OS_NAME
$OS_VERSION
;;
fedora
)
install_cuda_driver_dnf
$OS_NAME
$OS_VERSION
;;
debian|ubuntu
)
install_cuda_driver_apt
$OS_NAME
$OS_VERSION
;;
debian
)
install_cuda_driver_apt
$OS_NAME
$OS_VERSION
;;
ubuntu
)
install_cuda_driver_apt
$OS_NAME
$(
echo
$OS_VERSION
|
sed
's/\.//'
)
;;
esac
esac
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment