Azure, Microsoft's cloud platform, offers a diverse ecosystem that includes robust support for Linux virtual machines (VMs). In this step-by-step guide, we'll explore how to deploy a Linux VM in Azure and connect to it using SSH, making it a breeze to harness the power of Linux in the cloud.
Prerequisites
Before we embark on our Azure Linux VM journey, make sure you have the following essentials:
Azure Account: You'll need an Azure account to access the Azure portal. If you don't have one, you can sign up for a free trial.
SSH Client: Ensure you have an SSH client installed on your local machine. On Windows, you can use tools like PuTTY or the built-in OpenSSH client. On macOS and Linux, the OpenSSH client is pre-installed.
Step 1: Sign in to Azure Portal
Start by logging in to the Azure portal using your Azure account credentials.
Step 2: Create a Linux Virtual Machine
In the Azure portal, click on "Create a resource."
Search for "Ubuntu Server" or your preferred Linux distribution in the marketplace.
Select the version you want and click "Create."
In the "Basics" tab of the virtual machine creation wizard, provide the following details:
Subscription: Choose your Azure subscription.
Resource group: Create a new one or use an existing group.
Virtual machine name: Give your VM a unique name.
Region: Select the Azure region where your VM will be hosted.
Image: Choose the Linux distribution and version.
Size: Pick an appropriate VM size based on your needs.
In the "Administrator account" section, provide a username and secure password for your VM's administrator account. Alternatively, you can use SSH keys for authentication but here we use username and password.
In the "Inbound port rules" section, ensure that "SSH (22)" is allowed for connecting via SSH.
Review your settings and click "Next."
Complete the remaining steps (disks, networking, management, and advanced) based on your requirements. You can typically accept the default settings for a basic VM setup, click "Review + Create.".
Review your configuration, and click "Create" to provision your VM.
Step 3: Connect via SSH
After Azure deploys your VM, navigate to your VM's details in the Azure portal.
Click on "Connect" under the Settings blade.
Under the "Connect" menu, you'll find instructions for connecting to your VM. It should look something like this:
shell
Copy code
ssh username@your-vm-ip-address
Replace username with your VM's username and your-vm-ip-address with the VM's public IP address.
Open your terminal or SSH client and paste the SSH command. Press Enter.
You'll be prompted to enter the password for the user you specified during VM creation. If you're using SSH keys, you may be prompted for the passphrase associated with the private key but here we use password.
Voilà ! You're now connected to your Linux VM in Azure. You can start using it just like a local Linux machine.
From here, you can manage your Azure Linux VM as needed. You can install software, configure services, and host web applications, all within your Azure environment.
Conclusion
Deploying a Linux VM in Azure and connecting to it via SSH is a valuable skill for developers, sysadmins, and anyone working in the cloud. It empowers you to leverage Azure's infrastructure while harnessing the capabilities of Linux. Whether you're running web servers, databases, or development environments, Azure offers a robust platform for all your Linux needs. So go ahead, explore, experiment, and make the most of Azure's Linux-friendly ecosystem!
Top comments (0)