Table_of_Contents
2 Virtual Machine Pre-requisites
3.1 Pre-Configured Ubuntu Virtual Machine
3.2 Create Ubuntu Virtual Machine
3.2.1 Configure Ubuntu Server Virtual Machine
4.1 Pre-Configured Hassio Virtual Machine
4.2 Create Hassio Virtual Machine
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: Missing Ubuntu File /etc/securetty
Figure 10: VmWare Workstation Configure CD
Ubuntu server edition uses the same APT package 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 or any other x86_64 based host PC for general purpose server applications using online HowTo's. Any application / service that works on Ubuntu will work in this virtual machine.
Home Assistant Supervised (HA, hassio) is used as an example for adding a service to the Ubuntu virtual machine. Before choosing this approach for running Home Assistant under SecureOffice or in any other environment, please review what is Home Assistant and Home Assistant installation options.
Prior to installing any virtual machines on SecureOffice, it is recommended to first get the virtual machine running on a Windows PC. Experienced Linux users can choose to install on a Linux system. All screenshots below and the pre-configured virtual machines were created on a SecureOffice system using the premium VmWare Workstation package.
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 the free 7-Zip utility (Windows users).
As a convenience, a pre-configured Ubuntu-Server virtual machine (created using instructions in next section) is available for download by registered SecureOffice users. Do not use this VM if it is intended to be used for Home Assistant. Instead, download the pre-configured Hassio virtual machine.
Both pre-configured virtual machines have the following configuration: user: "administrator", password "admin_54321".
Download Ubuntu Server Virtual Machine using a PC connected to the SecureOffice LAN only (otherwise, access will be denied due to wrong domain) from the SecureOffice custom repository. When prompted, enter your SecureOffice user ID and password (as previously entered in "/etc/opkg.conf") to download the virtual machine (Ubuntu-Server.tar.gz). "LAN only" means disable all network interfaces except the connection to the SecureOffice LAN (wired or WiFi).
Another (easier, no disabling network interfaces) download method is using a SecureOffice command prompt: "cd /home/data/Vmware; sget ../Files/Ubuntu-Server.tar.gz" which will place the file in /home/data/Vmware (which must have at least 40GB of free space. Use another directory if insufficient free space on "/home/data/Vmware" such as a mounted USB disk).
If using a Windows PC, open the file with 7-Zip and extract it to your virtual machine directory.
If using a Linux PC, extract the file by entering "cd <directory for virtual machine>; tar -zxvf <path to Ubuntu-Server.tar.gz>"
Copy or move the virtual machine directory to the server that will host it.
Once VmWare and the virtual machine is installed on the PC that will host it, 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.
If 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.
If this VM is intended to provide network services, it must be assigned a fixed IP address (conforming to IP address numbering plan) and LAN DNS name for port forwarding (if necessary) and / or proxying by SecureOffice Nginx webserver.
Further VM configuration is dependent on the intended purpose and services to be provided.
The following instructions can be used to create Virtual Machines (VMs) under Windows, Linux or SecureOffice / VmWare Workstation once the premium VmWare Workstation package is installed on SecureOffice.
The resulting Ubuntu virtual machine can be used as the base OS for other virtual machines such as Home Assistant.
If creating the virtual machine on a Windows PC, download the latest version of Ubuntu Server x86_64 ISO from this site[r1] (use download option 3, manual install).
If creating the virtual machine on a Linux machine (such as SecureOffice), enter: "cd /home/data; wget https://releases.ubuntu.com/20.04/ubuntu-20.04.1-live-server-amd64.iso". This will download the latest version of Ubuntu Server (as of when this article was written).
Other Ubuntu versions can be browsed and downloaded from https://releases.ubuntu.com/.
Create a directory called "Ubuntu-Server" where your virtual machines are stored.
Start VmWare Workstation on your PC. The main screen will appear, as shown below.
Note that the VmWare version may not match the figures below, since VmWare Workstation is updated on a regular basis.
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, the root account is locked under Ubuntu. Therefore, you cannot log in as root or use "su -" command to become a superuser. To run 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. The preconfigured virtual machine (from this site) uses "administrator", "administrator", "admin_54321" as default account full name, user and password respectively. 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. Skip or cancel any notifications regarding devices, Vmware or Vmware Tools updates.
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":
After virtual machine creation and reboot, the VmWare Workstation window will be at a login command prompt. When console messages end, press enter for a login prompt and enter "<your user ID>" as the username and enter 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: while within the VmWare guest operating system window, press "CTL+ALT" at any time to return mouse and keyboard control to your PC.
From within the virtual machine console window, type the following commands (no copy / paste available):
Each time "sudo" is used (as it must be for administrative 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 was installed previously.
If console copy and paste is required, it is best to login to your virtual machine with PuTTY using the IP address (determined below) and password chosen during VM creation.
From within the virtual machine console, enter "ifconfig" to determine the VM IP address. SSH (PuTTY) into the VM using the VM IP address and your Ubuntu user name and password.
Enable shared folders (with host PC) mounts by entering (SSH console session) "sudo nano /etc/fstab". Add a line at file end containing "vmhgfs-fuse /mnt/hgfs fuse defaults,allow_other 0 0".
Ubuntu 20.04.1 is missing a file which will flood the log with warnings as reported here. The fix is to use nano (from within SSH console session) to create file "/etc/securetty" and paste file contents from the previous link or from figure below:
# /etc/securetty: list of terminals on which root is allowed to login.
# See securetty(5) and login(1).
console
# Local X displays (allows empty passwords with pam_unix's nullok_secure)
:0
:0.0
:0.1
:1
:1.0
:1.1
:2
:2.0
:2.1
:3
:3.0
:3.1
#...
# ==========================================================
#
# TTYs sorted by major number according to Documentation/devices.txt
#
# ==========================================================
# Virtual consoles
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
tty12
tty13
tty14
tty15
tty16
tty17
tty18
tty19
tty20
tty21
tty22
tty23
tty24
tty25
tty26
tty27
tty28
tty29
tty30
tty31
tty32
tty33
tty34
tty35
tty36
tty37
tty38
tty39
tty40
tty41
tty42
tty43
tty44
tty45
tty46
tty47
tty48
tty49
tty50
tty51
tty52
tty53
tty54
tty55
tty56
tty57
tty58
tty59
tty60
tty61
tty62
tty63
# UART serial ports
ttyS0
ttyS1
ttyS2
ttyS3
ttyS4
ttyS5
#...ttyS191
# Serial Mux devices (Linux/PA-RISC only)
ttyB0
ttyB1
#...
# Chase serial card
ttyH0
ttyH1
#...
# Cyclades serial cards
ttyC0
ttyC1
#...ttyC31
# Digiboard serial cards
ttyD0
ttyD1
#...
# Stallion serial cards
ttyE0
ttyE1
#...ttyE255
# Specialix serial cards
ttyX0
ttyX1
#...
# Comtrol Rocketport serial cards
ttyR0
ttyR1
#...
# SDL RISCom serial cards
ttyL0
ttyL1
#...
# Hayes ESP serial card
ttyP0
ttyP1
#...
# Computone IntelliPort II serial card
ttyF0
ttyF1
#...ttyF255
# Specialix IO8+ serial card
ttyW0
ttyW1
#...
# Comtrol VS-1000 serial controller
ttyV0
ttyV1
#...
# ISI serial card
ttyM0
ttyM1
#...
# Technology Concepts serial card
ttyT0
ttyT1
#...
# Specialix RIO serial card
ttySR0
ttySR1
#...ttySR511
# Chase Research AT/PCI-Fast serial card
ttyCH0
ttyCH1
#...ttyCH63
# Moxa Intellio serial card
ttyMX0
ttyMX1
#...ttyMX127
# SmartIO serial card
ttySI0
ttySI1
#...
# USB dongles
ttyUSB0
ttyUSB1
ttyUSB2
#...
# LinkUp Systems L72xx UARTs
ttyLU0
ttyLU1
ttyLU2
ttyLU3
# StrongARM builtin serial ports
ttySA0
ttySA1
ttySA2
# SCI serial port (SuperH) ports and SC26xx serial ports
ttySC0
ttySC1
ttySC2
ttySC3
ttySC4
ttySC5
ttySC6
ttySC7
ttySC8
ttySC9
# ARM "AMBA" serial ports
ttyAM0
ttyAM1
ttyAM2
ttyAM3
ttyAM4
ttyAM5
ttyAM6
ttyAM7
ttyAM8
ttyAM9
ttyAM10
ttyAM11
ttyAM12
ttyAM13
ttyAM14
ttyAM15
# Embedded ARM AMBA PL011 ports (e.g. emulated by QEMU)
ttyAMA0
ttyAMA1
ttyAMA2
ttyAMA3
# DataBooster serial ports
ttyDB0
ttyDB1
ttyDB2
ttyDB3
ttyDB4
ttyDB5
ttyDB6
ttyDB7
# SGI Altix console ports
ttySG0
# Motorola i.MX ports
ttySMX0
ttySMX1
ttySMX2
# Marvell MPSC ports
ttyMM0
ttyMM1
# PPC CPM (SCC or SMC) ports
ttyCPM0
ttyCPM1
ttyCPM2
ttyCPM3
ttyCPM4
ttyCPM5
# Altix serial cards
ttyIOC0
ttyIOC1
#...ttyIOC31
# NEC VR4100 series SIU
ttyVR0
# NEC VR4100 series SSIU
ttyVR1
# Altix ioc4 serial cards
ttyIOC84
ttyIOC85
#...ttyIOC115
# Altix ioc3 serial cards
ttySIOC0
ttySIOC1
#...ttySIOC31
# PPC PSC ports
ttyPSC0
ttyPSC1
ttyPSC2
ttyPSC3
ttyPSC4
ttyPSC5
# ATMEL serial ports
ttyAT0
ttyAT1
#...ttyAT15
# Hilscher netX serial port
ttyNX0
ttyNX1
#...ttyNX15
# Xilinx uartlite - port
ttyUL0
ttyUL1
ttyUL2
ttyUL3
# Xen virtual console - port 0
xvc0
# pmac_zilog - port
ttyPZ0
ttyPZ1
ttyPZ2
ttyPZ3
# TX39/49 serial port
ttyTX0
ttyTX1
ttyTX2
ttyTX3
ttyTX4
ttyTX5
ttyTX6
ttyTX7
# SC26xx serial ports (see SCI serial ports (SuperH))
# MAX3100 serial ports
ttyMAX0
ttyMAX1
ttyMAX2
ttyMAX3
# OMAP serial ports
ttyO0
ttyO1
ttyO2
ttyO3
# User space serial ports
ttyU0
ttyU1
# A2232 serial card
ttyY0
ttyY1
# IBM 3270 terminal Unix tty access
3270/tty1
3270/tty2
#...
# IBM iSeries/pSeries virtual console
hvc0
hvc1
#...
#IBM pSeries console ports
hvsi0
hvsi1
hvsi2
# Equinox SST multi-port serial boards
ttyEQ0
ttyEQ1
#...ttyEQ1027
# ==========================================================
#
# Not in Documentation/Devices.txt
#
# ==========================================================
# Embedded Freescale i.MX ports
ttymxc0
ttymxc1
ttymxc2
ttymxc3
ttymxc4
ttymxc5
# LXC (Linux Containers)
lxc/console
lxc/tty1
lxc/tty2
lxc/tty3
lxc/tty4
# Serial Console for MIPS Swarm
duart0
duart1
# s390 and s390x ports in LPAR mode
ttysclp0
# ODROID XU4 serial console
ttySAC0
ttySAC1
ttySAC2
ttySAC3
Figure 9:Missing Ubuntu File /etc/securetty
Power off the virtual machine by entering "sudo shutdown now".
Ubuntu / Home Assistant requires udev to generate "/dev/disk/by-id" entries which default VmWare virtual machine configuration does not provide. Further information is available here. The fix is to add a configuration entry to the virtual machine configuration. Add a line containing 'disk.EnableUUID = "TRUE"' (omitting outer single quotes) at the end of the VM configuration file ("Ubuntu-Server/Ubuntu-Server.vmx").
Start VmWare Workstation (not virtual machine), select "Ubuntu-Server", select "Virtual Machine Settings". Delete all CD/DVD drives except the first drive. Configure the first (and only) drive for "not Connected", "not connect on power on", "use a physical drive", "Auto Detect" as shown below:
Figure 10:VmWare Workstation Configure CD
The ISO file used for VM creation is no longer needed and can be deleted.
This virtual machine is used as the basis for a Hassio (Home Assistant Supervised) virtual machine. The previous VM creation / configure instructions were used to create the preconfigured "Ubuntu-Server.tar.gz" virtual machine archive.
Do not modify the VM further. It will be copied prior to modification for other virtual machines.
If this VM is intended to provide other (not Home Assistant) network services, it must be assigned a fixed IP address (conforming to IP address numbering plan) and LAN DNS name for port forwarding (if necessary) and / or proxying by the SecureOffice Nginx webserver.
Further VM configuration is dependent on the intended purpose and services to be provided.
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 using a PC connected to the SecureOffice LAN only (otherwise, access will be denied due to wrong domain) from the SecureOffice custom repository. When prompted, enter your SecureOffice user ID and password (as previously entered in "/etc/opkg.conf") to download the virtual machine (Hassio-Ubuntu-Server.tar.gz). "LAN only" means disable all network interfaces except the connection to the SecureOffice LAN (wired or WiFi).
Another (easier, no disabling network interfaces) download method is using a SecureOffice command prompt: "cd /home/data/Vmware; sget ../Files/Hassio-Ubuntu-Server.tar.gz" which will place the file in /home/data/Vmware (which must have at least 40GB of free space. Use another directory if insufficient free space on "/home/data/Vmware" such as a mounted USB disk).
If using a Windows PC, open the file with 7-Zip and extract it to your virtual machine directory.
If using a Linux PC, extract the file by entering "cd <directory for virtual machine>; tar -zxvf <path to Hassio-Ubuntu-Server.tar.gz>"
Copy or move the virtual machine directory to the server that will host it.
Once extracted, start Vmware Workstation player, select "Open a Virtual Machine", navigate to "<your VM directory>/Hassio-Ubuntu-Server" and select "Hassio-Ubuntu-Server.vmx" to start the virtual machine.
If 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 the VM IP and MAC addresses. Copy the MAC address down to be used for subsequent pseudo-static IP address assignment.
Shared folders must be enabled for this VM to allow easy file transfer between the host and VM.
This VM must be assigned a fixed IP address (conforming to IP address numbering plan) and LAN DNS name for port forwarding (if necessary) and / or proxying by the SecureOffice Nginx webserver.
Go to Home Assistant Configuration.
A Hassio (Home Assistant) virtual machine hosted on Ubuntu Server will be created from the generic Ubuntu-Server image previously created. This is the most common (read: largest user base and online HowTo's) and flexible Home Assistant option.
Copy the directory named "Ubuntu-Server" (created previously) to another directory named "Hassio-Ubuntu-Server"where your virtual machines are stored. 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.
Start VmWare Workstation, select "Open a Virtual Machine", navigate to the Hassio-Ubuntu-Server VM directory, select "Hassio-Ubuntu-Server.vmx", select "Open", then "Play Virtual Machine".
If 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 during configuration.
If updates are available, enter "sudo apt-get update && sudo apt-get upgrade -y" to update the OS and packages.
Enter "ifconfig" to determine the VM 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 Home Assistant 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):
From within the virtual machine console, enter "ifconfig" to determine the VM IP address.
If this virtual machine is intended to run under SecureOffice, power it off, proceed to VmWare Workstation Preparation and copy the VM to its final destination, then continue.
Shared folders must be enabled for this VM to allow easy file transfer between the host and VM.
This VM must be assigned a fixed IP address (conforming to IP address numbering plan) and LAN DNS name for port forwarding (if necessary) and / or proxying by SecureOffice Nginx webserver.
Go to Home Assistant Configuration.
|
Technologies Used: