Post

What To Do With 4X Tiny Pcs

What To Do With 4X Tiny Pcs: Maximizing Your Homelab Potential

In the realm of self-hosting and homelab enthusiasts, acquiring multiple small-form-factor (SFF) or tiny PCs is a common occurrence. These compact yet powerful machines can serve various purposes, from acting as network-attached storage (NAS) to running self-hosted applications like media servers, VPNs, or even gaming servers. In this comprehensive guide, we will explore how to make the most of your 4x tiny PCs, specifically the ones mentioned in the Reddit post: 3x HP ProDesk 600 G2 Mini and 1x Lenovo ThinkCentre M720q, along with an existing mid-size PC running Windows 11 with JellyFin set up.

Why This Topic Matters for Homelab Environments

Optimizing your homelab infrastructure is crucial for several reasons. First, it helps you make the most of your investment by fully utilizing your hardware. Second, it promotes energy efficiency, as tiny PCs consume less power compared to larger machines. Lastly, it allows you to experiment with various services and technologies, making your homelab more versatile and functional. By the end of this guide, you will have a well-optimized homelab setup that maximizes the potential of your tiny PCs.

Understanding Tiny PCs and Their Capabilities

Tiny PCs, also known as small-form-factor (SFF) or mini PCs, are compact computers designed for limited space and low power consumption. Despite their size, they often pack decent processing power, making them ideal for various homelab use cases. Here’s a comparison of the given tiny PCs:

ModelCPURAMStorageForm Factor
HP ProDesk 600 G2 MiniIntel Pentium G4500T4GB DDR4 2133500GB HDDMini Tower
Lenovo ThinkCentre M720qIntel Pentium Gold G5400T4GB DDR4 2666128GB SSDMini Tower

While these tiny PCs may not compete with high-end workstations, they offer sufficient performance for many homelab tasks. For instance, they can run lightweight Linux distributions like Ubuntu Server or Alpine Linux, along with various open-source applications and services.

Prerequisites

Before diving into the setup and configuration, ensure you have the following prerequisites:

  1. Operating System (OS): Install a suitable Linux distribution on your tiny PCs. Popular choices include Ubuntu Server (18.04 LTS or later), CentOS (7 or later), or Alpine Linux. For this guide, we’ll use Ubuntu Server 20.04 LTS.
  2. Network: Ensure your tiny PCs and the existing mid-size PC are connected to the same network. A wired connection is recommended for better performance and stability.
  3. User Permissions: Create a dedicated user account with sudo privileges for day-to-day administration tasks.
  4. Software: Install essential tools like git, wget, curl, and net-tools to facilitate the installation and management of services.

Installation & Setup

In this section, we’ll set up your tiny PCs for various homelab use cases. We’ll use Ubuntu Server 20.04 LTS as the base OS and configure them as follows:

  1. NAS (HP ProDesk 600 G2 Mini #1)
  2. Media Server (HP ProDesk 600 G2 Mini #2)
  3. VPN Server (Lenovo ThinkCentre M720q)

1. Setting up a NAS using Nextcloud and Samba

For the first tiny PC, we’ll create a network-attached storage (NAS) using Nextcloud for cloud storage and file synchronization, along with Samba for Windows file sharing.

Installation commands:

1
2
3
4
5
6
7
8
9
10
# Update package list and install required software
sudo apt update
sudo apt install nextcloud samba samba-common-bin

# Start and enable the services
sudo systemctl start nextcloud sambad samba-nmbd
sudo systemctl enable nextcloud sambad samba-nmbd

# Configure Samba
sudo nano /etc/samba/smb.conf

Add the following lines at the end of the /etc/samba/smb.conf file to create a shared folder named nextcloud:

1
2
3
4
5
6
7
8
9
[nextcloud]
comment = Nextcloud Data
path = /var/www/nextcloud/data
read only = no
browseable = yes
write list = @nextcloud
valid users = @nextcloud
force user = www-data
force group = www-data

Create a new user for Nextcloud and add it to the nextcloud group:

1
2
sudo adduser --home /var/www/nextcloud --shell /bin/bash --gecos "Nextcloud User" nextclouduser
sudo adduser nextclouduser nextcloud

Restart Samba to apply the changes:

1
sudo systemctl restart sambad samba-nmbd

2. Setting up a Media Server using JellyFin

For the second tiny PC, we’ll set up a media server using JellyFin, a powerful media management platform. Since you already have JellyFin running on your mid-size PC, we’ll configure this tiny PC as a JellyFin client to sync and stream media content.

Installation commands:

1
2
3
4
5
6
7
# Update package list and install JellyFin client
sudo apt update
sudo apt install jellyfin-client

# Start and enable the service
sudo systemctl start jellyfin-client
sudo systemctl enable jellyfin-client

Configure JellyFin client to connect to your mid-size PC by editing the jellyfin.json file:

1
sudo nano /opt/jellyfin/jellyfin.json

Add the following configuration, replacing <MID_SIZE_PC_IP> with your mid-size PC’s IP address:

1
2
3
4
5
6
7
8
{
  "Version": 1,
  "ServerURL": "http://<MID_SIZE_PC_IP>:8096",
  "Username": "<JELLYFIN_USERNAME>",
  "Password": "<JELLYFIN_PASSWORD>",
  "LibraryRefreshInterval": 300,
  "LibraryUpdateInterval": 5
}

Restart the JellyFin client service:

1
sudo systemctl restart jellyfin-client

3. Setting up a VPN Server using WireGuard

For the third tiny PC, we’ll set up a WireGuard VPN server to secure your homelab and provide remote access to your network.

Installation commands:

1
2
3
4
5
6
7
8
9
10
11
# Update package list and install WireGuard
sudo apt update
sudo apt install wireguard

# Generate key pairs for the server and client
wg genkey | tee /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey
wg genkey > /etc/wireguard/client-privatekey
wg pubkey < /etc/wireguard/client-privatekey > /etc/wireguard/client-publickey

# Configure the WireGuard server
sudo nano /etc/wireguard/wg0.conf

Add the following configuration to the wg0.conf file:

1
2
3
4
5
6
7
8
9
10
[Interface]
PrivateKey = <SERVER_PRIVATE_KEY>
Address = 10.0.0.1/24
ListenPort = 51820
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
PublicKey = <CLIENT_PUBLIC_KEY>
AllowedIPs = 10.0.0.2/32

Replace <SERVER_PRIVATE_KEY> with your server’s private key and <CLIENT_PUBLIC_KEY> with your client’s public key.

Enable IP forwarding and configure your firewall:

1
2
3
4
5
6
7
8
9
# Enable IP forwarding
sudo sysctl -w net.ipv4.ip_forward=1
echo "net.ipv4.ip_forward = 1" | sudo tee -a /etc/sysctl.conf

# Configure firewall
sudo ufw default allow routed
sudo ufw allow ssh/tcp
sudo ufw allow 51820/udp
sudo ufw enable

Start and enable the WireGuard service:

1
2
sudo systemctl start wg-quick@wg0
sudo systemctl enable wg-quick@wg0

Configure your client devices (e.g., laptop, smartphone) to connect to the WireGuard server using the client’s private key and the server’s public key and IP address.

Configuration & Optimization

1. NAS configuration and optimization

To optimize your NAS setup, consider the following configurations:

  • Enable NextcloudTalk: Install NextcloudTalk for integrated voice and video calls, chat, and screen sharing (https://github.com/nextcloud/nextcloud-talk).

  • Configure automatic backup: Set up automatic backups to an external storage device or cloud service to protect your data.

  • Hardware acceleration: Enable hardware acceleration for improved performance by installing the libvips and ffmpeg packages:

1
sudo apt install libvips-tools ffmpeg

2. Media Server configuration and optimization

To optimize your media server, consider the following configurations:

  • Transcoding: Enable automatic transcoding in JellyFin to ensure compatibility with various client devices.

  • Library management: Regularly update your media library, organize files, and maintain proper metadata.

  • Hardware acceleration: Enable hardware acceleration for improved performance by installing the libvdpau-va-driver package:

1
sudo apt install libvdpau-va-driver

3. VPN Server configuration and optimization

To optimize your VPN server, consider the following configurations:

  • Limit connections: Set a limit on the number of concurrent connections to prevent abuse and improve performance.

  • Firewall rules: Configure your firewall to only allow essential traffic and restrict access to your network.

  • Keepalive: Configure keepalive to maintain the VPN connection and prevent disconnections due to idle time.

Usage & Operations

1. NAS usage and operations

  • Access Nextcloud: Access your Nextcloud instance at http://<NAS_IP> using a web browser or the official Nextcloud clients.

  • SMB/CIFS shares: Connect to your NAS using Windows File Explorer or Linux/SMACOS file managers by browsing to \\<NAS_IP>\nextcloud.

2. Media Server usage and operations

  • Access JellyFin: Access your JellyFin instance at http://<MEDIA_SERVER_IP>:8096 using a web browser or the official JellyFin clients.

  • Stream media: Stream media content to your client devices, such as smart TVs, smartphones, or other media players.

3. VPN Server usage and operations

  • Connect clients: Connect your client devices to the VPN server using the WireGuard client software (https://www.wireguard.com/install/).

  • Monitor connections: Monitor active VPN connections and their usage statistics.

Troubleshooting

Common issues and solutions

  1. Nextcloud not starting: Ensure that the MySQL service is running and that the Nextcloud database has been created. Check the Nextcloud log file at /var/log/nextcloud/nextcloud.log for more information.

  2. JellyFin not syncing: Verify that the JellyFin client is configured correctly and that the mid-size PC is accessible. Check the JellyFin client log file at /var/log/jellyfin/jellyfin.log for more information.

  3. VPN connection issues: Ensure that the WireGuard service is running and that the client’s configuration is correct. Check the WireGuard log file at /var/log/syslog for more information.

Debug commands and log analysis

  • Nextcloud: Check the Nextcloud log file at /var/log/nextcloud/nextcloud.log for debugging information.

  • JellyFin: Check the JellyFin client log file at /var/log/jellyfin/jellyfin.log for debugging information.

  • WireGuard: Check the WireGuard log file at /var/log/syslog for debugging information.

Performance tuning tips

  • NAS: Optimize Nextcloud performance by enabling hardware acceleration, configuring caching, and optimizing database settings.

  • Media Server: Optimize JellyFin performance by adjusting transcoding settings, enabling hardware acceleration, and configuring caching.

  • VPN Server: Optimize WireGuard performance by adjusting keepalive intervals, limiting connections, and configuring firewall rules.

Conclusion

In this comprehensive guide, we explored how to make the most of your 4x tiny PCs by setting up a NAS, media server, and VPN server. By leveraging open-source software and following best practices for configuration and optimization, you can create a robust and versatile homelab environment. The provided examples demonstrate how to maximize the potential of your hardware and create a self-hosted ecosystem tailored to your needs.

For further learning, consider exploring the following resources:

Next steps could include expanding your homelab by adding more services, such as a game server, chat server, or home automation hub. Always remember to prioritize security, performance, and energy efficiency in your homelab setup.

Happy homelabbing!

This post is licensed under CC BY 4.0 by the author.