My home automation server setup on my old mid 2009 MacBook Pro with installation instructions for Ubuntu, ioBroker, InfluxDB v2.x, and Grafana.

I was running ioBroker on a Raspberry Pi 3B with 1 GB RAM. But not for long since the Pi3 is too slow for this task. By the time of writing, roughly 2.5 yrs into Corona, Raspberry Pis have tremendously increased in price. A Pi4 with, e.g., 4 GB of RAM would surely do the job but currently costs ~150 EUR. A good alternative would be a USFF PC but in a reasonably future-proof set-up it would cost about 200-300 EUR. And then there is the question of power consumption…

But wait! I have this MacBook Pro (MBP) from 2009 lying around waiting for years and years for its second life. Perhaps this 13 year old MBP has still enough juice in it to be used as a home automation server running ioBroker?! The MacBook still boots into MacOS Yosemite (no more updates possible on this old hardware), but the battery shows “service required”. Nonetheless, it works. But MacOS Yosemite does already seem to bee “too much” for the hardware so I refrain from trying to let ioBroker run under MacOS.

Instead, the first idea was to use Proxmox as a universal virtualization environment and let ioBroker run in a virtual machine. Unfortunately, the old MacBook features a 32-bit UEFI boot loader that will not work with the 64-bit grub boot loader from Proxmox. My research showed that with some decent hacking it might be accomplished, though. Nonetheless, too much effort.

The second, and final, idea was to install Ubuntu Server LTS on the MBP. The server version has no graphical user interface and should require less ressources. Here is a quick walkthrough of the steps I have taken to install Ubuntu Server, ioBroker, InfluxDB2, and Grafana on the MBP.

Install Ubuntu Server LTS on the MBP

Create a bootable Ubuntu Server LTS installation USB Stick. The current version can be downloaded here. I used the balenaEtcher to write the Ubuntu *.iso image to a USB Stick.

Insert the USB Stick in the old 2009 MacBook Pro, fire it up, and keep the Option-key pressed during startup. The Mac’s boot menu, similar to what you can see in the following picture, should come up.

EFI Boot is the right option to chose. This will boot the Ubuntu installer from the USB Stick. Click on the arrow to do so.

The installer will come up and guide you through the process of installing Ubuntu. Steps comprise: language, keybaord, hard drive, network, name and credentials, packages, OpenSSH, etc. Since I will require remote access to the server I chose to have OpenSSH installed.

When everything has been configured, Ubuntu is installed and, depending on whether you have an internet connection, updates are downloaded automatically. A couple of minutes later, the Ubuntu Server LTS installation should be finished.

Ubuntu will reboot and greet you with its login prompt. You can log in and check for some additional updates using:

$ sudo apt update && sudo apt upgrade

Ubuntu install finished!

Set up remote access

I like to log in on remote machines using ssh with a private/public key combination. We will store a public key on the MBP and use the private key on the machine, from which we want to log in on the MBP.

First we have to create a key private/public key pair. On the Ubuntu MBP enter this. When asked to save the files, chose a proper filename, e.g. mykey.

$ ssh-keygen -t rsa -b 2048 -v

This will generate two files: mykey with your private key, and mykey.pub with the public key. Rename the private key to mykey.pem – this suffix makes it easier to see what is inside.

$ mv mykey mykey.pem

Add the public key to the authorized keys of the MBP:

$ cat mykey.pub >> ~/.ssh/authorized_keys

Transfer the private key mykey.pem to the machine where you would like to use it. If you want to store the key to a USB stick please note that Ubuntu Server does not automatically mount USB drives. Insert the USB stick and find out the stick’s device name with, e.g.

$ sudo fdisk -l

It is pretty likely that your USB stick will be /dev/sdc and its partition /dev/sdc1. If so, do the following:

$ sudo mkdir /media/usb
$ mount /dev/sdc1 /media/usb

The USB stick should be mounted and you can write the private key mykey.pem to it. Do not forget to unmount before removing the stick.

$ umount /media/usb

When you put the private key on the machine from wich you want to remotely log in to Ubuntu it is very important to make the private key read-only!

$ sudo chmod 400 mykey.pem

Now you can remotely log in like this.

$ ssh -i mykey.pem <username>@<ip-address>

Disable deep sleep and turn off display

The MBP’s lid shall be closed all the time since it is just a headless server. Thus, the MBP may not go into hibernation or deep sleep if the lid is closed. Moreover the display should turn off when the lid is closed. Everything else would be a waste of energy. Let’s handle turning off the display first.

We can edit this file

$ sudo nano /etc/default/grub

and add this line

GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=60"

After saving you must update grub with

$ sudo update-grub

Reboot, and the screen should from now on always go blank after no key has been pressed for 60 seconds.

Now for the lid. We edit this file

$ sudo nano /etc/systemd/logind.conf

then uncomment the following lines and set them all to “ignore”.

HandleLidSwitch=ignore 
HandleLidSwitchExternalPower=ignore 
HandleLidSwitchDocked=ignore

Save, reboot, and we’re done.

Install ioBroker

Installing ioBroker is a one-liner.

$ curl -sLf https://iobroker.net/install.sh | bash -

A successful install looks like this.

ioBroker was installed successfully
Open http://<ip-address>:8081 in a browser and start configuring!

Open your favorite Web Browser and enter the above URL replacing <ip-address> with the IP address of your Pi. If your Pi uses a dynamic IP address you can find it out, e.g., with your router’s network list (list of devices that are connected to your router). If you have assigned a static IP to your Pi, as in the first optional step above, then use this one. Don’t forget to attach the port number “:8081”.

You should be greeted with ioBroker’s installation wizard welcome screen.

Leave a Reply

Your email address will not be published. Required fields are marked *