From 407571e18d25bfea164354957199964b7d25866f Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 15 Aug 2023 11:49:17 -0600 Subject: [PATCH] Add debian setup script (#501) * Adapt install script to Debian * Update docs for new scipt name * Add reference to dockerco install doc --- README.md | 2 +- docs/laconicd-fixturenet.md | 2 +- ...stall-ubuntu.sh => quick-install-linux.sh} | 39 +++++++++++++++++-- 3 files changed, 37 insertions(+), 6 deletions(-) rename scripts/{quick-install-ubuntu.sh => quick-install-linux.sh} (79%) diff --git a/README.md b/README.md index 4f490d8c..8dd6f041 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Stack Orchestrator allows building and deployment of a Laconic Stack on a single ## Install -**To get started quickly** on a fresh Ubuntu instance (e.g, Digital Ocean); [try this script](./scripts/quick-install-ubuntu.sh). **WARNING:** always review scripts prior to running them so that you know what is happening on your machine. +**To get started quickly** on a fresh Ubuntu instance (e.g, Digital Ocean); [try this script](./scripts/quick-install-linux.sh). **WARNING:** always review scripts prior to running them so that you know what is happening on your machine. For any other installation, follow along below and **adapt these instructions based on the specifics of your system.** diff --git a/docs/laconicd-fixturenet.md b/docs/laconicd-fixturenet.md index b2375b16..79a6336a 100644 --- a/docs/laconicd-fixturenet.md +++ b/docs/laconicd-fixturenet.md @@ -23,7 +23,7 @@ ssh root@IP 2. Get the install script, give it executable permissions, and run it: ``` -curl -o install.sh https://raw.githubusercontent.com/cerc-io/stack-orchestrator/main/scripts/quick-install-ubuntu.sh +curl -o install.sh https://raw.githubusercontent.com/cerc-io/stack-orchestrator/main/scripts/quick-install-linux.sh ``` ``` chmod +x install.sh diff --git a/scripts/quick-install-ubuntu.sh b/scripts/quick-install-linux.sh similarity index 79% rename from scripts/quick-install-ubuntu.sh rename to scripts/quick-install-linux.sh index e28c2052..4f4d044b 100755 --- a/scripts/quick-install-ubuntu.sh +++ b/scripts/quick-install-linux.sh @@ -28,12 +28,28 @@ fi # Check python3 is available # Check machine resources are sufficient +# Determine if we are on Debian or Ubuntu +linux_distro=$(lsb_release -a 2>/dev/null | grep "^Distributor ID:" | cut -f 2) +case $linux_distro in + Debian) + echo "Installing docker for Debian" + ;; + Ubuntu) + echo "Installing docker for Ubuntu" + ;; + *) + echo "ERROR: Detected unknown distribution $linux_distro, can't install docker" + exit 1 + ;; +esac + # dismiss the popups export DEBIAN_FRONTEND=noninteractive ## https://docs.docker.com/engine/install/ubuntu/ +## https://docs.docker.com/engine/install/debian/ ## https://superuser.com/questions/518859/ignore-packages-that-are-not-currently-installed-when-using-apt-get-remove1 -packages_to_remove="docker docker-engine docker.io containerd runc" +packages_to_remove="docker docker-engine docker.io containerd runc docker-compose docker-doc podman-docker" installed_packages_to_remove="" for package_to_remove in $(echo $packages_to_remove); do $(dpkg --info $package_to_remove &> /dev/null) @@ -65,10 +81,25 @@ sudo apt -y install curl sudo apt -y install ca-certificates gnupg # Add dockerco package repository -sudo mkdir -m 0755 -p /etc/apt/keyrings -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +# For reasons not obvious, the dockerco instructions for installation on +# Debian and Ubuntu are slightly different here +case $linux_distro in + Debian) + sudo install -m 0755 -d /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + sudo chmod a+r /etc/apt/keyrings/docker.gpg + ;; + Ubuntu) + sudo mkdir -m 0755 -p /etc/apt/keyrings + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg + ;; + *) + echo "ERROR: Detected unknown distribution $linux_distro, can't install docker" + exit 1 + ;; +esac echo \ - "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/${linux_distro,,} \ "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null