User Login      + Register  

Table_of_Contents

1      About Ubuntu Server

2      Virtual Machine Pre-requisites

3      Ubuntu Virtual Machine

3.1                Pre-Configured Ubuntu Virtual Machine

3.2                Create Ubuntu Virtual Machine

3.2.1      Configure Ubuntu Server Virtual Machine

3.2.2      Test Virtual Machine on PC

4      Hassio Virtual Machine

4.1                Pre-Configured Hassio Virtual Machine

4.2                Create Hassio Virtual Machine

4.3                Assign Static IP Address to Home Assistant

4.4                Share Host PC Folders With VM

List of Figures

Figure 1:       VmWare Workstation Main Screen

Figure 2:       VmWare Workstation Select Installation Source

Figure 3:       VmWare Workstation Personalize Linux

Figure 4:       VmWare Workstation Select VM Name and Location

Figure 5:       VmWare Workstation Select Disk Characteristics

Figure 6:       VmWare Workstation Ready to Create VM

Figure 7:       VmWare Workstation Configure Hardware

Figure 8:       Ubuntu Server Command Prompt

Figure 9:       HA Registration

Figure 10:       HA Main Page

1      About Ubuntu Server

Ubuntu server edition uses the same APT repositories as the Ubuntu Desktop Edition. It is freely available with both community and professional support. The differences between them are the absence of an X Window environment in a default installation of the server edition (although one can easily be installed, including Unity, GNOME, KDE Xfce, etc.). The server edition uses a screen-mode, character-based interface for the installation, instead of a graphical installation process. This enables installation on machines with a serial or "dumb terminal" interface without graphics support. Since version 10.10, the server edition (like the desktop version) supports hardware virtualization and can be run in a virtual machine.

Ubuntu is the "best of the breed" in terms of functionality, ease of use and online support (documentation, user contributions, user forums) for HowTo's, and help.

This document covers installing Ubuntu server as a virtual machine for SecureOffice to be used as the OS for Home Assistant.

And it's completely free!

2      Virtual Machine Pre-requisites

Prior to installing any virtual machines on SecureOffice, it is recommended to first get the virtual machine running on your PC.

Download free VmWare Workstation.

Install VmWare workstation on your PC. Additional installation instructions are located here.

If intending to use pre-configured virtual machines, download and install winrar from here.

3      Ubuntu Virtual Machine

3.1                Pre-Configured Ubuntu Virtual Machine

As a convenience, a pre-configured Ubuntu virtual machine (created from instructions in next section) is available to download by registered SecureOffice users. Do not use this if it is intended to be used for Home Assistant. Instead, download the pre-configured Hassio virtual machine.

The virtual machine has the following configuration: user: "administrator", password "admin_54321".

Download Ubuntu Server Virtual Machine. When prompted, enter your SecureOffice user ID and password. Open the file with winrar and extract it to your virtual machine directory.

Once extracted, start Vmware Workstation player, select "Open a Virtual Machine", navigate to <your VM directory>/Ubuntu-Server and select Ubuntu-Server.vmx to start the virtual machine.

When asked whether you moved or copied the virtual machine, select "I Copied It". This will generate a new MAC address and make the VM unique. The virtual machine will boot and prompt for login.

Go to Test Virtual Machine.

3.2                Create Ubuntu Virtual Machine

The following instructions can be used to create Virtual Machines (VMs) under Windows, Linux or SecureOffice / VmWare Workstation once the licensed VmWare Workstation package is installed on SecureOffice.

The resulting Ubuntu virtual machine will be used as the base OS for other virtual machines such as Home Assistant.

Download the latest version of Ubuntu Server x86_64 ISO from here. Create a directory called "Ubuntu-Server" where your virtual machines are stored. Move the Ubuntu Server ISO file to the above directory.

Start VmWare Workstation on your PC. The main screen will appear, as shown below. Note that the version may not match the figures below, since VmWare Workstation is updated on a regular basis. Replace all references to "SME Server" in the figures by "Ubuntu Server".

Figure 1: VmWare Workstation Main Screen

Select "Create New Virtual Machine". The select installation source window will appear, as shown below. Select "Installer disc image file", browse to and select the ISO file downloaded above. Click "Next".

Figure 2: VmWare Workstation Select Installation Source

The OS will be automatically detected and the "Personalize Linux" window will appear, as shown below:

Note, regarding Ubuntu Linux and root account password. By default, root account is locked under Ubuntu Linux. Therefore, you cannot log in as root or use "su -" command to become a superuser. To run all administrative commands, use the sudo command on Ubuntu. sudo allows a permitted user to execute a command as the superuser or another user. Ubuntu will setup your default account (the one created during installation) to run all administrative commands. The default user account is the one created below.

Figure 3: VmWare Workstation Personalize Linux

Fill in the full name, user name (for default account) and password fields. Press "Next"

The "Select Name and Location" window will appear, as shown below.

Figure 4: VmWare Workstation Select VM Name and Location

Type a name for your virtual machine (Ubuntu-Server). Browse to a location to create the virtual machine (<VM directory>\Ubuntu-Server). Create a new directory if you have not already.

Press "Next". The "Specify Disk Capacity" window will appear, as shown below.

Figure 5: VmWare Workstation Select Disk Characteristics

The size of the disk and whether the disk is stored as single or multiple files are user preferences. Select "single file" and 32GB (Home Assistant Recommended) disk size. Click "Next". The VmWare Workstation "Ready to Create Virtual Machine" window will appear, as shown below.

Figure 6: VmWare Workstation Ready to Create VM

Press "Customize Hardware". The customize hardware window will appear, as shown below.

Figure 7: VmWare Workstation Configure Hardware

Choose the desired memory size and number of processors, a user preference. 2GB of memory and 2 processors are recommended. For the network, select "Bridged", "Replicate physical network connection state", "Connect at power on". Press "Close". This will return you to the "Create VM window Figure 6). Press "Finish".

The virtual machine will start and display the Ubuntu console.

3.2.1      Configure Ubuntu Server Virtual Machine

Immediately after creating the Ubuntu Server VM (previous section), Ubuntu Server will boot for the first time.

From within the virtual machine console window, perform the following steps, selecting (cursor keys, tab for next field) the operation before pressing "enter":

  • Select installation language.
  • Choose to update installer, if asked. This will download and install any updates available since the ISO was created.
  • Select your keyboard type.
  • Choose (if correct) detected host network interface, DHCP. If incorrect, choose the correct interface, DHCP.
  • If a proxy is required for internet access, enter it.
  • If an alternative mirror is desired for Ubuntu packages, enter it. Using default is recommended.
  • Select "Use Entire Disk", no LVM
  • Select default (/dev/sda) for install disk.
  • Select default filesystem setup.
  • Accept "confirm destructive action" ("continue") to create system disk (wiping any previous data, which is none).
  • Fill in your name, server name ("ubuntu-server"), username, password with same values entered during "Personalize Linux" above.
  • Choose to install "OpenSSH server"
  • Do not install any other packages.
  • The download and install process will begin. May take a while.
  • When done, will display "Installation Complete". Select "Reboot".
  • When console messages end, press enter and login with your user ID and password (entered above).
  • Enter "sudo apt install net-tools" for the "ifconfig" command. It will be required later to determine MAC address to assign a pseudo static IP address (for the VM) later.

While within the VmWare guest operating system window, press "CTL+ALT" at any time to return mouse and keyboard control to your PC.

3.2.2      Test Virtual Machine on PC

Now that your virtual machine has been created and, optionally additional applications / services installed, it can be tested on the PC which was used to create it.

After the virtual machine was created, the VmWare Workstation window will be at a login command prompt. Enter "<your user ID>" as the username and the password configured during installation to login. The VmWare window will display the Ubuntu Server command prompt, as shown below.

Figure 8: Ubuntu Server Command Prompt

Hint: If console copy and paste is required, it is best to login to your virtual machine with PuTTY using the IP address and password chosen during VM creation.

If Ubuntu updates are available, enter the following commands to update: "sudo apt update; sudo apt upgrade". Ubuntu will update to the latest packages. Each time "sudo" is used (as it must be for administrator commands), Ubuntu will prompt for a password.

Note: It is unnecessary to install VmWare Tools on Ubuntu Server. This has been replaced by "open-vm-tools" which is installed by default.

Enable shared folders (with host PC) mounts by entering "sudo echo "vmhgfs-fuse /mnt/hgfs fuse defaults,allow_other 0 0" > /etc/fstab" from a command prompt within the virtual machine.

Power off the virtual machine by entering "sudo shutdown now".

The ISO file used for creation is no longer needed and can be deleted.

This virtual machine will be used in subsequent sections as the basis for other virtual machines. Do not modify it further. It will be copied prior to modification for other virtual machines.

4      Hassio Virtual Machine

4.1                Pre-Configured Hassio Virtual Machine

As a convenience, a pre-configured Hassio virtual machine (created from instructions in next section) is available to download by registered SecureOffice users.

The virtual machine has the following configuration: user: "administrator", password "admin_54321", HA user: "admin", password: "admin_54321".

Download Hassio Virtual Machine. When prompted, enter your SecureOffice user ID and password. Open the file with winrar and extract it to your virtual machine directory.

Once extracted, start Vmware Workstation player, select "Open a Vurtual Machine", navigate to <your VM directory>/Hassio-Ubuntu-Server and select Hassio-Ubuntu-Server.vmx to start the virtual machine.

When asked whether you moved or copied the virtual machine, select "I Copied It". This will generate a new MAC address and make the VM unique. The virtual machine will boot and prompt for login.

Enter "ifconfig" to determine its IP and MAC addresses. Copy the MAC address down to be used for subsequent pseudo-static IP address assignment.

Go to Test Virtual Machine and then Assign static IP.

4.2                Create Hassio Virtual Machine

A Hass.io virtual machine hosted on Ubuntu Server will be created from the generic Ubuntu server image created previously. It is intended to provide a virtual machine for Hass.io with the ability to install other (non-Hass.io) packages / services on the virtual machine. This is the most common (read: largest user base and online HowTo's) and flexible Home Assistant option.

Copy the directory called "Ubuntu-Server" (created previously) to another directory where your virtual machines are stored. Rename the copied directory to "Hassio-Ubuntu-Server". Rename all files (in the directory) named "Ubuntu-Server.<extension>" to " Hassio-Ubuntu-Server.<extension>" where "<extension>" is the portion of the filename to the right of ".", preserving (not changing) the extension.

Edit file "Hassio-Ubuntu-Server.vmx", changing all occurrences of "Ubuntu-Server" to "Hassio-Ubuntu-Server". Save the file.

Open VmWare Workstation, select "Open a Virtrual Machine", navigate to the Hassio-Ubuntu-Server VM directory, select " Hassio-Ubuntu-Server.vmx", select "Open", then "Play Virtual Machine".

When asked whether you moved or copied the virtual machine, select "I Copied It". This will generate a new MAC address and make the VM unique. The virtual machine will boot and prompt for login.

Login to the virtual machine using the same user and password created in Section 2.

If updates are available, enter "sudo apt-get update && sudo apt-get upgrade -y" to update the OS and packages.

Enter "ifconfig" to determine its IP and MAC addresses. Copy the MAC address down to be used for subsequent pseudo-static IP address assignment.

Use the IP address to access the VM using Putty or another SSH client. This provides copy and paste ability for subsequent configuration.

The following instructions are from the hassio-installer method for generic Linux which is the most popular method to install Hass.io on real or virtual machines.

From within the virtual machine (VM console or Putty session), enter the following commands (without outer quotes, keeping any inner quotes):

  • "sudo apt -y install postgresql postgresql-client"
  • "sudo apt -y install python3-psycopg2"
  • "sudo su - -c "/usr/bin/psql -c \"ALTER USER postgres WITH PASSWORD 'postgres';\"" postgres"
  • "sudo su - -c "/usr/bin/createdb hass" postgres"
  • "sudo apt -y install apt-transport-https ca-certificates curl software-properties-common lsb-release"
  • "curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -"
  • Enter "lsb_release -a" to verify the Ubuntu version for the next command.
  • 'sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu eoan test"'. Include everything between, not including single quotes. "eoan" (Ubuntu Version) may have to be replaced with the version determined previously. If the command does not work, this means that docker has not yet caught up to Ubuntu release, so, use "eoan".
  • "sudo apt update"
  • "sudo apt -y install docker-ce bash jq avahi-daemon dbus apparmor-utils network-manager". Wait for completion.
  • "cd /tmp; wget https://raw.githubusercontent.com/home-assistant/supervised-installer/master/installer.sh; chmod +x installer.sh".
  • Enter "sudo ./installer.sh". Enter "not supported" when prompted. Wait for Hass.io installation to complete.
  • Enter "sudo systemctl disable ModemManager". ModemManager interferes with serial Z-Wave and Zigbee devices.
  • Next two commands configure HA to load all automations (*.yaml files) from "/usr/share/hassio/homeassistant/automations" directory as opposed to single file "/usr/share/hassio/homeassistant/ automations.yaml" which can get large and confusing. Best to configure automations in separate files per automation.
  • Enter "sudo mkdir -p /usr/share/hassio/homeassistant/automations"
  • Enter "sudo sed -i 's#include automations.yaml#include_dir_merge_list automations/#g' /usr/share/hassio/homeassistant/configuration.yaml"
  • Enter "sudo docker ps" to display running docker containers as confirmation that Hass.io is running.

Home Assistant should be available (browser) at <Virtual Machine LAN Address>:8123. You should see the initial "create user account" page as shown below. Note that you will not see the left column, since HA is not yet integrated with the SecureOffice menu system. If not, verify all steps and try again.

Figure 9: HA Registration

To create the initial HA owner account, enter your name, user name, password and select "Create Account".

The next page will allow you to name and detect your location and select units of measurement. Configure according to your preferences. Press "Next", then "Finish".

The Home Assistant main page will be show, as below.

Figure 10: HA Main Page

If this virtual machine is intended to run under SecureOffice, first proceed to VmWare Workstation Preparation, then continue to the next section.

Otherwise proceed to the next section.

4.3                Assign Static IP Address to Home Assistant

A static LAN IP address is required for servers, since the address needs to be predictable across boots to access Home Assistant.

In choosing a LAN IP address for Home Assistant, be aware of and conform to the SecureOffice IP address numbering plan.

There are two ways to assign IP addresses to servers: (1) by configuring the server for a static IP, or (2), use a pseudo-static address assigned by the SecureOffice DHCP server which allows central control of static IP addresses.

Assigning static IP addresses via server configuration is discouraged, since it is prone to duplicate IP addresses, due to lack of a central place to configure IP addresses. It is also OS distribution specific. To assign a static IP address to Ubuntu Server, search "Ubuntu Server static IP".

You will need the IP address chosen above (numbering plan) and the Home Assistant MAC address previously determined to assign a pseudo-static IP address (preferred method).

Home Assistant will be accessible by name both locally and using remote VPN. Subsequent configuration instructions depend on this step.

The Home Assistant LAN Address will be used by the Nginx webserver and remote access to Home Assistant, which is not accessible by IP address. A DNS hostname of "home-assistant" will be assigned.

Using the Home Assistant LAN IP address, MAC address and "home-assistant" for hostname, assign a pseudo-static IP address using this method (recommended) which relates MAC to IP address and DNS name.

After the pseud-static IP address has been configured, from a SecureOffice console enter: "/etc/init.d/dnsmasq stop; rm -f /tmp/dhcp.leases; /etc/init.d/dnsmasq start" to restart the SecureOffice DHCP server with updated configuration.

The virtual machine needs to be rebooted to acquire the new IP address. Confirm the address is in correct by entering "ifconfig" in the VM console. Fix if not.

You can now "ping home-assistant" rather than remember the IP address.

This also makes it easy to change the LAN IP address of Home Assistant in one place, as opposed to multiple configuration files for nginx and clients using remote VPN.

4.4                Share Host PC Folders With VM

Shared folders are useful as a mechanism for transferring files between host PC's and VM's.

This step must be performed after the VM is installed and running on the destination host PC which may be SecureOffice, otherwise the correct paths will not exist on the PC.

To enable a shared folder, using the SecureOffice VmWare player GUI (SecureOffice Xorg console), navigate to "Player->Manage->Virtual Machine Settings->Options->Shared Folders". Select "Always Enabled": and press "Add". The "Add Shared Folder" window will appear as shown below.

Figure 7: VmWare Add Shared Folder

Enter the "Host Path" and "Name" as shown above, press "Next". The shared directory will be "/tmp" on SecureOffice and "/mnt/hgfs/Temp" within your VM. This directory will be used for file transfer between SecureOffice and the VM.

Technologies Used:

Design by: XOOPS UI/UX Team