Main Content

Create a Linux Virtual Machine by Using Hyper-V

You can install Polyspace® Access on Windows Server® 2016 and 2019 by creating a virtual machine (VM) that runs a Linux distribution, and then installing Polyspace Access inside that VM.

Warning

The use of Polyspace Access inside a VM might result in up to a 50% overhead during I/O operations compared to using Polyspace Access on a physical machine.

Prerequisites

Before you create the VM:

  • Make sure that Hyper-V is enabled on your machine.

    Open PowerShell by pressing the Windows+X keys and clicking Windows PowerShell (Admin).

    In the PowerShell command prompt, enter:

    (Get-WindowsOptionalFeature -featurename Microsoft-hyper-v -online).state
    If the command does not return Enabled, enter:
    Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart 
    The command enables Hyper-V and restarts your machine.

    Open the Hyper-V Manager by pressing the Windows key and typing HyperV, then click Action > Connect to Server and select Local computer.

  • Make sure that an external virtual switch has been created in Hyper-V.

    In a PowerShell command prompt, enter:

    Get-VMSwitch | where SwitchType -eq 'External'
    If the command does not return anything, follow these instructions to create an external virtual switch. Running this command might require administrator privileges.

  • Download an ISO image for a Linux distribution that is supported by Docker, for instance Ubuntu Server. For a list of Linux distributions that are available for Docker Engine or Docker Engine Enterprise(EE), see supported platforms for Docker Engine and Docker EE on Linux distros.

  • Download and install the network license manager. See Install License Manager.

Create a Virtual Machine

To create a virtual machine, open the Hyper-V manager. In the Actions pane, click New > Virtual Machine.

Follow the prompts in the New Virtual Machine Wizard window.

  • For the Specify Generation step, select Generation 2.

  • For the Assign Memory step, allocate enough memory to meet the requirements for Polyspace Access. The recommended minimum memory is 32 GB.

  • For the Configure Networking step, select the switch that corresponds to the external connection type.

  • For the Connect Virtual Hard Disk step, the size of the virtual hard drive must meet the requirements of the Polyspace Access database. The recommended minimum disk size is 500 GB.

  • For the Installation Options step, select Install an operating system from a bootable image file, and provide the path to the Linux ISO image that you downloaded.

After you click Finish and the wizard closes, right-click the newly created VM in the Virtual Machines pane and click Settings. In the settings window, click Security in the left pane, select Enable Secure Boot and, choose Microsoft UEFI Certificate Authority from the Template drop-down. Secure boot helps preventing the loading utility of the operating system from running unauthorized code at boot time. For a list of Linux distributions that Microsoft supports for secure boot, see Supported Linux and FreeBSD virtual machines for Hyper-V on Windows.

Start and Configure the Virtual Machine

To start the virtual machine (VM), in the Hyper-V manager, right-click the VM name in the Virtual Machines pane, and then click Connect. If this is the first time that you are starting the VM, follow the prompts to install the Linux distribution you specified in the Installation Options step when you created the VM.

During this installation process, you specify a hostname for the Linux machine and a username and password to log into the Linux machine. Enter this password when you use the sudo command in later configuration steps.

After you install the Linux distribution, restart the VM and open a Linux command-line terminal.

  • Install the Docker engine. For installation instructions, see the Docker documentation ,for instance Get Docker Engine - Community for Ubuntu.

    Once you install the Docker engine, add the current user to the docker group. Only users that are in the docker group can run Docker commands. In the terminal, enter:

    sudo usermod -aG docker $USER

  • Install the openssl utility. The utility allows you to generate public/private key pairs to configure the User Manager service and to generate the necessary certificates if you enable HTTPS for Polyspace Access. For instance, on Ubuntu, enter this command:

    sudo apt install openssl
    If openssl is already installed, this command has no effect.

  • Install the openssh-server server and make sure that port 22 is enabled in the firewall configuration. You can then remote into the Linux machine by using SSH or securely transfer files to the Linux machine. For instance, on Ubuntu, enter these commands:

    sudo apt install openssh-server
    sudo ufw allow 22
    If openssh-server is already installed, the install command has no effect. Once you complete this step, you can use a command such as scp to securely transfer files between your Windows Server 2016 machine and the Linux VM.

    For example, if you use username accessUser to log into the Linux VM with hostname access-vm-lnx, you can transfer file myFile.txt by entering this command from the Windows Server machine:

    scp pathTO\myFile.txt accessUser@access-vm-lnx:~
    The command copies the file to folder /home/accessUser on the Linux VM.

    pathTO is the path to myFile.txt.

  • Once you complete the previous configuration steps, restart the VM.

To install Polyspace Access, see Install Polyspace Access for Web Reviews (Polyspace Bug Finder) and Manage Polyspace NNU Licenses (Polyspace Bug Finder).