How to Build a Powerful DIY Server for Smart Home

How to Build a Powerful DIY Server for Smart Home

Please read Liability Disclaimer and License Agreement CAREFULLY

Welcome to my DIY server page, where I showcase a powerful and versatile server that runs on Ubuntu Server, Apache, MySql, PHP, Samba, Jellyfin, NextCloud, OpenJDK, NodeJS, MQTT, Zigbee, OpenHAB, Docker Compose, Frigate NVR, DeepStack, and Edge TPU.

My DIY server is the perfect solution for those who want to have complete control over their data, applications, and media.

With Ubuntu Server, you have access to a reliable and secure operating system that is optimized for server use.

Apache, MySql, and PHP provide a powerful web server stack that is essential for running dynamic websites and applications.

Samba allows for easy file sharing across multiple platforms, while Jellyfin or Plex provide a media server platform that can stream your favorite movies, TV shows, and music.

NextCloud is a self-hosted cloud solution that allows you to store and access your files, contacts, and calendars securely.

OpenJDK, NodeJS, MQTT, Zigbee, and OpenHAB are essential tools for running IoT and smart home applications.

With Docker Compose, you can easily manage and deploy containerized applications, and Frigate NVR provides a powerful video surveillance solution.

DeepStack and Edge TPU are AI accelerators that allow you to run machine learning and computer vision workloads.

This DIY server is easy to set up and customize to your specific needs. Whether you want to host your own website, run your own cloud, or build your own smart home, this server has everything you need.

So why wait? Start building your own DIY server today!

 

Things we need:

1. A computer to install the software on. In this case I went with a mini PC, HP ProDesk 400 G3 Desktop Mini we will call it from now on "Server".

I bought this second hand with Intel Core i5-7500T 8Gb RAM and 256Gb NVME HDD. I have upgraded the RAM by adding an extra 8Gb memory stick and the HDD by using Intel S3710 SSD 1.2TB.

I am more interested in HDD capacity and life time than speed.

2. A USB stick to flash Ubuntu on it.

3. A monitor, network cable, keyboard and mouse to connect to server. I am assuming that you already have a router and you know how to use it.

4. A computer (Windows, Linux) to use it in the preparation activities, we will call it from now on "Helper".

5. Prepare yourself to use Ubuntu Terminal, you will use it a lot.

Let's start the installation

1. Make sure Helper is connected to your local network

2. Flash Ubuntu on the USB stick using Create a bootable USB stick with Rufus on Windows on Helper

3. Check on internet how to access your Server Bios to set up the Boot Order, we need to make sure we will boot from the USB stick.

4. Install Ubuntu on Server by following these steps, make sure the Server is connected to Internet.

5. Update the system by using the following commands

sudo -s

Then type in you credentials (username and password)

sudo apt-get update
sudo apt-get upgrade

Reboot your Server

6. Set your Server IP static by following this tutorial, you can do this also from your router interface by checking this How To from Asus. I have use 10.0.1.2 for Server as the router has the 10.0.1.1.

7. Enable Secure Shell Network Protocol  this feature will allow us to access the Server after we finish the set up without having any display, keyboard or mouse connected to server, we use only the Helper computer with Putty (open-source terminal emulator, serial console and network file transfer application) install on it.

8. Test you SSH connection from your Helper towards Server, if you can connect remotely then you can remove the display, keyboard and mouse from Server, and place it in a secure place connected to network (preferably using gigabit wired network cable). My recommendation is to buy and use also an UPS (Uninterruptible Power Supplies) , I am using APC Back-UPS, 500VA/300W.

9. Install Webmin (is a web-based system administration tool for Unix-like servers) by following this guide. This will allow us to access our server from a web based interface, making the life more easier for those who dislike the Terminal.

10. Install Apache, MySQL and PHP by following the tutorial for Install and Configure Apache, Install and configure a MySQL server and How To Install PHP On Ubuntu 22.04

These 3 tools will allow local webpage development and they will be used by other applications installed on Server

11. Install Samba server by following this guide to transform our Server in a NAS (Network Attached Storage) and we will be able to have a common location on network for most common used files (pictures, music, movies and others).

12. If your HDD size allows you to store large media files, you can also install on Server a Media Streaming Service like Jellyfin or Plex by following this guide for Jellyfin or this guide for Plex.

My personal choice is Jellyfin as it doesn't require paid subscription for hardware decoding.

13. For audio streaming I am using Navidome that allows me to browse and listen to my music collection using a web browser. Follow this guide to install Navidome.

14. If you like to access your private files remotely from a nice web interface and ditch Google Drive I suggest to try NextCloud and follow this installation guide.

15. Install OpenJDK by following this guide

16. Install Node.js by following this guide

17. Install Mosquitto MQTT Broker

18. Install Zigbee2MQTT by following this guide. To access the server from you Helper you can install on it  MQTT Explorer.

We will create the ZigBee network using ZigStar LAN Gateway Gateway with CC2652P2 attached to your wired network or ZigStar Stick v4 attached to one of your Server USB ports.

Check the hardware pictures in Smart Home Server Hardware.

Before you pair any sensors or devices in ZigBee please check if you have any interference between the 2.4GHz Wi-Fi network and ZigBee network by reading this article, then set up your ZigBee or Wi-Fi channels.

For a example of  configuration file for Zigbee2MQTT check this article Zigbee2MQTT configuration

19. Finally, install OpenHAB by following this guide, this is the application that will control and act as GUI(Graphical User Interface) for the Smart Home.

 

I will not stop here, I want to be able to have in Smart Home the possibility to detect the presence of persons and detect objects or animals using surveillance camera's.

To be able to do this I need to have some AI power installed on the server, the next steps are needed only if you intend to follow this approach also.

20. Install Docker Compose by using this installation guide, we will use it later to set up advance features like person recognition in our Smart Home implementation.

You can also use Portainer as a powerful container management by following this install guide.

For a example of  configuration file for DockerCompose check this article Docker Compose Configuration

21. Install Frigate NVR using this guide

For a example of  configuration file for Frigate NVR check this article Frigate NVR Configuration, it also sends data to MQTT from Hikvision DS-2CD2463G0-I Camera.

22. Install DeepStack using this guide

23. For AI related tasks i have bought the M.2 Accelerator with Dual Edge TPU you can use M.2 Accelerator A+E key if you do not use the Wi-Fi card. In my case i can use only one TPU

due to the way the PCIe lanes are split. To install the software support for it you have to follow this guide.

Check the hardware pictures in Smart Home Server Hardware 

Comments powered by CComment