Step-by-step how-to guide install the Domoticz on a virtual machine with Debian 10 Buster, hosted on VMware vSphere (formally known as ESX).

We are going to be installation and configuring a almost default installation of Debian on a virtual machine. In this case the underlying virtualization platform is VMware ESX. But any other common virtualization platform like Proxmox, VirtualBox, Hyper-V, etc. will probably do just as fine.

This how-to is part of a bigger series of Domoticz how-to’s on sancla.com!

This tutorial has been verified with:
Domoticz 2020.1
Debian Buster 10.3.0

Prerequisites

Tested with

  • VMware vSphere 6.7.0
  • Putty 0.73
  • Debian 10.3.0 amd64 (Buster) – DOWNLOAD HERE
  • Domoticz Stable 2020.1 (compile date 22-3-2020)

Step 1: Create a Virtual Machine

First we need to create virtual machine as host for our new Debian and Domoticz server. I am not going into many details about this step as I assume you are able to achieve a running virtualization platform. If not, perhaps a installation of Domoticz on a Raspberry Pi would be more suited…

For the record, some (minimum) advice regarding resources:

  • CPU: 2 – 4 vCPU, depending on clock speed and generation
  • Memory: 2 GB minimum, 4 GB advised
    (1GB of memory also works but crappy performance in the end).
  • 32 – 64 GB disk space, preferably thick provisioned for performance
  • 1 network connection with internet access

To set you on your way, I provide you with some crude screenshots of an example for a new virtual machine in VMware vSphere, without any further comments:

Step 2: Install Debian

Once we have created a new virtual machine the next step would be install Debian. This step is pretty much standard and straight-forward. A couple of important details to follow during installation:

  • Create a user “pi” during installation, so your Debian installation is a bit more consistent with the default Rasbian based distro’s.
  • During installation you can choose to install packages (Software Selection), make sure to include “SSH server” for headless configuration.

For this step we again assume that you have basic knowledge of Debian and you are able to follow and finish the installation process. For you pleasure and support, we include some basic and crude screenshots of the installation process without any further comments:

Step 3: Connect with SSH

Once Debian is fully installed and rebooted, logon with the root username and corresponding password from your virtualization console. The only thing we need to do within this console is to figure out the IP address so we can connect with SSH (and copy/paste our commands, much easier).

To find the IP address, type the following command:

ip a

You should see the IP address with CIDR notation, see this screenshot for more details. In my case the network adapter is named “ens192” with IP address 10.40.3.17 and subnet /22 (You will probably see something like 192.168.1.123/24 at home):

Results of the "ip a" command with Debian
Results of the “ip a” command with Debian

Step 4: Household tasks

By default, SSH access is enable only for the user you created during setup. In this how-to we created the user “pi” during installation that we are going to need for the next step.

Connect with putty to the IP address of Debian virtual machine and logon with the user “pi”. Please be advised that by default you can not connect with the root user over SSH. This is by design and the default configuration for Debian, as a safety precaution.

Now we have SSH access to our Debian box, let’s do some ‘household’ tasks in preparation:

Step 4-a: Updating Debian

First, we need to install sudo and add our pi user to the sudo group.
Assuming you have SSH access and you are logged on with the pi user, become root with the su command:

su

Execute this command to update Debian to the latest standards and automatically reboot your virtual machine when it’s completed.

apt update -y && apt upgrade -y && systemctl reboot

Step 4-b: Give “pi” user sudo rights

Next step is to make sure that the pi user is able to use the sudo command.
Although strictly speaking this would not be necessary, it does make your Debian Box more compatible with the other Domoticz guides on this website and other Domoticz related documentation.

Connect with SSH and your pi user.
Execute the su command to become root again (see Step 4-a).
Next is to install sudo. By default sudo is not included in Debian so we need to install it first. Execute this command to do so:

apt install sudo -y

Now you have to modify the file /etc/sudoers which is where all the sudo configuration is located. You can use the nano editor for this:

nano /etc/sudoers

The file does not have too many lines. In the user privilege specification section, you will find a line like this.

root ALL=(ALL:ALL) ALL

Under it, add your user and leave the rest the same.

pi ALL=(ALL:ALL) ALL

It should look like this:

pi user added to the sudoers file
pi user added to the sudoers file

Next, press CTRL + O to save the changes and CTRL +X to close the nano editor. Now type exit 2 or 3 times to revert back to the pi user we originally logged on with. The pi user is able to execute the commands with sudo now. For example: sudo reboot.
Every first time that u are using the sudo command in an SSH session Debian will ask for the password of the pi user as confirmation.

Step 4-c: Fixed IP address

Now our pi user has sudo rights, it would be wise to assign a fixed IP address to our Debian box. Although strictly speaking this is also not necessary, it is advised so we can always find back our Debian/Domotiz installation. Use this command to configure a fixed IP address:
(remember, sudo ask for the password of the pi user with every SSH session, but only once per session):

sudo nano /etc/network/interfaces

Now, in this example, I am using a less the normal IP configuration then a general household so I included a configuration with the 192.168.0.0/24 network as example. Also included are the DNS servers from OpenDNS should you not yet know about it.

Press CTRL + O to save the changes and CTRL +X to close the nano editor.

Now, to apply the new network configuration, it’s best to execute the reboot command and apply the new IP address. Keep in mind that once the IP address changes, your SSH connection will drop without warning or dialog. You have to reconnect afterwards with the new IP address and accept a new SSH SSL key.

sudo reboot

Step 4-d: Install VMtools

Next is to install the VMtools. These are necessary so we have a better integration, stability and performance with the underlying virtualization host. Execute this command to install the general VMtools and reboot to complete the installation:

sudo apt install open-vm-tools -y && sudo reboot

Step 5-a: Prepare Debian for Domoticz

So now we have Debian up and running as we like, we need to prepare Debian for Domoticz. Debian is less prepared and expanded by default than Raspbian for the Raspberry Pi. So we will have to ensure that Debian knows and can execute the commands for Domoticz. For this we need to install and prepare a number of things. Execute the following commands:

sudo apt install build-essential -y

sudo apt install cmake libboost-dev libboost-thread-dev libboost-system-dev libsqlite3-dev subversion curl libcurl4 libcurl4-openssl-dev libusb-dev zlib1g-dev libssl-dev git -y

Step 5-b: Install

Per advice by Domoticz forum user “dzjr” you should also install the pip3 package manually (thank you for the feedback dzjr!)
You can do so with the following command:

sudo apt install python3-pip -y

Step 6: Install Domoticz

We are finally there! Say yes to the dress! (don’t ask… I’m sitting next to my wife while writing this article and it’s really awful, awful television…).

We can now install Domoticz the regular way:

curl -sSL install.domoticz.com | sudo bash

NOTE: If you get a curl error, run Step 5-a again:
sudo apt install build-essential -y
sudo apt install cmake libboost-dev libboost-thread-dev libboost-system-dev libsqlite3-dev subversion curl libcurl4 libcurl4-openssl-dev libusb-dev zlib1g-dev libssl-dev git -y

And there she is, our Domoticz server is up and running:

Domoticz is up and running on Debian Buster 10.3.0
Domoticz is up and running on Debian Buster 10.3.0