|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# ----------------------------------------------------------------------------- |
| 4 | +# Description: This script installs locally all the necessary packages for |
| 5 | +# running the ci-e2e.sh and related cleanup processes locally. |
| 6 | +# These installations work for linux amd64, at least on Ubuntu |
| 7 | +# 24.04. |
| 8 | +# NOTE: you may need to log out and back in to apply all changes |
| 9 | +# Usage: This script is usually ran from `make e2e-prerequisites`, but can |
| 10 | +# be used separately with GO_VERSION=1.24.7 ./e2e-prerequisites.sh. |
| 11 | +# GO_VERSION can be set separately as well. |
| 12 | +# ----------------------------------------------------------------------------- |
| 13 | + |
| 14 | +USR_LOCAL_BIN="/usr/local/bin" |
| 15 | +MINIMUM_KUBECTL_VERSION=v1.28.1 |
| 16 | +YQ_VERSION="v4.40.5" |
| 17 | +GO_VERSION="${GO_VERSION:-"1.24.7"}" |
| 18 | + |
| 19 | +echo "INSTALLING some core packages" |
| 20 | +sudo apt-get install build-essential tar |
| 21 | +echo "INSTALLING go, removing old versions" |
| 22 | +sudo rm -rf /usr/local/go |
| 23 | +wget -P $HOME https://go.dev/dl/go$GO_VERSION.linux-amd64.tar.gz |
| 24 | +sudo tar -C /usr/local -xzf $HOME/go$GO_VERSION.linux-amd64.tar.gz |
| 25 | +echo "EXPORTING go bin path, optionally add to .bashrc or .profile" |
| 26 | +export PATH="${PATH}:/usr/local/go/bin" |
| 27 | +go version |
| 28 | +type go |
| 29 | +sudo apt-get update |
| 30 | +echo "INSTALLING libvirt, qemu and related packages" |
| 31 | +sudo apt-get install -y libvirt-daemon-system qemu-kvm virt-manager libvirt-dev |
| 32 | +make build |
| 33 | +echo "INSTALLING kubectl, assuming no previous version exists and curl is \ |
| 34 | +version 7.73.0 or later" |
| 35 | +curl --create-dirs -LO --output-dir $HOME "https://dl.k8s.io/release/${MINIMUM_KUBECTL_VERSION}/bin/linux/amd64/kubectl" |
| 36 | +sudo install $HOME/kubectl "${USR_LOCAL_BIN}/kubectl" |
| 37 | +echo "INSTALLING yq, assuming no previous version exists" |
| 38 | +go install github.com/mikefarah/yq/v4@$YQ_VERSION |
| 39 | +echo "INSTALLING docker and related, removing old versions of docker" |
| 40 | +echo "ADDING repository to apt sources, GPG key, and other changes" |
| 41 | +for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done |
| 42 | +sudo apt-get update |
| 43 | +sudo apt-get install ca-certificates |
| 44 | +sudo install -m 0755 -d /etc/apt/keyrings |
| 45 | +sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc |
| 46 | +sudo chmod a+r /etc/apt/keyrings/docker.asc |
| 47 | +echo \ |
| 48 | + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ |
| 49 | + $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \ |
| 50 | + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null |
| 51 | +sudo apt-get update |
| 52 | +sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
| 53 | +sudo chmod 777 /var/run/docker.sock |
| 54 | +sudo usermod -aG docker $USER |
| 55 | +newgrp docker |
0 commit comments