DEV Community

Cover image for How to Create a Linux VM using Custom Templates
Onyemachi Doris
Onyemachi Doris

Posted on

How to Create a Linux VM using Custom Templates

Table of Contents

  • Introduction
  • What is a Linux Virtual Machine?
  • What are Custom VM Templates?
  • Advantages of Using Templates over Manual Configuration
  • Steps on how to create a Linux VM using custom templates
  • Conclusion

Introduction

Virtual machines (VMs) play an essential role in today’s IT infrastructure, offering isolated environments for development, testing, and production without the need for specialized physical servers. By using custom templates to create Linux VMs, organizations can streamline the setup process, maintain consistency, and ensure reliable, repeatable deployments.

What is a Linux Virtual Machine?

A Linux Virtual Machine (VM) is a virtual version of the Linux operating system hosted on hypervisor platforms like VMware, VirtualBox, or Hyper-V. It allows you to replicate a fully functional Linux system on shared physical hardware, providing isolated software environments for better resource management and flexibility.

What are Custom VM Templates?

Custom VM templates enable quick deployment of pre-configured virtual machines. These templates serve as reusable "blueprints" that contain an operating system and software configuration, simplifying the creation of new VMs by removing the need to perform repetitive setup processes. We are going to be exploring how to create a Linux VM using a custom template in this article.

Advantages of Using Templates over Manual Configuration

Some of the advantages of using custom VM templates include;

Efficiency: It instantly launch new VMs without the need for manual configuration.
Consistency: It ensure uniform configuration across all deployed VMs.
Scalability: It simplifies the management of multiple VMs in large-scale operations.

Steps on how to create a Linux VM using custom templates

To set up a Linux virtual machine (VM) using a custom template, you essentially need three key components: a resource group, a username, and a password.

Resource Group: This is a logical container in which similar Azure resources are deployed and managed. It helps you organize and control access to the resources associated with your VM, such as networking, storage, and compute resources.

Username: This is the administrative account name you’ll use to access the VM. It’s important to choose a unique username that complies with the naming conventions of your cloud provider.

Password: Along with the username, you’ll set a secure password to protect your VM. This password should be strong and complex, combining letters, numbers, and special characters, to enhance security.

step 1: Search for "deploy a custom template" on your Azure portal.

Image description

Step 2: Select "create a Linux virtual machine.

Image description

Step 3: Add your resource group, username and password. Click "Review + Create" and then "create".

Image description

Step 4: After deployment, click "Go to Resource Group"

Image description

Step 5: Select simple Linux VM because that's the VM we created.

Image description

How to stop the VM

You have to stop the VM so it won't be incurring cost when not in use. To do this; click on "Stop"

Image description

If you stop it by using the "Stop" button only, it will still be incurring cost. So, you have to dissociate the IP address of the Linux VM.

Dissociate the IP address.

  • Search and click Public IP address.

Image description

  • Select the Linux VM

Image description

  • Click on "Dissociate"

Image description

Let's say you want to associate the IP address to the VM again. This is how to do achieve that.

  • On the same page, click "Associate" button Fill in your resource group details and click "OK" as shown below.

Image description

How to Connect to a Linux VM using Password Authentication

  • Launch a text editing program, such as Microsoft Word.
  • Type ssh username@ipaddress
  • For example; ssh azureuser@4.248.39.78
  • Copy all. Open your Windows PowerShell as Admin and paste.

Conclusion

In summary, creating a Linux virtual machine (VM) with a custom template streamlines deployment by ensuring consistency, faster configuration, and environments specifically tailored to unique requirements. This approach facilitates easier management and scalability in cloud environments, where resource groups, usernames, and passwords can be securely established according to organizational standards.

Top comments (0)