33 ‐ Steps to Prepare OCI Instance for Web and SSH Access - SanjeevOCI/Study GitHub Wiki

  1. Network Setup in OCI Console

    • Create Internet Gateway for your VCN.
    • Update Route Table for your App Subnet to route 0.0.0.0/0 traffic to the Internet Gateway.
    • Add Security List Rule to App Subnet:
      • Ingress rule: Source CIDR 0.0.0.0/0, Destination Port 80 (TCP), Allow HTTP traffic.
  2. SSH Access Setup

    • Login via SSH using Putty and your private key.
    • Edit /etc/ssh/sshd_config:
      PasswordAuthentication yes
      PermitRootLogin yes
      AllowUsers opc root
      UsePAM yes
      
    • Restart SSH service:
      sudo systemctl restart sshd
  3. Install Apache Web Server

    • Install Apache (httpd):
      sudo yum install httpd -y
    • Start and enable Apache:
      sudo systemctl start httpd
      sudo systemctl enable httpd
  4. Prepare Web Directory

    • Create /var/www/html if missing:
      sudo mkdir -p /var/www/html
    • Create index.html:
      echo "<h1>Hello, World!</h1>" | sudo tee /var/www/html/index.html
  5. Firewall Settings

    • Stop/disable firewall (if running):
      sudo systemctl stop firewalld
      sudo systemctl disable firewalld
  6. Test Access

    • SSH: Connect using Putty with password or key.
    • Web: Open http://<public-ip>/ in your browser to see index.html.

Note:

  • Disabling firewalls and enabling root login/password authentication can be insecure. Use these settings only for testing or in trusted environments.
  • For production, use SSH keys and restrict
⚠️ **GitHub.com Fallback** ⚠️