Saturday, September 21, 2019

Free Oracle Cloud: 6. Create a VM Instance (Compute Cloud)

This post is part of a series of blog posts on the Best and Cheapest Oracle APEX hosting: Free Oracle Cloud.

In this post we will setup a virtual machine with Oracle Linux. If you need a machine in the Cloud, this service is for you... and you can't beat the price, it's FREE!

So why would you need a machine in the Cloud? For anything that you do on your own machine, you can do on your machine in the cloud. You can work with co-workers on the same app, test applications, host some PHP app or Wordpress blog or you name it. You have a full Oracle Linux machine where you can do whatever you want.

So lets get started to setup this machine, but first lets do one step on our own machine, as it's a pre-requisite to get started: create an SSH key pair. In the link you find how you create a keypair on Windows, Linux and OSX. You can see your SSH key pair as a more secure way to enter your machine in the cloud than a username/password.

As I'm on OSX here's the command I use:

ssh-keygen -t rsa -N "" -b 2048 -C "oraclecloud2019" -f oraclecloud2019


This will generate two files:


Now you are all set to setup your VM instance in the Oracle Cloud.

When you login to your Oracle Cloud account, select the Create a VM instance:


Give your instance a name:


When you scroll down, you see the section where you have to upload the SSH key file with the name .pub:


Hit the Create button and you are done... You will see the orange icon on the left stating it's being orange provisioned:


Once the provisioning is done the icon on the left will turn green and it's ready to be used:


In case you don't want to wait for the provisioning, you can always come back later by clicking the left top hamburger icon, and in the Compute section click on Instances:


You will get an overview of your instances, see the status and go to the details from there:


Now if you want to connect to your VM in the Oracle Cloud you can use Putty (Windows) or SSH (Linux, OSX). The command looks like this:

ssh -i ssh_key opc@public_ip

The OPC user is the one you use to connect to an Oracle Compute (VM) Instance.

In the following screenshot you see me connecting to my Oracle Cloud VM (for security reasons I used another ssh key, normally it would have been oraclecloud2019 but as I exposed that with my screenshot I setup another one):


There you go, now you have a full system running in the Cloud. In the next post we will setup a webserver on this machine and configure a custom domain.

20 comments:

  1. Too much reception. "Out of host capacity.". :-(

    ReplyDelete
  2. alas keeps raising out of host capacity

    ReplyDelete
  3. Oracle increased the capacity. This morning I could activate my VM.

    ReplyDelete
  4. right. it seems fine now.

    ReplyDelete
  5. Hi Dimitri,

    Many thanks for your blog.

    My VM has been created successfully but how can I connect to my Oracle Cloud VM using PuTTy?

    Could you please add few screenshots?

    PS: When I opened PuTTy I don't see anything.

    ReplyDelete
  6. Hi Bhavin,
    You can connect VM through Putty on your windows machine by following the instructions mentioned in the below link:

    Connect to a Cloud VM on Windows with PuTTY - Oracle

    ReplyDelete
  7. Hi Dimitri,

    Thanks for blogging about this topic.

    My VM was created successfully but my "Public IP Address" is listed as "Unavailable" and I an unable to cannot connect via Putty. Do know how I can obtain the IP?

    ReplyDelete
  8. I've only seen that during provisioning.
    Maybe wait a bit longer and see if the IP address comes?

    Dimitri

    ReplyDelete
  9. Actually, I just created another VM and now I could reproduce your issue.
    After successful provisioning of the instance, the public ip is not there.

    BUT, as my first VM has a public IP I logged in to that. From there I can connect to the other VMs as they are in the same subnet.
    So connecting to the internal ip 10.0.0.x works.

    Hope that helps,
    Dimitri

    ReplyDelete
  10. I noticed a glitch (bug?), when I first accessed the page to build a VM the Public IP switch was there but didn't really work.. So I terminated that VM and tried to recreate a new one.
    From that point onwards the Public IP did not show anymore.. So now what you need to do is create a Virtual Cloud Network (Under Networking) to help you setup follow this link: https://fuzziebrain.com/content/id/1904/ And check out the networking section.
    Note: the CIDR that Adrian chose to use will not necessarily work on your cloud region. Accept the default (something like 10.0.0.16/16 or whatever value shows) and you'll be good.

    After you create your network the Public IP switch will re-appear when you build a VM (consistently).

    This is essentially the same setup as in Amazon.

    Good luck

    ReplyDelete
  11. I had the same problem as Gaspar -- the Public IP Address was "Unavailable" after creating the instance. Here's the solution I found:

    1. From your Instance, select "Attached VNICs". Select your instance.
    2. Select "IP Addresses". Choose "Edit"
    3. Under Public IP Addresses I changed this from "No Public IP" to "Reserved Public IP".

    ReplyDelete
  12. Actually, I found that Oracle changed the default to not assign a public IP, BUT you can change it when you create the instance.
    Click on Show Shape, Network and Storage Options when you create and you can say to assign a public IP.

    ReplyDelete
  13. Hi Dimi,

    I created a Oracle Linux VM in my Frankfurt/Germany instance.

    How could I change the time(zone), that the Database (Apex) shows me the right time.

    At the moment (08:14 in the morning) the "select sysdate from dual" shows me "09.10.19 06:14" in the SQL Developer. Minus 2 hours.

    Best,
    Carsten

    ReplyDelete
  14. Coming back & revisiting this to set up my VM now (5 months after creating my database and APEX environment), I can't find any ALWAYS FREE options on my home page or if I go direct to Compute VM on the big menu. I created a VM with the smallest config offered to me - and the meter is now running on that.

    Has anyone else had similar experience with Always Free options no longer being available? I'm using London-South.

    I did convert my account to a Paid Account so that email would continue to work (from Ashburn, US). My usage has never been enough to trigger a bill so far,

    I do see always free configurations for Load Balancer available band for my second Database. But not for VMs.

    ReplyDelete
  15. Ok - I figured out why this didn't work.

    My Region, Uk South has 3 Availability Regions AD1, AD2, AD3. My free VM quota is in AD2 (it's actually an entitlement to VM.Standard.E2.1.Micro). When I created my VM last week, I choose AD1 (not realising that my entitlement was only in AD2). If I now select AD2, it shows me a Free Micro configuration as being available.

    So I know now how to solve my problem.

    The way to diagnose this problem was:
    1) Click on Profile (very top Right hand corner)
    2) select your home tenancy (Uk-South). That brings up the Tenancy Info
    3) Open Service Limits. Then expand Compute. This shows you what you can create in the region and in each of it's Availability Regions)
    That showed me that I was entitled to 2 VM.Standard.E2.1.Micro but only in AD2.

    ReplyDelete
  16. For those wanting to run from Windows, I have found it very easy to install and use CYGWIN, a posix compliant interface. All the commands work after setting up ssh per the instructions for Grid Control install on windows starting in section 5.1. This is required to install Grid Control on Windows (https://docs.oracle.com/cd/E24628_01/install.121/e22624/preinstall_req_cygwin_ssh.htm#EMBSC151). In CYGWIN the keyfile is created in /home/ so the command to connect to your cloud compute instance is:
    ssh -i oraclecloud2019 opc@xxx.xxx.xxx.xxx

    ReplyDelete
  17. hi dimi I have created an instance and the free trial is over and after a month the instance has stopped, I have tried many ways ni don't know what to do.
    should i buy the paid version

    ReplyDelete
  18. hello Dimitri,
    I have created compute instance and ssh key pair but when I try to connect, it gives this error

    [SSH] Server Version OpenSSH_7.4
    [SSH] Encryption used: chacha20-poly1305@openssh.com
    [SSH] Authentication failed: RSA-key C:\Users...
    [SSH] FAIL: opc@: Permission denied (server offers publickey,gssapi-keyex,gssapi-with-mic).

    ReplyDelete
  19. Oracle cloud can now generate these keys for you during setup but the private key will need to be converted for putty to use, the linked blog was useful for me.

    https://stackoverflow.com/questions/60884217/openssh-ssh-2-private-key-old-pem-format-on-azure-linux-vm

    ReplyDelete