[Azure] I tried to create a Linux virtual machine in Azure of Microsoft Learn

Introduction

The author was originally studying AWS, but for some reason it became necessary to study Azure. I think there are fewer articles about Azure than AWS, so what I did with Azure Learn with screenshots I want to keep it as a memorandum.

procedure

Here materials are used.

Create a Linux virtual machine in the Azure portal

Create a new Linux virtual machine

Select to create a resource. スクリーンショット 2020-11-21 18.50.51.png Enter Ubuntu Server in the search box. スクリーンショット 2020-11-21 15.59.20.png Select Ubuntu Server 18.04 LTS Canonical. スクリーンショット 2020-11-21 15.59.50.png Press the create button. スクリーンショット 2020-11-21 16.00.02.png Set details as appropriate. This time, I set it like the image. スクリーンショット 2020-11-21 16.07.51.png This time, I changed the user name to azureuser and used the existing public key. To set an existing public key with SSH, create an SSH key pair in Azure Cloud Shell with the following command.

$ssh-keygen -t rsa -b 4096

#Enter a file in which to save the key, do not enter anything, and press enter. This will create it in the default file location.
> Enter a file in which to save the key (/home/you/.ssh/id_rsa): [Press enter]

#Set a password. Enter twice, including confirmation.
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]

#Display the contents of the public key with the following command. Copy what is displayed. At this time, if a space or line break is inserted, it cannot be recognized, so be careful not to enter it.
cat ~/.ssh/id_rsa.pub

Paste the SSH key you copied above into the SSH public key. If you can confirm by referring to the image, select Next: Disk>. スクリーンショット 2020-11-21 16.14.05.png Select "Create and connect a new disk" in the data disk. スクリーンショット 2020-11-21 16.15.23.png Leave the default and select OK. スクリーンショット 2020-11-21 16.16.35.png Make sure you have a new disk as shown below. If there is no problem, select "Next: Network". スクリーンショット 2020-11-21 16.18.53.png Move to the network, and this time we will create a new one, so leave the default and select "Confirm and create". スクリーンショット 2020-11-21 16.19.33.png If it is verified and there is no problem, select create.

SSH connection

Once deployed, go to the VM and make a note of the public IP address. スクリーンショット 2020-11-21 22.17.12.png

$ssh [email protected]

The authenticity of host 'xx.xx.xxx.xxx (xx.xx.xxx.xxx)' can't be established.

#Enter yes.
ECDSA key fingerprint is SHA256:w1h08h4ie1iMq7ibIVSQM/PhcXFV7O7EEhjEqhPYMWY.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'xx.xx.xxx.xxx' (ECDSA) to the list of known hosts.

#Then enter the passphrase you used to create the SSH key pair

#Enter the following command to initialize the data disk
$(echo n; echo p; echo 1; echo ; echo ; echo w) | sudo fdisk /dev/sdc
$sudo mkfs -t ext4 /dev/sdc1
$sudo mkdir /data && sudo mount /dev/sdc1 /data

#Install the Apache web server
$sudo apt-get update
$sudo apt-get install apache2 -y
#Check if it is started with the following command.
$sudo systemctl status apache2 --no-pager

Port settings

Select the appropriate VM> Settings> Networking. Select "Add rule for receiving port". スクリーンショット 2020-11-21 17.31.39.png Select Basic. スクリーンショット 2020-11-21 22.31.42.png Set HTTP as follows. Select Add. スクリーンショット 2020-11-21 17.33.00.png

Finally, enter the public IP address in the URL field and the following page will be displayed. スクリーンショット 2020-11-21 17.33.58.png

Recommended Posts

[Azure] I tried to create a Linux virtual machine in Azure of Microsoft Learn
I tried to create a Python script to get the value of a cell in Microsoft Excel
I tried to create a linebot (implementation)
I tried to create an environment of MkDocs on Amazon Linux
Matching app I tried to take statistics of strong people & tried to create a machine learning model
I tried to create a list of prime numbers with python
I tried installing MySQL on a Linux virtual machine on OCI Compute
Create a Linux virtual machine on Windows
From user registration of Microsoft Azure to creation of virtual machine (free tier)
I tried to display the altitude value of DTM in a graph
I tried to implement a card game of playing cards in Python
I want to create a window in Python
When I tried to create a virtual environment with Python, it didn't work
A machine learning beginner tried to create a sheltie judgment AI in one day
I tried to create a model with the sample of Amazon SageMaker Autopilot
I tried to create a table only with Django
I tried to implement a pseudo pachislot in Python
[Linux] I learned LPIC lv1 in 10 days and tried to understand the mechanism of Linux.
I tried to learn PredNet
[Python] I tried to automatically create a daily report of YWT with Outlook mail
I tried to reintroduce Linux
I tried to create a class to search files with Python's Glob method in VBA
I tried the site "Deploy Azure virtual machine from Go"
I tried to create API list.csv in Python from swagger.yaml
I tried to implement a one-dimensional cellular automaton in Python
I tried to automatically create a report with Markov chain
I tried "How to get a method decorated in Python"
How to develop in a virtual environment of Python [Memo]
[Machine learning] I tried to summarize the theory of Adaboost
I tried to create a bot for PES event notification
I tried to make a stopwatch using tkinter in python
I tried to implement blackjack of card game in Python
I tried to create an article in Wiki.js with SQLAlchemy
I tried to compare the accuracy of machine learning models using kaggle as a theme.
I wrote a doctest in "I tried to simulate the probability of a bingo game with Python"
I tried to create Quip API
How to create a virtual bridge
How to display a specified column of files in Linux (awk)
I tried to create a server environment that runs on Windows 10
[Linux] I tried to summarize the command of resource confirmation system
I tried to get a database of horse racing using Pandas
I tried to create a simple credit score by logistic regression.
I tried to make a regular expression of "amount" using Python
I tried to make a regular expression of "time" using Python
I tried to implement a misunderstood prisoner's dilemma game in Python
I tried to get a list of AMI Names using Boto3
I tried to make an analysis base of 5 patterns in 3 years
I tried to create Bulls and Cows with a shell program
How to create a large amount of test data in MySQL? ??
I want to create a pipfile and reflect it in docker
I want to create a machine learning service without programming! WebAPI
Create a function to get the contents of the database in Go
I tried to make a mechanism of exclusive control with Go
I tried to make a site that makes it easy to see the update information of Azure
I tried to understand supervised learning of machine learning in an easy-to-understand manner even for server engineers 1
I tried to create a Power BI report by processing CSV / JSON logs using Azure Databricks
I tried to understand supervised learning of machine learning in an easy-to-understand manner even for server engineers 2
I tried to embed a protein-protein interaction network in hyperbolic space with Poincarē embeding of gensim
I tried to implement PLSA in Python
I tried using Azure Speech to Text.
I tried to implement permutation in Python