DEV Community

Cover image for Create a Linux VM Work on the IP & Connect
Izuabueke Davidson  Anujulu
Izuabueke Davidson Anujulu

Posted on

Create a Linux VM Work on the IP & Connect

Setting up a virtual machine (VM) in the cloud is an important skill for system administrators, developers, and anyone looking to manage applications in a scalable and flexible environment. In this guide, I will walk you through the process of creating a virtual machine(VM) on Linux, dissociating the IP address, associating the IP Address, and also installing Node.js on the VM after connecting.

Step-by-Step Guide to Creating a Virtual Machine on (VM) Linux

  • Search for Virtual Machine and select it. Image description
  • Create a new virtual machine (VM). Note when you click the create button choose the virtual machine hosted by Azure Image description
  • Create a resource group, a resource group container that holds our virtual machine. Image description
  • let's give our VM the name of mylinux, you can select a Region or use the default. Image description
  • choose an Image. Note The image is important because it is what defines the type of VM we are creating, so we will choose Ubuntu Server 24.04 LTS Image description
  • Create an Administrator Account. There are two types of accounts, account with SSH public key and account Password, we will Use account Password and use Azureuser for the username and Password1234 for the password. Image description
  • Select Inbound Port Rules. Select SSH and HTTP (80), with SSH you will connect a Linux VM through window powershell or command line interface (CLI), but with HTTP you will access it through the browser. Image description
  • Then select Review + Create. if there is no omission or error it will show Validation passed
    Image description

  • Then select Create.
    Image description
    Step-by-step guide to dissociating the IP address and associating the IP Address.

  • Selete go to resource to access your virtual machine (VM)
    Image description

  • this is your virtual machine and IP address
    Image description
    Before we start dissociating the IP address and associating the IP Address back Note that when dissociating a dynamic IP address it will go back to the Azure IP pool and the risk is that when you want to associate it back you will not be assigning the same IP address so it will result in creating new IP, then you will lose the configurations on your virtual machine. So The first thing you will do is to make sure that your IP is a static IP address.

  • Search and click on public IP address
    Image description

  • Select your IP address
    Image description

  • locate dissociate click and confirm it
    Image description

  • locate associate click on it Resource type select the network interface on the network interface select your IP and confirm it
    Image description

Connect to the Linux Virtual machine

  • On your virtual machine (VM) locate and copy your public IP address Image description
  • Open PowerShell on your system and type ssh username@IP click enter to connect your VM

Image description

  • go to your VM locate your public IP click on it and expand the Idle timeout to 30 so that you will not be timedout and save changes Image description
  • On your PowerShell, you will be asked if you are sure you want continue to connecting Enter yes and then your password (password will not be visible while typing in Linux). Image description
  • Change your directory to root using the command - sudo su. Image description
  • Run the following commands to ensure the package list is up-to-date: sudo apt update Image description Install Node.js on a Linux Server
  • Type the command sudo apt install apt nodejs npm after some update you will be asked do you want to continue enter yes(y) Image description
  • Congratulations you have installed Node.js, to Verify the installation: type node -v npm -v

Image description

By following these steps, you’ve successfully created a Linux VM in Azure, dissociated the IP address, associated the IP Address, and installed Node.js. This setup is ready for hosting web apps, APIs, microservices, real-time applications, and more. You can integrate it with Azure’s ecosystem of services for databases, networking, storage, and monitoring while enjoying the flexibility of scaling your solution as needed.

Top comments (1)

Collapse
 
realcloudprojects profile image
Skill Schule

Welldone!