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.
- Create a new virtual machine (VM). Note when you click the create button choose the virtual machine hosted by Azure
- Create a resource group, a resource group container that holds our virtual machine.
- let's give our VM the name of mylinux, you can select a Region or use the default.
- 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
- 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.
- 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.
Then select Review + Create. if there is no omission or error it will show Validation passed
Then select Create.
Step-by-step guide to dissociating the IP address and associating the IP Address.this is your virtual machine and IP address
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.locate associate click on it Resource type select the network interface on the network interface select your IP and confirm it
Connect to the Linux Virtual machine
- On your virtual machine (VM) locate and copy your public IP address
- Open PowerShell on your system and type ssh username@IP click enter to connect your VM
- 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
- 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).
- Change your directory to root using the command - sudo su.
- Run the following commands to ensure the package list is up-to-date: sudo apt update 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)
- Congratulations you have installed Node.js, to Verify the installation: type node -v npm -v
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)
Welldone!