Setting Up RHEL GUI with VirtualBox on an AWS EC2 Instance

Setting Up RHEL GUI with VirtualBox on an AWS EC2 Instance

Introduction

This guide provides step-by-step instructions for setting up an Amazon Machine Image (AMI) with Red Hat Enterprise Linux (RHEL) that includes a Graphical User Interface (GUI) on an AWS EC2 instance. You’ll also learn how to install VirtualBox on the RHEL environment and create a virtual machine (VM) within it.

Prerequisites

  1. AWS Account: Ensure you have an active AWS account.

  2. IAM Permissions: Verify that your IAM user has permissions to launch EC2 instances and manage AMIs.

  3. SSH Client: Use Terminal on macOS/Linux or PuTTY on Windows to connect to the EC2 instance.


Step 1: Finding an AMI with RHEL GUI

  1. Log in to the AWS Management Console.

  2. Go to the EC2 Dashboard.

  3. Click on Launch Instance.

  4. In the Choose an Amazon Machine Image (AMI) section, type “RHEL” into the search bar and select the Public images option to browse community AMIs.

  5. Look for AMIs labeled RHEL with GUI or similar. Ensure the AMI is from a trusted source, ideally from Red Hat or the AWS Marketplace.

  6. Choose the AMI and click Select.


Step 2: Launching the EC2 Instance

  1. Instance Type: Choose an appropriate instance type. t2.micro is a good start for eligible AWS Free Tier users.

  2. Configure Instance: Click Next: Configure Instance Details. Leave settings as default unless you have specific requirements.

  3. Add Storage: Use default storage if adequate. Click Next: Add Tags.

  4. Add Tags: Optionally, add tags to help manage the instance.

  5. Configure Security Group:

    • Add a rule to allow SSH (port 22).

    • Add other ports as needed.

  6. Launch the Instance: Click Review and Launch. Select an existing key pair or create a new one for access, then click Launch Instances.


Step 3: Connecting to Your EC2 Instance

  1. Once the instance is running, select it in the EC2 Dashboard.

  2. Click Connect to view connection instructions.

  3. Connect using your SSH client:

     ssh -i "your-key.pem" ec2-user@your-instance-public-dns
    

Step 4: Installing VirtualBox

1. Update the System

After connecting to your instance, run:

sudo yum update -y

2. Install Required Packages

sudo yum install -y gcc make perl kernel-devel

3. Download VirtualBox

Go to the VirtualBox download page to find the latest RPM package for RHEL. Replace x.x.x with the appropriate version:

wget https://download.virtualbox.org/virtualbox/x.x.x/VirtualBox-x.x.x-xxxxxx.rpm

4. Install VirtualBox

sudo yum localinstall VirtualBox-x.x.x-xxxxxx.rpm

5. Load the VirtualBox Kernel Module

sudo /sbin/vboxconfig

Step 5: Creating a Virtual Machine (VM)

1. Launch VirtualBox

You can start VirtualBox via the GUI by running:

virtualbox

2. Creating a New VM

  • Click New.

  • Enter a name for your VM, select Linux as the type, and choose the appropriate version for your guest OS.

  • Allocate memory (RAM) to the VM (minimum 1024 MB recommended).

  • Create a virtual hard disk and follow the prompts to complete VM creation.

3. Installing the Guest OS

  • Download the ISO for the OS you want to install.

  • In VirtualBox, select your new VM, click Settings, and go to Storage.

  • Under Storage, select the empty optical drive and attach the ISO.

  • Start the VM and follow the installation prompts to complete the OS setup.


Conclusion

You have successfully:

  • Set up a RHEL GUI environment in AWS EC2.

  • Installed VirtualBox.

  • Created and configured a Virtual Machine within your RHEL environment.

This setup is useful for testing, development, or educational projects.