Free Tier: Install Apache and PHP on an Oracle Linux Instance

In this tutorial, you use an Oracle Cloud Infrastructure Free Tier account to set up an Oracle Linux instance. Then, you install an Apache web server with PHP and access your new server from the internet.

This tutorial covers all the steps necessary to set up a virtual network for your host and connect the host to the internet. Key tasks include how to:

  • Set up a compartment for your development work.
  • Set up a new Virtual Cloud Network (VCN).
  • Install your Oracle Linux instance.
    • Configure the OCI VCN and related network services required for your host to connect to the internet.
    • Set up ssh encryption keys to access your Oracle Linux instance.
  • Configure ingress rules for your VCN.
  • Install Apache and PHP on your instance.
  • Connect to your instance from the internet.

Here is a simplified diagram of the setup for your Linux instance.

A diagram of the components needed to run an Apache webserver on Oracle Cloud Infrastructure

For additional information, see:

Before You Begin

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

Requirements

1. Set up a Compartment for Development

Configure a compartment for your development.

2. Install a Virtual Cloud Network

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. Install an Oracle Linux Instance

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.
  • Select 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. Enable Internet Access

The Create a VM Instance wizard automatically creates a VCN for your VM. You add an ingress rule to your subnet to allow internet connections on port 80.

5. Install and Configure Apache and PHP

With your compute instance and VCN setup, install, and configure Apache web server and PHP to run on your Oracle Linux instance.

What's Next

You have successfully installed and deployed an Apache web server on Oracle Cloud Infrastructure using a Linux instance.

To explore more information about development with Oracle products: