Some of the benefits that the cloud delivers are the ease and speed to create VMs with different operating systems, computing power, processor type and storage by simply choosing a few settings. Other tasks that are also very easy to do are: Scale in / out, create backups of your boot volumes, create copies or delete VMs. With the cloud everything was greatly simplified!
In this article we will create a VM instance with Oracle Linux 7.6.
Before we start creating a VM instance, we need to generate SSH keys. The following command works with Linux and Git Bash (Windows), and you only have to press enter for all steps.
The generated SSH keys can be found inside the “~/.ssh/” folder in Linux or in the “/c/Users/<username>/.ssh” folder in Windows.
Now we can begin to create the VM instance!
To create a new VM instance, on the main menu click Compute, then select Instances.
Click Create Instance.
In the Create Compute Instance page use the information below and click Create:
- Name: myinstance-ol
- Availability domain: AD1, AD2 or AD3
- Operating system: Oracle Linux 7.6
- Instance type: Virtual Machine
- Instance shape: VM.Standard2.1
- SSH key: Add the generated id_rsa.pub key
- Virtual cloud network compartment: The compartment you created (e.g. mycompartment1)
- Virtual cloud network: The VCN you created (e.g. myvcn1)
- Subnet compartment: The subnet compartment you created (e.g. mycompartment1)
- Subnet: The subnet you created (e.g. Public Subnet KaYG:US-ASHBURN-AD-1)
The new instance has been created and has a public IP address.
To test your instance install the Apache HTTP Server, but do not forget to create a new rule inside your VCN’s Security List for port 80.
To create a new rule, on the the main menu click Networking, then select Virtual Cloud Networks.
Click on the VCN name.
Click Security Lists.
Click on your Security List.
Click in Edit All Rules.
In the Edit Security List Rules dialog box click in + Another Ingress Rule to add a new ingress rule. Use the information below and click Save Security List Rules.
- Source type: CIDR
- Source CIDR: 0.0.0.0/16
- IP protocol: TCP
- Destination port range: 80
In the next step, we will install the Apache HTTP Server using MobaXterm, but you can use Putty or another one. Open your terminal emulator and configure a new SSH session to access your instance.
- Remote host: Your public IP address
- Username = opc
- Port = 22
- Private key = Your private key (e.g id_rsa file)
Start a new SSH session, switch to root user and install the Apache HTTP Server.
$ sudo su -
$ yum -y install httpd
Turn on the HTTP server and confirm that it will start automatically on reboot.
$ service httpd start
$ chkconfig httpd on
Update the firewall to open the port 80.
$ firewall-cmd --zone=public --add-port=80/tcp --permanent
$ firewall-cmd --reload
Done! Now, try to access the instance using your public IP.
Create a new HTML page and try again.
$ echo 'Hello World!' > /var/www/html/index.html
In this article, you learned how to create a new VM instance.
Have a good time!