Skip to content

Instantly share code, notes, and snippets.

@ivylikethevine
Last active October 11, 2023 23:09
Show Gist options
  • Save ivylikethevine/adba9472047741476e5a19b8741e906a to your computer and use it in GitHub Desktop.
Save ivylikethevine/adba9472047741476e5a19b8741e906a to your computer and use it in GitHub Desktop.
Laptop Homelab in 5 Commands
# This configuration is designed to run on a laptop with Ubuntu 22.04LTS server edition.
# Laptop Server Config
sudo echo $'HandleLidSwitch=ignore\nHandleLidSwitchDocked=ignore' | sudo tee -a /etc/systemd/logind.conf &&
sudo echo "GRUB_CMDLINE_LINUX_DEFAULT=\"consoleblank=60\"" | sudo tee -a /etc/default/grub &&
sudo update-grub
# Install Basics
sudo echo "\$nrconf{restart} = 'l'" | sudo tee -a /etc/needrestart/needrestart.conf &&
sudo apt update -y &&
sudo apt upgrade -y &&
sudo apt install -fy zip git htop software-properties-common apt-transport-https wget xclip net-tools curl python3 python3-pip nodejs npm ca-certificates gnupg avahi-daemon avahi-utils nfs-common &&
sudo apt autoremove -y
# Full Docker Setup
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 &&
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 &&
sudo apt update -y &&
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin &&
sudo usermod -aG docker $USER &&
newgrp docker &&
sudo systemctl enable docker
# Install Cockpit, File Sharing, and Portainer
sudo mkdir /portainer_data &&
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:/portainer_data portainer/portainer-ce:latest &&
sudo apt install -y cockpit cockpit-pcp &&
curl -LO https://github.com/45Drives/cockpit-file-sharing/releases/download/v3.2.9/cockpit-file-sharing_3.2.9-2focal_all.deb &&
sudo apt install -y ./cockpit-file-sharing_3.2.9-2focal_all.deb &&
rm ./cockpit-file-sharing_3.2.9-2focal_all.deb
# Configure Network
sudo echo "network:
version: 2
renderer: NetworkManager
ethernets:
$(ip -o -4 route show to default | awk '{print $5}'):
dhcp4: true
link-local: [ ipv4 ]" | sudo tee /etc/netplan/00-installer-config.yaml &&
sudo netplan apply
# Apply Everything
sudo reboot
# The server should now be accessible at
# https://<hostname>.local:9090 for cockpit
# https://<hostname>.local:9443 for portainer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment