|
#!/bin/bash |
|
|
|
prompt(){ |
|
# prompt user |
|
printf "\n" |
|
echo -n "$1" |
|
} |
|
|
|
get_response(){ |
|
# get user input |
|
local response |
|
read response |
|
|
|
# determine action |
|
case $response in |
|
$2) |
|
# execute function |
|
$1 |
|
;; |
|
*) |
|
# do nothing |
|
: |
|
;; |
|
esac |
|
|
|
# optional return |
|
if $3; then |
|
echo "$response" |
|
fi |
|
} |
|
|
|
install_tools(){ |
|
# notify user |
|
echo ">>> installing packages: $@" |
|
sudo apt-get update && sudo apt-get install -y "$@" |
|
} |
|
|
|
# getting necessary system packages with apt-get |
|
setup_common_tools(){ |
|
# now install |
|
install_tools curl htop git gnupg lm-sensors make tree xclip xsel |
|
} |
|
|
|
# setting up tmux |
|
setup_tmux(){ |
|
install_tools git tmux && \ |
|
cd && \ |
|
git clone https://github.com/RagingTiger/.tmux.git && \ |
|
ln -s -f .tmux/.tmux.conf && \ |
|
cp .tmux/.tmux.conf.local . |
|
} |
|
|
|
# install gopass |
|
setup_gopass(){ |
|
# create string for gopass sources entry |
|
local gopass_sources=$(printf '%s\n' \ |
|
"Types: deb" \ |
|
"URIs: https://packages.gopass.pw/repos/gopass" \ |
|
"Suites: stable" \ |
|
"Architectures: all amd64 arm64 armhf" \ |
|
"Components: main" \ |
|
"Signed-By: /usr/share/keyrings/gopass-archive-keyring.gpg" |
|
) |
|
|
|
# get dependencies |
|
install_tools curl gnupg && \ |
|
|
|
# setup and install |
|
curl https://packages.gopass.pw/repos/gopass/gopass-archive-keyring.gpg | \ |
|
sudo tee /usr/share/keyrings/gopass-archive-keyring.gpg >/dev/null && \ |
|
echo "${gopass_sources}" | sudo tee /etc/apt/sources.list.d/gopass.sources && \ |
|
install_tools gopass gopass-archive-keyring |
|
} |
|
|
|
# installing docker |
|
setup_docker(){ |
|
# install prerequisite tools for docker |
|
install_tools ca-certificates curl gnupg && \ |
|
|
|
# add Docker’s official GPG key |
|
sudo install -m 0755 -d /etc/apt/keyrings && \ |
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \ |
|
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && \ |
|
sudo chmod a+r /etc/apt/keyrings/docker.gpg && \ |
|
|
|
# set up the Docker repository |
|
echo \ |
|
"deb [arch="$(dpkg --print-architecture)" \ |
|
signed-by=/etc/apt/keyrings/docker.gpg] \ |
|
https://download.docker.com/linux/ubuntu \ |
|
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ |
|
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \ |
|
|
|
# install Docker Engine, containerd, and Docker Compose. |
|
install_tools \ |
|
docker-ce \ |
|
docker-ce-cli \ |
|
containerd.io \ |
|
docker-buildx-plugin \ |
|
docker-compose-plugin && \ |
|
|
|
# confirm install: https://docs.docker.com/engine/install/linux-postinstall/ |
|
sudo groupadd docker |
|
sudo usermod -aG docker $USER |
|
newgrp docker |
|
docker run hello-world |
|
} |
|
|
|
setup_nvidia_container_toolkit(){ |
|
# get dependencies |
|
install_tools curl gnupg && \ |
|
|
|
# check for docker |
|
if ! which docker > /dev/null; then |
|
setup_docker |
|
fi && \ |
|
|
|
# setup the package repository and the GPG key |
|
local distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && \ |
|
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | \ |
|
sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && \ |
|
curl -s -L https://nvidia.github.io/libnvidia-container/$distribution/libnvidia-container.list | \ |
|
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ |
|
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && \ |
|
|
|
# now install toolkit |
|
install_tools nvidia-container-toolkit && \ |
|
|
|
# now configure Docker daemon to recognize the NVIDIA Container Runtime |
|
sudo nvidia-ctk runtime configure --runtime=docker && \ |
|
|
|
# restart the Docker daemon to complete the installation |
|
sudo systemctl restart docker && \ |
|
|
|
# test by running a CUDA container: |
|
sudo docker run \ |
|
--rm \ |
|
--runtime=nvidia \ |
|
--gpus all \ |
|
nvidia/cuda:11.6.2-base-ubuntu20.04 \ |
|
nvidia-smi |
|
} |
|
|
|
# install snaps template |
|
install_snaps(){ |
|
sudo snap install $1 $2 |
|
} |
|
|
|
# getting snaps |
|
setup_snaps(){ |
|
install_snaps atom --classic |
|
install_snaps indicator-sensors |
|
install_snaps kdenlive |
|
install_snaps rpi-imager |
|
} |
|
|
|
# install Kinto |
|
setup_kinto(){ |
|
/bin/bash -c "$(wget -qO- https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh || \ |
|
curl -fsSL https://raw.githubusercontent.com/rbreaves/kinto/HEAD/install/linux.sh)" |
|
} |
|
|
|
# for a procedural/interactive install/config UI |
|
interactive_config(){ |
|
# get common tools |
|
prompt "Would you like to install common tools? [Y/n]: " |
|
get_response setup_common_tools 'Y' false |
|
|
|
# get Tmux |
|
prompt "Would you like to install Tmux? [Y/n]: " |
|
get_response setup_tmux 'Y' false |
|
|
|
# get GoPass |
|
prompt "Would you like to install GoPass? [Y/n]: " |
|
get_response setup_gopass 'Y' false |
|
|
|
# get Docker |
|
prompt "Would you like to install Docker? [Y/n]: " |
|
get_response setup_docker 'Y' false |
|
|
|
# get NVIDIA Container Toolkit |
|
prompt "Would you like to install NVIDIA Container Toolkit? [Y/n]: " |
|
get_response setup_nvidia_container_toolkit 'Y' false |
|
|
|
# setup Ubuntu Snaps |
|
prompt "Would you like to install Snaps? [Y/n]: " |
|
get_response setup_snaps 'Y' false |
|
|
|
# setup Kinto for keyboard |
|
prompt "Would you like to install Kinto? [Y/n]: " |
|
get_response setup_kinto 'Y' false |
|
|
|
# now exit |
|
exit |
|
} |
|
|
|
# for a non-interactive install/config UI |
|
automated_config(){ |
|
# run all setup functions |
|
setup_common_tools |
|
setup_tmux |
|
setup_gopass |
|
setup_docker |
|
setup_nvidia_container_toolkit |
|
setup_snaps |
|
setup_kinto |
|
|
|
# now exit |
|
exit |
|
} |
|
|
|
# executable section |
|
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then |
|
# prompt user for interactive mode |
|
prompt "Would you like to run an interactive configuration? [Y/n]: " |
|
get_response interactive_config 'Y' false |
|
|
|
# check for automatic mode |
|
prompt "Would you like to run the entire configuration? [Y/n]: " |
|
get_response automated_config 'Y' false |
|
fi |
Ubuntu 24.04: Kinto Problems Thread
This comment is to track the issues I have encountered with installing
kinto
on Ubuntu 24.04.Install Output
References