KBEC-00326 - How to Run Multiple VMs on a Host

This article describes how to create new virtual machines (VMs) for remote agents on a host.

Before performing the following procedures, the ElectricFlow Community Edition appliance should be installed, registered, and running.

VirtualBox

These are the high-level steps to run multiple VMs in VirtualBox.

  1. Create a new VM for a remote agent.
  2. Configure port forwarding for the agent machine.
  3. Install the agent.
  4. Create a resource on the server.

Creating a New VM for a Remote Agent

Use of these ways to create a new VM:

  • Using Ubuntu ISO
  • Using Vagrant

Using Ubuntu ISO

Step 1: Download the Ubuntu Server ISO image

  1. Decide what version of the Ubuntu server software that you want to install on the new VM.

  2. Go to http://www.ubuntu.com/download/server to download the Ubuntu ISO image. 

Step 2: Create a new VM in VirtualBox. 

  1. Open VirtualBox. 

  2. Click Machine > New

  3. In the Name and operating system dialog box, enter the name of the VM and select the VM type, and then click Next



  4. In the Memory size dialog box, set the memory size. We recommmend that you set the memory size to 2 GB.

  5. In the Hard disk wizard, select Create a virtual hard disk now, and click Create

  6. In the Hard disk file type dialog box, select a file type: VDI, VMDK, VHD, or HDD

  7. In the Storage on physical hard disk dialog box, select dynamically allocated or fixed-size.

    A dynamically allocated file will only grow in size when the guest actually stores data on its virtual hard disk. It will therefore initially be small on the host hard drive and only later grow to the size specified as it is filled with data.

    fixed-size file will immediately occupy the file specified, even if only a fraction of the virtual hard disk space is actually in use. While occupying much more space, a fixed-size file incurs less overhead and is therefore slightly faster than a dynamically allocated file.

  8. In the File Location and size screen dialog box, set the size to 8 GB or greater of the virtual hard disk space.

  9. Click Create to create the virtual hard disk.

    The new machine now appears in Virtualbox.



Step 3: Install the Ubuntu operating system (OS) in the Ubuntu Server ISO image. 

  1. Start the VM that you created.

    The Select start up disk dialog box opens.

  2. Browse to the Ubuntu ISO image and select it. 

  3. Click Start.

  4. Install the Ubuntu server as described in http://www.ubuntu.com/download/server/install-ubuntu-server. 

Using Vagrant

Step 1: Install Vagrant.

  1. Go to http://www.vagrantbox.es/ to select a base box (standard Vagrant template) supported by ElectricFlow agents running in VirtualBox, and get the installation steps.

  2. Copy the selected base box and install it.  

Step 2: Run the new VM.

Configuring Port Forwarding for the Agent Machine

  1. Shut down the VM if it is running.

  2. Click Settings > Network.
    The Settings dialog box opens. Only the NAT adapter should be selected. 

  3. Click Advanced.



  4. Click Port Forwarding.
    The Port Forwarding Rules dialog box opens.

  5. Configure the ssh setting as follows:
    Host port: 2222
    Guest port: 22

  6. Configure the agent_port_7801 setting as follows:
    Host port: 7801
    Guest port: 7801



    You can specify another port that should be the same as the one used in the Agent Installation configuration.  Do not use 7800 as the port number because it is already used by the agent on the ElectricFlow server.

  7. Click OK to close the Port Forwarding Rules dialog box.

  8. Click OK to close the Settings dialog box. 

Installing the Agent

  1. Copy the agent installer to the /var/tmp directory on the agent machine. 

    You can connect to the agent machine via SSH or SCP on port 2222 from host machine.

  2. Log into the agent machine.

  3. To add execute privileges to the installer file, enter a command like this:

    chmod +x /var/tmp/ElectricFlowAgent-x64-6.1.0.98353

    where ElectricFlowAgent-x64-6.1.0.98353 is the agent installer.

  4. To install the agent, enter a command like this:

    sudo /var/tmp/ElectricFlowAgent-x64-6.1.0.98353 --mode silent --installAgent --agentPort 7801 --unixAgentUser USER --unixAgentGroup GROUP

    where --agentPort should be the same port as you specified in the "Configuring Port Forwarding for the Agent Machine" section and where USER and GROUP are the system user and group under which the agent will run. 

Creating a Resource on the ElectricFlow Server

  1. Connect to the appliance via SSH.

  2. To get the IP address of the default gateway, enter this command:

    ecloud@localhost:~$ route | grep default
    default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0

    Use this IP address to access the host machine. In this example, the IP address of the default gateway is 10.0.2.2.

  3. Log into ElectricFlow using your user ID and password.

  4. To go to the ElectricFlow platform UI, do one of the following:

    In the ElectricFlow Home page, click Automations. 

    Click the Main Menu button () and then click Automations.

  5. Click Cloud > Resources.

  6. In the Resources page, click +, and then click Create Resource.



  7. In the New Resource form, enter the Name, Agent Host Name, and Agent Port Number for the new resource.

    Name: Enter any name. In this example, the name is remote_agent_resource.

    Agent Host Name: Enter the IP address of the default gateway from Step 2. In this example, it is 10.0.2.2.

    Agent Port Number: Enter the agent port number that you set for port forwarding. In this example, the port is 7801. 



  8. Ping new resource to ensure that it works.

 

VMWare Player

Prerequisite: Port forwarding is configured for the ElectricFlow Community Edition appliance.

  1. Create a new VM for a remote agent. 
  2. Install the agent.
  3. Create a resource on the ElectricFlow server.

Creating a New VM for a Remote Agent

Use of these ways to create a new VM:

  • Using Ubuntu ISO
  • Using Vagrant

Using Ubuntu ISO

Step 1: Download the Ubuntu Server ISO image

  1. Decide what version of the Ubuntu server software that you want to install on the new VM.

  2. Go to http://www.ubuntu.com/download/server to download the Ubuntu ISO image. 

Step 2: Create a new machine. 

  1. Go to the following sites depending on your appliance setup:

    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2013483

    http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002

Step 3: Install the Ubuntu operating system (OS) in the Ubuntu Server ISO image. 

  1. Install the Ubuntu server as described in http://www.ubuntu.com/download/server/install-ubuntu-server.

 

Using Vagrant

Step 1: Install Vagrant.

  1. Go to http://www.vagrantbox.es/ to select a base box (standard Vagrant template) supported by ElectricFlow agents running on VMWare Player, and get the installation steps.

  2. Copy the selected base box and install it.  

Step 2: Run the new VM.

Installing the Agent

  1. Copy the agent installer to the /var/tmp directory on the agent machine using SCP. 

    You can connect to the agent machine via SSH using the IP address of the host machine. To get this IP address, log into the machine's VMWare terminal and enter the ifconfig command.



  2. To add execute privileges to the installer file, enter a command like this:

    chmod +x /var/tmp/ElectricFlowAgent-x64-6.1.0.98353

    where ElectricFlowAgent-x64-6.1.0.98353 is the agent installer.

  3. To install the agent, enter a command like this:

    sudo /var/tmp/ElectricFlowAgent-x64-6.1.0.98353 --mode silent --installAgent --agentPort 7801 --unixAgentUser USER --unixAgentGroup GROUP

    where --agentPort should be the same port as you specified in the "Configuring Port Forwarding for the Agent Machine" section and where USER and GROUP are the system user and group under which the agent will run. 

 

Creating a Resource on the ElectricFlow Server

  1. Connect to the appliance via SSH.

  2. To get the IP address of the default gateway, enter this command:

    ecloud@localhost:~$ route | grep default
    default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0

    Use this IP address to access the host machine. In this example, the IP address of the default gateway is 10.0.2.2.

  3. Log into ElectricFlow using your user ID and password.

  4. To go to the ElectricFlow platform UI, do one of the following:

    In the ElectricFlow Home page, click Automations. 

    Click the Main Menu button () and then click Automations > Platforms / Projects.

  5. Click Cloud > Resources.

  6. In the Resources page, click +, and then click Create Resource.



  7. In the New Resource form, enter the Name, Agent Host Name, and Agent Port Number for the new resource.

    Name: Enter any name. In this example, the name is remote_agent_resource.

    Agent Host Name: Enter the IP address of the default gateway from Step 2. In this example, it is 10.0.2.2.

    Agent Port Number: Enter the agent port number that you set for port forwarding. In this example, the port is 7801. 



  8. Ping new resource to ensure that it works.

 

Configuring Repositories for Remote Agents

If you want to work with repositories from remote agents, you have to configure the repository for each remote agent.

Remote Agents on the Same Host VirtualBox

  1. Connect to the agent machine via SSH.

  2. To get the IP address of the default gateway, enter this command:

    ecloud@localhost:~$ route | grep default
    default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0

    Use this IP address to access the host machine. In this example, the IP address of the default gateway is 10.0.2.2.

  3. Log into ElectricFlow using your user ID and password.

  4. To go to the ElectricFlow platform UI, do one of the following:

    In the ElectricFlow Home page, click Automations. 

    Click the Main Menu button () and then click Automations > Platforms / Projects.

  5. Click Artifacts > Repositories.

  6. Click Add Repository to add a repository.

  7. In the New Repository page, enter the following  values: 

    Name: Enter any name. In this example, the name is agent_on_the_same_vbox_host_repo.

    URL: Enter https://IP_OF_DEFAULT_GATEWAY:8200,  where IP_OF_DEFAULT_GATEWAY is IP address from Step 2.

     


Remote Agents on the Same Host VMWare Player

  1. Connect to the ElectricFlow server where the repository is located via SSH.

  2. To get the IP address of the NAT interface using the ifconfig command, log into the server's VMWare terminal and enter the ifconfig command.



  3. Log into ElectricFlow using your user ID and password.

  4. To go to the ElectricFlow platform UI, do one of the following:

    In the ElectricFlow Home page, click Automations. 

    Click the Main Menu button () and then click Automations > Platforms / Projects.

  5. Click Artifacts > Repositories.

  6. Click Add Repository to add a repository.

  7. In the New Repository page, enter the following  values: 

    Name: Enter any name. In this example, the name is agent_on_the_same_vmware_host_repo.

    URL: Enter https://IP_OF_DEFAULT_GATEWAY:8200,  where IP_OF_DEFAULT_GATEWAY is IP address from Step 2.


 

Have more questions? Submit a request

Comments

Powered by Zendesk