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.
Here materials are used.
Select to create a resource.
Enter Ubuntu Server in the search box.
Select Ubuntu Server 18.04 LTS Canonical
.
Press the create button.
Set details as appropriate. This time, I set it like the image.
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>
.
Select "Create and connect a new disk" in the data disk.
Leave the default and select OK.
Make sure you have a new disk as shown below.
If there is no problem, select "Next: Network".
Move to the network, and this time we will create a new one, so leave the default and select "Confirm and create".
If it is verified and there is no problem, select create.
Once deployed, go to the VM and make a note of the public IP address.
$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
Select the appropriate VM> Settings> Networking. Select "Add rule for receiving port". Select Basic. Set HTTP as follows. Select Add.
Finally, enter the public IP address in the URL field and the following page will be displayed.
Recommended Posts