Install RHEL in VirtualBox (on Mac Os)

This step by step tutorial on how to install RHEL 7 as a VirtualBox image on a MacOs.

❗️ Before starting be sure that you have already download the RHEL DVD BINARY ISO, and that your machine currently has internet access.

Of course you should also have installed VirtualBox on your machine.

Create Virtual Machine

We first need to create a VirtualBox image

  1. Open virtualbox and click on “New”

rhel-1

  1. Enter the following informations
    • Name : RHEL 7 (or anything else, it’s up to you)
    • Type : Linux
    • Version : Red Hat (64-bit)
  2. Choose Memory Size (4 GB in my case)

rhel-2

  1. Create The disk image (where the datas will be stored) (I use 8.0 GB in a dynamically allocated size)

rhel-3

rhel-4

rhel-5

rhel-6

  1. Then click on create
  2. The Virtual Image is now created we need to install the OS

Install RedHat Enterprise Linux 7

Add DVD to Image

On the Image in Virtual Box, right click and choose settings:

rhel-7

Then go to the “Storage Menu” and click on “Empty” below “Controller: IDE” Then on the 💿 icon and click on "Choose Virtual Optical Disk File…"

rhel-8

Select the RHEL DVD BINARY ISO

rhel-9

Click Ok

Start RHEL Installation

❗️ Remember that to have your mouse out of the VM you need to press the "HOST key" which is the left "COMMAND" key of the keyboard on a MAC

Now you can start the virtual machine and install RHEL on it

rhel-10

rhel-11

rhel-12

So now you have to follow the instructions … here is what I did, maybe you will have to adapt to your needs …

rhel-13

Configure the network, in my case I use default configuration, and I changed the host name to rhel.local :

rhel-14

Then configure the disk, I use all disk, and automatic partitionning

rhel-15

rhel-16

rhel-17

Now start the installation by clicking "Begin Installation button …

rhel-18

Change Root Password (I used “password” … 😉 )

rhel-19

And I created a user : remi with sudo access (click on “Make the user an admonistrator”).

rhel-20

rhel-21

Now Reboot …

rhel-22

rhel-23

Then you can login …

rhel-24

rhel-25

Configure VirtualBox for SSH

As the network of the virtual machine is, by default with virtual box, natted to your host, if you want to access your Virtual machine through SSH for exemple, you need to use Port Forwarding :

When the Virtual machine is running, you can click on the small network icon at the bottom of the window, and click "Network Settings" :

rhel-26

Then in the adpater configuration, unfold “Advanced” settings, and click on "Port Forwarding"

rhel-27

And add a port forwarding from port 2222 of your local computer to the port 22 (ssh) of the virutal machine :

rhel-28

Then open a terminal and type the following command to connet to your redhat system

$ ssh remi@127.0.0.1 -p 2222
The authenticity of host '[127.0.0.1]:2222 ([127.0.0.1]:2222)' can't be established.
ECDSA key fingerprint is SHA256:WkCjIECzhX5cTnA5AVKaxnmM3Fki7DdtgKTgDOmlCa8.
Are you sure you want to continue connecting (yes/no)? yes
[remi@rhel ~]$

Register your RedHat System

Of course you need to have a valid registration from redhat.

  1. Login on your platform
  2. Sudo to root
  3. Execute Registration :

[remi@rhel ~]$ sudo su -
[sudo] password for remi:
[root@rhel ~]# subscription-manager register
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: your_rh_login
Password: your_rh_password

The system has been registered with ID: xxxxxxxx-yyyy-xxxx-yyyy-azazazazazaz
  1. Try to install wget …
[root@rhel ~]# yum install wget
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>
  1. List all available subscription :
[root@rhel ~]# subscription-manager list --available
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name:   Red Hat OpenShift, Standard Support (10 Cores, NFR, Partner Only)
Provides:            Red Hat OpenShift Enterprise Application Node
                     Red Hat JBoss Core Services
                     Red Hat Software Collections (for RHEL Server)
                     Red Hat Enterprise Linux Fast Datapath
                     Red Hat Enterprise Linux Fast Datapath Beta
                     Oracle Java (for RHEL Server) - Extended Update Support
                     Red Hat OpenShift Enterprise JBoss EAP add-on
                     Red Hat OpenShift Container Platform
                     JBoss Enterprise Application Platform
                     Red Hat JBoss AMQ Clients
                     JBoss Enterprise Web Server
                     Oracle Java (for RHEL Server)
                     Red Hat OpenShift Enterprise Client Tools
                     Red Hat CloudForms Beta
                     Red Hat Enterprise Linux Server
                     Red Hat Enterprise Linux Atomic Host
                     Red Hat Software Collections Beta (for RHEL Server)
                     Red Hat OpenShift Enterprise Infrastructure
                     Red Hat CloudForms
SKU:                 SER1111
Contract:            11111111
Pool ID:             xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Provides Management: Yes
Available:           10
Suggested:           1
  1. Attach your system to the pool :
subscription-manager attach --pool=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Successfully attached a subscription for: Red Hat OpenShift, Standard Support (10 Cores, NFR, Partner Only)
  1. Install wget :
[root@rhel ~]# yum install wget
Loaded plugins: product-id, search-disabled-repos, subscription-manager
rhel-7-server-rpms                                                                                                      | 3.5 kB  00:00:00
(1/3): rhel-7-server-rpms/7Server/x86_64/group                                                                          | 709 kB  00:00:01
(2/3): rhel-7-server-rpms/7Server/x86_64/updateinfo                                                                     | 2.5 MB  00:00:07
(3/3): rhel-7-server-rpms/7Server/x86_64/primary_db                                                                     |  47 MB  00:00:12
Resolving Dependencies
--> Running transaction check
---> Package wget.x86_64 0:1.14-15.el7_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
 Package                    Arch                         Version                                Repository                                Size
===============================================================================================================================================
Installing:
 wget                       x86_64                       1.14-15.el7_4.1                        rhel-7-server-rpms                       547 k

Transaction Summary
===============================================================================================================================================
Install  1 Package

Total download size: 547 k
Installed size: 2.0 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7Server/rhel-7-server-rpms/packages/wget-1.14-15.el7_4.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Public key for wget-1.14-15.el7_4.1.x86_64.rpm is not installed
wget-1.14-15.el7_4.1.x86_64.rpm                                                                                         | 547 kB  00:00:01
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Importing GPG key 0xFD431D51:
 Userid     : "Red Hat, Inc. (release key 2) <security@redhat.com>"
 Fingerprint: 567e 347a d004 4ade 55ba 8a5f 199e 2f91 fd43 1d51
 Package    : redhat-release-server-7.4-18.el7.x86_64 (@anaconda/7.4)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Importing GPG key 0x2FA658E0:
 Userid     : "Red Hat, Inc. (auxiliary key) <security@redhat.com>"
 Fingerprint: 43a6 e49c 4a38 f4be 9abf 2a53 4568 9c88 2fa6 58e0
 Package    : redhat-release-server-7.4-18.el7.x86_64 (@anaconda/7.4)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : wget-1.14-15.el7_4.1.x86_64                                                                                                 1/1
rhel-7-server-rpms/7Server/x86_64/productid                                                                             | 2.1 kB  00:00:00
  Verifying  : wget-1.14-15.el7_4.1.x86_64                                                                                                 1/1

Installed:
  wget.x86_64 0:1.14-15.el7_4.1

Complete!
[root@rhel ~]#

Ok, so now you can use your system.