Optimizing your first Armbian setup

Optimizing your first Armbian setup

Setting up Armbian can be straightforward when approached systematically. This guide will walk you through the essential setup steps, including new tips and additional recommendations.

First Login and Initial Setup

  1. Log in as root: Use the default credentials:

    • Username: root
    • Password: 1234

    Follow the prompts to:

    • Set up a new user.
    • Configure the timezone and locale.
    • Choose your preferred shell.
  2. Update Packages: Keeping software up-to-date is crucial:

    apt update && apt upgrade -y
    

Changing the Hostname

Customizing your hostname makes network identification easier:

hostnamectl set-hostname <new-hostname>

Configuring Static IP

Method 1: /etc/network/interfaces (Legacy)

For older versions:

  • Edit /etc/network/interfaces:

    auto eth0
    iface eth0 inet static
        address 192.168.1.100
        netmask 255.255.255.0
        gateway 192.168.1.1
        dns-nameservers 8.8.8.8 8.8.4.4
    
  • Restart the network service:

    systemctl restart networking
    

Method 2: Netplan (Modern)

For versions 24.05+:

  • Edit /etc/netplan/*.yaml:

    network:
      version: 2
      renderer: networkd
      ethernets:
        eth0:
          dhcp4: false
          addresses:
            - "192.168.1.100/24"
          gateway4: "192.168.1.1"
          nameservers:
            addresses:
              - 8.8.8.8
              - 8.8.4.4
    
  • Apply the configuration:

    netplan apply
    

Transitioning to networkd

To switch your network management to networkd, you’ll need to adjust your network configuration and ensure the appropriate services are enabled and running.

Checking Service Statuses

Before enabling networkd, confirm its status and ensure conflicting services like NetworkManager are disabled. Use the following commands:

  • Check if systemd-networkd is active:

    systemctl is-active systemd-networkd
    
  • Check if NetworkManager is active:

    systemctl is-active NetworkManager
    

Enabling networkd

To enable systemd-networkd, follow these steps:

  1. If the service is masked, you will encounter an error when trying to enable it:

    Failed to enable unit: Unit file /etc/systemd/system/systemd-networkd.service is masked.
    

    Unmask the service with:

    systemctl unmask systemd-networkd
    
  2. Enable the service to start automatically on boot:

    systemctl enable systemd-networkd
    

    Then, start the service:

    systemctl start systemd-networkd
    

Final Netplan Configuration

Below is an example configuration file for Netplan that uses networkd as the renderer. This setup defines a bridge interface br0 connected to the Ethernet interface end0 with static IP settings:

network:
  version: 2
  renderer: networkd
  ethernets:
    end0:
      dhcp4: false
      dhcp6: false
  bridges:
    br0:
      addresses:
        - "192.168.1.100/24"
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4
      interfaces:
        - end0
      routes:
        - metric: 200
          to: "0.0.0.0/0"
          via: "192.168.1.1"

Save this configuration under /etc/netplan/, apply it with the netplan apply command, and verify the network settings are updated correctly.

Disabling NetworkManager

To avoid conflicts, disable NetworkManager if it is currently managing the network. Run the following command to stop and disable it in one step:

systemctl disable NetworkManager --now

SSH Key Configuration

Enable password-less login:

ssh-copy-id -i ~/.ssh/<keyfile> user@<host>

Enabling ZRAM for Better Performance

ZRAM can improve performance on limited-memory devices:

  1. Install the ZRAM configuration utility:

    apt install zram-tools
    
  2. Configure /etc/default/zramswap:

    PERCENTAGE=50
    
  3. Restart the service:

    systemctl restart zramswap
    

Setting Up Docker

  1. Install Docker:

    curl -fsSL https://get.docker.com | sh
    
  2. Add your user to the docker group:

    usermod -aG docker <username>
    
  3. Verify installation:

    docker run hello-world
    

Setting Up Tailscale

Simplify networking with Tailscale:

  1. Install Tailscale:

    curl -fsSL https://tailscale.com/install.sh | sh
    
  2. Activate Tailscale:

    tailscale up