From Ubuntu Installation to Wake-on-LAN and SSH
When I decided to restart my DevOps training, I knew I needed a clean, efficient setup on my NUC. I wanted a system that would automatically install all the essential tools—like Docker, Jenkins, and Kubernetes utilities—and let me wake it up remotely with ease. Here’s a rundown of how I set everything up, from installing Ubuntu with an autoinstall configuration to fine-tuning SSH and Wake-on-LAN.
Installing Ubuntu with a Custom Autoinstall
I started by creating an autoinstall.yaml file to streamline the Ubuntu Desktop installation on my NUC. This file not only configured the system’s hostname and user accounts (I used my non-root username zlefterov) but also pre-installed my go-to DevOps tools:
- Git, Docker, and docker-compose for container management.
- Ansible for automation.
- Jenkins (after adding its repository) for continuous integration.
- kubectl and minikube for managing Kubernetes clusters.
- VSCode via snap for a modern code editor.
This approach saved me loads of time and ensured I always had a consistent environment. I even included late-commands to add my user to the Docker group and configure additional settings.
Enabling SSH for Remote Access
After the installation, I needed SSH access so I could manage my NUC remotely:
- Installing OpenSSH Server:
I ran:sudo apt update && sudo apt install openssh-serverand confirmed that the SSH service was up and running with:sudo systemctl status ssh - Starting and Enabling SSH:
To make sure SSH was available on reboot, I enabled it:sudo systemctl enable sshNow, whenever I connect from my MacBook or any other device, I simply use:ssh zlefterov@<NUC-IP-address>If you encounter any “connection refused” messages, double-check your firewall settings and ensure the service is running.
Activating Wake-on-LAN (WoL)
One of my favorite features is being able to wake the NUC remotely. Here’s how I set up WoL:
- Temporarily Enabling WoL:
First, I verified my network interface (usingip a) and then activated WoL with:sudo ethtool -s enp3s0 wol g(Make sure to replaceenp3s0with your actual interface name.) I confirmed that the output fromsudo ethtool enp3s0showed Wake-on: g, which means WoL was active. - Making WoL Persistent:
To ensure the setting sticks after reboot, I created a systemd service. I created the file/etc/systemd/system/wol.servicewith the following content:[Unit] Description=Configure Wake-on-LAN for enp3s0 After=network-online.target Wants=network-online.target [Service] Type=oneshot ExecStart=/sbin/ethtool -s enp3s0 wol g RemainAfterExit=yes [Install] WantedBy=multi-user.targetThen I reloaded systemd and enabled the service:sudo systemctl daemon-reload sudo systemctl enable wol.service sudo systemctl start wol.service
Creating a Friendly Alias for Wake-on-LAN
Typing in a MAC address every time to wake the NUC was not ideal. So, I set up a simple alias system:
- Mapping File:
I created a file named~/.wol_aliasesand added a line like:mynuc 11:22:33:44:55:66 - Wake-on-LAN Script:
Then I wrote a Bash script (~/wol.sh) that reads this file and sends a magic packet using thewakeonlanutility:#!/bin/bash # wol.sh: Wake up a device using its friendly name. ALIAS_FILE="$HOME/.wol_aliases" if [ "$#" -ne 1 ]; then echo "Usage: $0 <device-name>" exit 1 fi DEVICE_NAME=$1 MAC=$(grep -i "^$DEVICE_NAME " "$ALIAS_FILE" | awk '{print $2}') if [ -z "$MAC" ]; then echo "Error: Device name '$DEVICE_NAME' not found in $ALIAS_FILE" exit 1 fi echo "Sending Wake-on-LAN packet to $DEVICE_NAME ($MAC)..." wakeonlan "$MAC"I made it executable with:chmod +x ~/wol.shNow, waking up my NUC is as easy as:~/wol.sh mynuc
Setting up my NUC for DevOps training was a rewarding project. By automating the installation and configuration process, I now have a consistent, powerful environment that supports SSH management, remote waking via WoL, and all my essential tools. Whether you’re new to Linux or looking to streamline your workflow, I hope this guide makes the process as simple as it was for me!
Happy DevOps-ing!
End of Day1