3.6 KiB
3.6 KiB
Debian setup script
This repository contains a simple idempotent-ish script to provision a Debian-based machine after a rebuild.
Files
- setup-debian.sh: main script to run (creates/updates ~/.bashrc entries)
- setup-k8s-workspace.sh: configures kubectl context, k9s defaults, and bootstraps Flux to Git
- .env.example: template for Kubernetes workspace environment variables
Usage
- Make the script executable and run it as your user (it will use sudo when needed):
chmod +x ~/setup-debian.sh
~/setup-debian.sh
Optional: set your global Git identity during setup:
GIT_USER_NAME="Your Name" GIT_USER_EMAIL="you@example.com" ~/setup-debian.sh
or run with sudo:
sudo bash ~/setup-debian.sh
What the script does
- Updates apt and installs requested packages (curl, net-tools, ncdu, tmux, htop, nala, neofetch, nfs-common, git, neovim, etc.)
- Installs
snapdand installs Bitwarden via snap - Attempts to detect a unix socket (ssh/bitwarden) and export
SSH_AUTH_SOCKto~/.bashrc - Installs VS Code via snap
- Installs latest
kubectlbinary and enables bash completion + aliases (k) - Installs latest
k9sbinary - Adds a
fgkalias forflux get kustomizations all - Adds arrow-key history search (type prefix then Up/Down)
Notes
- The script attempts to detect a Bitwarden SSH agent socket but may not find it automatically depending on how Bitwarden exposes it; if needed, manually set
SSH_AUTH_SOCKin your shell to the socket path. fluxmust be installed separately if you needfgkto work.
Kubernetes workspace setup
- Ensure
kubectl,k9s, andfluxare installed (the main setup script installs these). - Copy and edit the env template:
cp .env.example .env
- Set values in
.env(default provider isgitea, compatible with Forgejo). - Run the workspace bootstrap script:
chmod +x ./setup-k8s-workspace.sh
./setup-k8s-workspace.sh
Example .env values for Forgejo (FLUX_PROVIDER=gitea):
KUBECONFIG_SOURCE="$HOME/.kube/my-cluster-config" \
KUBE_CONTEXT="my-cluster" \
FLUX_PROVIDER="gitea" \
FLUX_GIT_URL="ssh://git@forgejo.example.com:30222/org/platform-gitops.git" \
FLUX_GIT_BRANCH="main" \
FLUX_GIT_PATH="clusters/my-cluster" \
FLUX_GIT_PRIVATE_KEY_FILE="$HOME/.ssh/id_ed25519" \
./setup-k8s-workspace.sh
Environment variables for setup-k8s-workspace.sh
ENV_FILE(default.env): env file to load before executionKUBECONFIG_SOURCE(optional): source kubeconfig to copy to~/.kube/configKUBE_CONTEXT(optional): context to switch to before checks/bootstrapAPPLY_K9S_CONFIG(defaulttrue): write~/.config/k9s/config.yamlif missingFORCE_K9S_CONFIG(defaultfalse): overwrite existing k9s configFLUX_BOOTSTRAP(defaulttrue): run or skip Flux bootstrapFLUX_PROVIDER(defaultgitea):gitea,forgejo,github, orgitlabFLUX_GIT_BRANCH(defaultmain): branch for Flux manifestsFLUX_GIT_PATH(defaultclusters/<current-context>): path for Flux manifestsFLUX_NAMESPACE(defaultflux-system): Flux namespaceFLUX_GIT_URL(required forgitea/forgejo): repo URL forflux bootstrap gitFLUX_GIT_PRIVATE_KEY_FILE(default~/.ssh/id_ed25519): SSH key forgitea/forgejoFLUX_INSECURE_HOSTKEYS(defaultfalse): pass--insecure-hostkeyforgitea/forgejoFLUX_GITHUB_OWNER,FLUX_GITHUB_REPO(required forgithub)GITHUB_TOKEN(required in environment forgithub)FLUX_GITLAB_HOSTNAME(defaultgitlab.com),FLUX_GITLAB_OWNER,FLUX_GITLAB_REPO(required forgitlab)GITLAB_TOKEN(required in environment forgitlab)