Launching Your First Linux Instance

In this tutorial, perform the steps to create and connect to an OCI Compute instance. After your instance is up and running, optionally create and attach a block volume.

Key tasks:

  • Create a Compartment
  • Create a cloud network and subnet that enables internet access
  • Create an instance
  • Connect to the instance
  • (Optional) Create and attach a block volume
  • (Optional) Clean up after completing the tutorial

The following figure depicts the components you create in the tutorial.

Cloud resources to be created in the tutorial.

Before You Begin

To successfully complete this tutorial, you must have the following:

Requirements

Authentication and Authorization

Each service in Oracle Cloud Infrastructure integrates with IAM for authentication and authorization, for all interfaces (the Console, SDK or CLI, and REST API).

An administrator in your organization needs to set up groups , compartments , and policies  that control which users can access which services, which resources, and the type of access. For example, the policies control who can create new users, create and manage the cloud network, launch instances, create buckets, download objects, and so on. For more information, see Managing Identity Domains. For specific details about writing policies for each of the different services, see Policy Reference.

If you're a regular user (not an administrator) who needs to use the Oracle Cloud Infrastructure resources that your company owns, contact your administrator to set up a user ID for you. The administrator can confirm which compartment or compartments you should be using.

1. Create a Compartment

Compartments help you organize and control access to resources. A compartment is a collection of related resources (such as cloud networks, Compute instances, or block volumes). Only users in groups given permission by an administrator in your organization, have access to specific compartments. For example, one compartment could contain all the servers and storage volumes that make up the production version of a company's Human Resources system. Only users with permission to that compartment can manage those servers and volumes.

2. Create a Virtual Cloud Network

Before you can launch an instance, create a virtual cloud network (VCN) and subnet to launch the instance into. A subnet is a subdivision of your VCN defined using a range of IP addresses with public or private access. The subnet directs traffic according to a route table . In addition, a subnet's security list controls traffic in and out of the instance. For this tutorial, access the instance over the internet using the instance's public IP address. The route table directs traffic to an internet gateway.

For information about VCN features, see Networking Overview.

Use the Start VCN Wizard workflow to create a new Virtual Cloud Network (VCN). The workflow does several things when installing the VCN:

  • Creates a VCN.
  • Adds an Internet Gateway which enables internet connections.
  • Creates and configures public and private subnets for the VCN.
  • Sets up route tables and security lists for the subnets.

For more information on VCNs, see: VCN and Subnet Management.

3. Create a Virtual Machine Instance

Next, launch an instance with an Oracle Linux image and basic shape. Use the Create a VM Instance workflow to create a new compute instance. The workflow does several things when installing the instance:

  • Creates and installs a compute instance running Oracle Linux.
  • Selects your VCN and public subnet to connect the Oracle Linux instance to the internet.
  • Creates an ssh key pair you use to connect to the instance.

4. Connect to Your Instance

Connect to your Linux instance using a Secure Shell (SSH) connection. Current versions of Linux, MacOS, Windows, and Windows Server include an OpenSSH client by default. (For Windows, see: OpenSSH client.) Use the SSH keys you generated when you created your instance.

Log in to your instance using the instructions for the operating system you're connecting from.

Tip

If you're using an older version of the Windows operating system, you can use PuTTY to create keys and connect to a Linux instance. For details on connecting to a Linux instance with PuTTY, see Connecting to a Linux Instance from a Windows System Using PuTTY.
Note

Windows now supports Windows Subsystem for Linux (WSL). With WSL, you can install a free version of Linux, like Oracle Linux or Ubuntu, on your Windows system. Then from WSL, the steps to connect with SSH are the same as a regular Linux system. See: Connecting to a Linux Instance from a MacOS or Linux System.

5. (Optional) Add a Block Volume

Block Volume provides network storage to use with your Oracle Cloud Infrastructure instances. After you create, attach, and mount a volume to your instance, you can use it just as you would a physical hard drive on your computer. A volume can be attached to a single instance, but you can detach the volume from one instance and attach it to another instance, keeping your data intact.

For complete details on Block Volume, see Overview of Block Volume.

6. (Optional) Clean up Resources

After you've finished with the resources that you created for this tutorial, clean up by terminating the instance and deleting the resources that you don't intend to continue working with.

What's Next

Now that you've got a Compute instance running and attached some storage, consider the following next steps: