scripts/build.homelab.md
2025-05-30 13:14:16 -06:00

18 KiB
Raw Permalink Blame History

tags, author, date
tags author date
homelab
script
The Bunker Admin 2025-04-28
## build.homelab

The following is build instructions for The Bunker Operations home lab. See the following for further instructions following installation:


[!info] Update Variables

When using this build guide, remember to check each command for [insert] tags. Not all locations have comments or history; you will have to check commands.

Ubuntu OS

Ubuntu is a Linux distribution derived from Debian and composed mostly of free and open-source software.

Install Ubuntu

Post Install

Post installation, run update:

sudo apt update
sudo apt upgrade

config.drives.homelab

Configure drives for auto mounting on boot.

VSCode Insiders

Visual Studio Code is a new choice of tool that combines the simplicity of a code editor with what developers need for the core edit-build-debug cycle.

Install Using App Centre

!scripts/sreenshots/Pasted image 20250429113606.png

Obsidian

The free and flexible app for your private thoughts.

Install Using App Center

!scripts/sreenshots/Pasted image 20250429113550.png

Curl

command line tool and library for transferring data with URLs (since 1998)

Install

sudo apt install curl 

Python & Pip & pipx

Python is a programming language that lets you work quickly and integrate systems more effectively.

sudo apt install python3-pip
sudo apt install pipx
pipx ensurepath

Glances

Glances an Eye on your system. A top/htop alternative for GNU/Linux, BSD, Mac OS and Windows operating systems.

Install

pipx install glances[all]

[!note] Start Glances To start glances run the following:

/home/bunker-admin/.local/bin/glances

ffmpeg

A complete, cross-platform solution to record, convert and stream audio and video.

sudo apt update && sudo apt install ffmpeg

Flatpack

Whether you're a user looking for apps or a developer looking to reach more users, Flathub is the best choice for apps on Linux.

sudo apt install flatpak
sudo apt install gnome-software-plugin-flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo

Syncthing

Syncthing is a continuous file synchronization program. It synchronizes files between two or more computers in real time, safely protected from prying eyes. Your data is your data alone and you deserve to choose where it is stored, whether it is shared with some third party, and how its transmitted over the internet.

Install

sudo mkdir -p /etc/apt/keyrings
curl -s https://syncthing.net/release-key.gpg | sudo gpg --dearmor -o /etc/apt/keyrings/syncthing-archive-keyring.gpg
echo "deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable" | sudo tee /etc/apt/sources.list.d/syncthing.list
sudo apt-get update && sudo apt-get install syncthing

Post Install

Run syncthing as a system service.

sudo systemctl start syncthing@[insert user]
sudo systemctl enable syncthing@[insert user]

Docker

Docker helps developers build, share, run, and verify applications anywhere — without tedious environment configuration or management.

[!warning] Docker Desktop On Ubuntu or other linux based operating systems, it is recommend by The Bunker Admin to avoid using Docker Desktop. At this time, Docker Desktop is not reliable for use on Ubuntu.

For a GUI experience in managing Docker, it is recommend to install the docker extension in VSCode.

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Update Users

sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

Enable on Boot

sudo systemctl enable docker.service
sudo systemctl enable containerd.service

Cloudflared

Connect, protect, and build everywhere. We make websites, apps, and networks faster and more secure. Our developer platform is the best place to build modern apps and deliver AI initiatives.

curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloudflare-main.gpg
echo "deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg arch=amd64] https://pkg.cloudflare.com/cloudflared any main" | sudo tee /etc/apt/sources.list.d/cloudflared.list
sudo apt-get update && sudo apt-get install cloudflared

Post Install

Login to Cloudflare

cloudflared login

Configuration

  • Setting up the service.cloudflared enables your cloudflared tunnel to automatically run on reboot

Pandoc

If you need to convert files from one markup format into another, pandoc is your swiss-army knife.

sudo apt install pandoc

Openwebui

Open WebUI is an extensible, feature-rich, and user-friendly self-hosted AI platform designed to operate entirely offline. It supports various LLM runners like Ollama and OpenAI-compatible APIs, with built-in inference engine for RAG, making it a powerful AI deployment solution.

[!info] Openwebui & Ollama Recommended to install ollama and openwebui seperately. Following next step in this guide for the Ollama set up, including the service.ollama, should get you up and running.

[!check] The next command uses a cuda configuration. You may need to install the nvidia toolkit to make this work on a ubuntu machine.

docker run -d -p 3002:8080 --gpus all --add-host=host.docker.internal:host-gateway -v open-webui:/app/backend/data --name open-webui --restart always ghcr.io/open-webui/open-webui:cuda

Ollama

Get up and running with large language models.

curl -fsSL https://ollama.com/install.sh | sh

See service.ollama for more information on set-up, including getting system online & a suite of models for local dev.

Steam

Steam is a gaming platform

Install from app center

!scripts/sreenshots/Pasted image 20250429113523.png

Immich

Self-hosted photo and video management solution.

[!info] Dedicated Drive Installing Immich on a dedicated drive with ample room for your photo is the recommend approach. Instead of trying to rebuild Immich on fresh installs, a persistent drive can be migrated across machines.

Docker compose installation instructions

Plex

Meet your TV concierge.

Visit plex download page and download appropriate image. On most Ubuntu machines this will be the 64bit version.

!scripts/sreenshots/Pasted image 20250430132109.png

Right click the downloaded .deb and run with software installer.

Media Stack

The media stack install is getting it's own manual at build.mediastack.

scrpy

Display and control your Android device.

# for Debian/Ubuntu
sudo apt install ffmpeg libsdl2-2.0-0 adb wget \ gcc git pkg-config meson ninja-build libsdl2-dev \ libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \ libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
git clone https://github.com/Genymobile/scrcpy
cd scrcpy
./install_release.sh

Portainer

Portainer is a universal container management platform

docker volume create portainer_data
docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:lts

Signal

Speak Freely. Say "hello" to a different messaging experience. An unexpected focus on privacy, combined with all of the features you expect. Installation through the app center requires flatpack to be installed

wget -O- https://updates.signal.org/desktop/apt/keys.asc | gpg --dearmor > signal-desktop-keyring.gpg
cat signal-desktop-keyring.gpg | sudo tee /usr/share/keyrings/signal-desktop-keyring.gpg > /dev/null
echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/signal-desktop-keyring.gpg] https://updates.signal.org/desktop/apt xenial main' |\
  sudo tee /etc/apt/sources.list.d/signal-xenial.list
sudo apt update && sudo apt install signal-desktop

VLC

VLC is a free and open source cross-platform multimedia player and framework that plays most multimedia files as well as DVDs, Audio CDs, VCDs, and various streaming protocols.

sudo apt-get install vlc

Spotify

Spotify is a music streaming service.

curl -sS https://download.spotify.com/debian/pubkey_C85668DF69375001.gpg | sudo gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg  
echo "deb https://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
sudo apt-get update && sudo apt-get install spotify-client

Kdenlive

Free and Open Source Video Editor. Kdenlive is the acronym for KDE Non-Linear Video Editor. It works on Linux, Windows, macOS, and BSD.

Install using App Centre

OBS

Free and open source software for video recording and live streaming.

Install Using App Centre

Mkdocs-material

pipx install mkdocs-material --include-deps

Chrome

flatpak install flathub com.google.Chrome -y

Espanso

Espanso is a cross-platform Text Expander written in Rust. It detects when you type a keyword and replaces it with another text snippet, improving your productivity and reducing repetitive typing.

Note: The standard .deb package may have dependency issues on Ubuntu 24.04. Use the AppImage method for best compatibility.

Install FUSE (required for AppImage)

sudo apt install fuse libfuse2

Download and setup Espanso AppImage

wget https://github.com/espanso/espanso/releases/download/v2.2.1/espanso-debian-x11-amd64.AppImage -O ~/espanso.AppImage
chmod +x ~/espanso.AppImage

Register and start the service

~/espanso.AppImage env-path register
~/espanso.AppImage start

Create system-wide access (optional)

sudo ln -s ~/espanso.AppImage /usr/local/bin/espanso

Nerd Dictation

Offline speech recognition using Vosk for privacy-focused dictation on Linux. Works entirely offline without sending data to external services.

Install Required Audio Components

# Install PulseAudio utilities (includes parec)
sudo apt update
sudo apt install pulseaudio-utils alsa-utils portaudio19-dev

# Install xdotool for keyboard simulation
sudo apt install xdotool

Install Python Dependencies

# Install pipx if not already available
sudo apt install pipx

# Create virtual environment for vosk
python3 -m venv ~/venv-dictation
source ~/venv-dictation/bin/activate

# Install vosk in virtual environment
pip install vosk

Download and Setup Nerd Dictation

# Clone the repository
git clone https://github.com/ideasman42/nerd-dictation.git
cd nerd-dictation

# Download speech model
wget https://alphacephei.com/kaldi/models/vosk-model-small-en-us-0.15.zip
unzip vosk-model-small-en-us-0.15.zip
mv vosk-model-small-en-us-0.15 model

Start PulseAudio (if not running)

# Check if PulseAudio is running
pulseaudio --check -v

# If not running, start it
pulseaudio --start

Usage

# Activate virtual environment (required each time)
source ~/venv-dictation/bin/activate

# Navigate to nerd-dictation directory
cd ~/nerd-dictation

# Start dictation (runs in background)
./nerd-dictation begin --vosk-model-dir=./model &

# Speak into your microphone, then stop dictation
./nerd-dictation end

Note: The transcribed text will appear where your cursor is currently positioned. Make sure to have a text editor or document open and focused before ending dictation.

Prepare Environment on Startup (Optional)

Ensure PulseAudio starts automatically

# Enable PulseAudio user service (most systems do this by default)
systemctl --user enable pulseaudio

Create convenient aliases

# Add to your ~/.bashrc for easy access
echo 'alias dictation-start="cd ~/nerd-dictation && source ~/venv-dictation/bin/activate && ./nerd-dictation begin --vosk-model-dir=./model &"' >> ~/.bashrc
echo 'alias dictation-stop="cd ~/nerd-dictation && source ~/venv-dictation/bin/activate && ./nerd-dictation end"' >> ~/.bashrc

# Reload bashrc
source ~/.bashrc

Quick-start desktop shortcuts (Optional)

# Create desktop shortcut to start dictation
cat > ~/Desktop/start-dictation.sh << 'EOF'
#!/bin/bash
cd ~/nerd-dictation
source ~/venv-dictation/bin/activate
./nerd-dictation begin --vosk-model-dir=./model &
notify-send "Dictation Started" "Speech recognition is now active"
EOF

chmod +x ~/Desktop/start-dictation.sh

# Create desktop shortcut to stop dictation
cat > ~/Desktop/stop-dictation.sh << 'EOF'
#!/bin/bash
cd ~/nerd-dictation
source ~/venv-dictation/bin/activate
./nerd-dictation end
notify-send "Dictation Stopped" "Speech recognition is now inactive"
EOF

chmod +x ~/Desktop/stop-dictation.sh

Usage with shortcuts

After setup, you can simply:

  • Type dictation-start in any terminal to begin
  • Type dictation-stop in any terminal to end
  • Or use the desktop shortcuts for GUI control

Keyboard Shortcuts (Optional)

GNOME (Ubuntu default)

# Open Settings > Keyboard > Keyboard Shortcuts > Custom Shortcuts
# Or use gsettings commands:

# Set Ctrl+Alt+D to start dictation
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/']"

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name 'Start Dictation'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command 'bash -c "cd ~/nerd-dictation && source ~/venv-dictation/bin/activate && ./nerd-dictation begin --vosk-model-dir=./model &"'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding '<Ctrl><Alt>d'

# Set Ctrl+Alt+S to stop dictation
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ name 'Stop Dictation'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ command 'bash -c "cd ~/nerd-dictation && source ~/venv-dictation/bin/activate && ./nerd-dictation end"'
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/ binding '<Ctrl><Alt>s'

Alternative: Using xbindkeys

# Install xbindkeys
sudo apt install xbindkeys

# Create configuration file
cat > ~/.xbindkeysrc << 'EOF'
# Start dictation with Ctrl+Alt+D
"bash -c 'cd ~/nerd-dictation && source ~/venv-dictation/bin/activate && ./nerd-dictation begin --vosk-model-dir=./model &'"
    control+alt + d

# Stop dictation with Ctrl+Alt+S
"bash -c 'cd ~/nerd-dictation && source ~/venv-dictation/bin/activate && ./nerd-dictation end'"
    control+alt + s
EOF

# Start xbindkeys
xbindkeys

# Make xbindkeys start automatically
echo 'xbindkeys' >> ~/.profile

Manual GUI Method (GNOME)

  1. Open SettingsKeyboardKeyboard Shortcuts
  2. Scroll down and click Custom Shortcuts
  3. Click the + button to add new shortcut
  4. Name: "Start Dictation"
  5. Command: bash -c "cd ~/nerd-dictation && source ~/venv-dictation/bin/activate && ./nerd-dictation begin --vosk-model-dir=./model &"
  6. Shortcut: Press Ctrl+Alt+D
  7. Repeat for "Stop Dictation" with Ctrl+Alt+S

Recommended shortcuts:

  • Ctrl+Alt+D: Start dictation
  • Ctrl+Alt+S: Stop dictation

If you have issues after reboot:


# Check if PulseAudio is running
pulseaudio --check -v

# If not running, start it
pulseaudio --start

# Test the alias
dictation-start