DEV Community

Cover image for How to create a linux VM using custom template, associating and dissociating IP address
Afeez Adeyemo
Afeez Adeyemo

Posted on

How to create a linux VM using custom template, associating and dissociating IP address

This is a step by step procedure on how to create a Linux virtual machine (VM) using custom templates, associating and dissociating IP addresses to shut down the machine.

This will guide on how to create a Linux VM within the shortest possible time, also how to save cost by dissociating the VM's IP address when it's no longer in use and association the VM's IP when needed.

We will also learn how to create new IP addresses and associating it to an existing VM. Also how to connect a VM using windows power shell with ssh.

Below are the steps to follow:

Step 1. Creating a VM using custom templates.

Step 2. Associating and dissociating a VM's IP address.

Step 3. Creating new IP address for a VM.

Step 4. Connect and configure the VM with ssh on windows PowerShell.

1. Creating a VM using custom templates

  • Log on to azure
  • search for deploy a custom template on the task bar deploy a custom template
  • Select Create a Linux virtual machine Create a Linux virtual machine
  • On the Basics tab. You will be required to just create the resource group, username and password.
  • Create new resource group. Give it a unique name and click OK Project details
  • In the instance details
  • Set the Admin username and Admin password or Key
  • Review and Create instance details
  • Create Create
  • Wait for the resource to create, the Go to resource Go to resource

2. Associating and dissociating a VM's IP address

  • Select the simpleLinuxVM simpleLinuxVM
  • In the Overview, under the Properties tab, click on the Public IP address in the Networking section. Public IP address
  • Drag out the Idle timeout to the maximum 30 minutes. This will ensure the VM does not time out after the default 4 minutes Idle timeout
  • Click on Stop, to stop the VM from running Stop VM
    • Click on OK OK Stop
  • Stopping a VM does not stop all the cost associated to the VM. The VM's IP address is a cost on its own and can be stopped when not needed.
  • Search for Public IP address on the task bar. Public IP address
  • Select the simpleLinuxIPaddress simpleLinuxIPaddress
  • Select Dissociate and click on Yes DissociateIPaddress
  • Notice Dissociate is greyed out Dissociate greyed out
  • Select Associate to re-associate the VM with an IP address. Pick Network Interface in the resource type drop-down menu. Pick SimpleLinuxVMNetInt in the Network interface drop-down menu. Click OK Associate IP address
  • Notice Associate is greyed out. Associate greyed out
  • Go to properties of the simplelinuxVM, notice the Public IP address is now masked i.e no longer showing Public IP masked

3. Creating new IP address for a VM.

  • On the home page, search for ** Public IP address** and ** create a resource** Create Public IP address
  • Give it a name, Review and create configure an IP address
  • Create create IP address
  • To dissociate the old IP address from the VM.
  • Go to home and search for Public IP address Public IP address
  • Select Dissociate, click OK Dissociate IP address
  • Go back to Public IP address and select the new IP address select new IP
  • To associate the new IP address to the new VM. Select associate, on the menu select network interface and the VMname. OK Associate new IP
  • In the settings/configuration tab of the new IP address, drag out the idle time to maximum. To ensure the IP address does not time out too often configure idle time of IP

4 - Connect and configure the VM with ssh on windows PowerShell.

  • Search for an open Microsoft PowerShell on your computer
  • Enter command prompt ssh username@IPaddress, and enter Image description
  • Confirm you want to connect by entering Yes and enter Enter Yes
  • tEnter Password previously set. Notice you won't see the password typing out. This is a security feature for Linux. Press enter Enter password
  • To do anything into the VM, you need to enter root. Enter the command sudo suand enter. Sudo su
    • From this point you can go ahead to install anything in the VM

Please drop questions and comments in the comments section.

Top comments (0)