Chapter 4. Installing Container Development Kit on Mac OS X
To prepare your Mac OS X development system for running Container Development Kit, the steps are:
- Download and install VirtualBox.
- Download and install Vagrant.
- Download Red Hat Container Tools and the Container Development Kit Vagrant box for VirtualBox.
- Install additional Vagrant plugins to support Red Hat Subscription Management and other features.
4.1. Prerequisites for Installing Container Development Kit on Mac OS X Copy linkLink copied to clipboard!
To run Container Development Kit on a Mac OS X system, you need:
- An Intel-based Mac with a minimum of 4 GB of RAM running a recent, 64-bit version of Mac OS X, such as 10.11 (El Capitan) or later.
- A minimum of 3 GB of free disk space for virtual machine images. Note that during the setup process, you will need to be able to store multiple copies of each of the virtual machine images.
- Adequate Internet connectivity to download 1—2 GB of software.
- An available Red Hat Enterprise Linux Server subscription with support or Red Hat Enterprise Linux Developer Suite. Note that Red Hat Enterprise Linux subscriptions with self-support do not have access to all of the necessary software for CDK in all environments.
4.2. Installing Software and Configuring the Host System Copy linkLink copied to clipboard!
Vagrant is used to run a Red Hat Enterprise Linux virtual machine with all necessary components for the Container Development Environment. Virtualization is provided by installing VirtualBox.
Please note that Vagrant is strictly command-line oriented. All interaction with Vagrant is through the command line from a terminal prompt. Use Terminal.app from the Applications
Command-line instructions use path names with a tilde, such as ~/cdk
. This is a shorthand notation for a path relative to the current user’s home directory, /Users/username/cdk
.
4.2.1. Additional Software Requirements for Mac OS X Copy linkLink copied to clipboard!
In order to run Container Development Kit, some command-line development tools are needed on your Mac. Install either Apple Command Line Development Tools or Apple Xcode.
Download and install VirtualBox for Mac OS X from http://www.virtualbox.org.
ImportantContainer Development Kit 2.2 is known to not work correctly with VirtualBox 5.1.x. If you already have VirtualBox 5.1.x installed, downgrade your installation to VirtualBox 5.0.26.
-
Choose a location for storing VirtualBox VM images. By default, these are stored in subdirectory in your home directory (
~/VirtualBox VMs
). You need several gigabytes of space wherever you choose to store these images. To change the location, start VirtualBox, go to VirtualBoxPreferences General and change Default Machine Folder to the desired location. Documentation for VirtualBox can be found on the virtualbox.org website. Download and install Vagrant from https://releases.hashicorp.com/vagrant/. Select the folder with the 1.8.1 release and download the Vagrant installation file in the
.dmg
format (vagrant_1.8.1.dmg
). The 1.7.4 version of Vagrant is also supported for use with Red Hat Container Development Kit 2.2.The default is to install Vagrant in the
/opt/vagrant
directory. You can change this. The Vagrant installer creates a/usr/bin/vagrant
symbolic link that points to/opt/vagrant/bin/vagrant
, so no adjustments to thePATH
environment variable are necessary.
4.3. Setting Up Container Development Kit Software Components Copy linkLink copied to clipboard!
Download the Container Development Kit software components from the Red Hat Product Downloads web site. You must log in to get access to this page. If you are on the right page, you should see "Product Variant: Red Hat Container Development Kit". You need to download the following items:
- Red Hat Container Tools
RHEL 7.2 Vagrant box for VirtualBox
NoteThe page also offers Vagrant box downloads formatted for other virtualization platforms, such as libvirt. You only need to download the box image that matches the virtualization you are using — VirtualBox.
The following steps assume you have saved these files in your home directory in
~/Downloads
. If you used a different directory, adjust the paths accordingly. You need several gigabytes of free space for the Vagrant box images.All of the remaining steps need to be performed using the command-line using the Terminal Application (Terminal.app). You can find Terminal.app in the Application
Utilities Folder. NoteThe following steps assume you have saved the downloaded files in your home directory in
~/Downloads
. If you used a different directory, adjust the paths accordingly.
Unzip the ZIP file you downloaded in your (the name of the zip file may change to reflect a release number). This should create the
~/cdk
subdirectory (/Users/<username>/cdk
):cd unzip ~/Downloads/cdk-2.2.0.zip
$ cd $ unzip ~/Downloads/cdk-2.2.0.zip
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
vagrant-registration
,vagrant-service-manager
, andvagrant-sshfs
plugins (the plugins in the form of.gem
files are included in the ZIP file).The installation of the first plugin may take several minutes, and Vagrant may install some additional gem files as needed.
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the plugins are installed by running the following command:
vagrant plugin list
$ vagrant plugin list
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the Container Development Kit box to Vagrant. This is the configured virtual machine image that you downloaded in one of the previous steps.
vagrant box add --name cdkv2 ~/Downloads/rhel-cdk-kubernetes-7.2*.x86_64.vagrant-virtualbox.box
$ vagrant box add --name cdkv2 ~/Downloads/rhel-cdk-kubernetes-7.2*.x86_64.vagrant-virtualbox.box
Copy to Clipboard Copied! Toggle word wrap Toggle overflow ImportantThe name you assign to the box using the
--name
parameter in the above step must correspond to the name used by the Vagrantfile used to initialize the box. By default, this iscdkv2
for the Vagrantfiles provided with Container Development Kit.Verify that the box is installed:
vagrant box list
$ vagrant box list cdkv2 (virtualbox, 0)
Copy to Clipboard Copied! Toggle word wrap Toggle overflow The box image file will be stored in your home directory under
~/.vagrant.d
. You need adequate space there, approximately 2 GB.
4.4. Starting the Container Development Kit Vagrant Box on Mac OS X Copy linkLink copied to clipboard!
Container Development Kit offers two Vagrantfiles for initializing the Container Development Environment with different services:
-
OpenShift (
rhel-ose
): Use the OpenShift Vagrantfile to launch a Red Hat Enterprise Linux Server virtual machine (VM) with OpenShift Enterprise running in it. With OpenShift running, you can use either the web user interface from a web browser on your desktop, ordocker
,oc
, and related commands by logging into the VM. -
Kubernetes (
rhel-k8s-singlenode-setup
): Use the Kubernetes Vagrantfile to start a more generic Container Development Kit VM. Because OpenShift is not running, you can configure a more basic Kubernetes configuration or use Docker directly.
You can modify the existing Vagrantfiles for your own purposes. For example, you might want to use a different IP address if it conflicts with an address on your local network.
Initialize the Container Development Kit Vagrant box:
Start Container Development Kit with OpenShift Enterprise as follows:
cd ~/cdk/components/rhel/rhel-ose/ vagrant up
$ cd ~/cdk/components/rhel/rhel-ose/ $ vagrant up
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start Container Development Kit with single-node Kubernetes follows:
cd ~/cdk/components/rhel/misc/rhel-k8s-singlenode-setup/ vagrant up
$ cd ~/cdk/components/rhel/misc/rhel-k8s-singlenode-setup/ $ vagrant up
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Enter the username and password you use with the Red Hat Customer Portal to register the Red Hat Enterprise Linux system running in the Vagrant box:
==> default: Registering box with vagrant-registration… default: Would you like to register the system now (default: yes)? [y|n] y default: Subscriber username: <username> default: Subscriber password:
==> default: Registering box with vagrant-registration… default: Would you like to register the system now (default: yes)? [y|n] y default: Subscriber username: <username> default: Subscriber password:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Check whether your Vagrant box is running using the
vagrant status
command. Note that you must be in the same directory where your Vagrantfile is located. For example:cd ~/cdk/components/rhel/rhel-ose/ vagrant status
$ cd ~/cdk/components/rhel/rhel-ose/ $ vagrant status
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If the machine state shows as running, you are ready to start using your Container Development Environment.
4.5. Additional Resources Copy linkLink copied to clipboard!
The Container Development Kit Getting Started Guide provides information on:
- using installed Vagrant plugins
- interacting with Vagrant boxes
- starting with container development
- using Docker, Kubernetes, and OpenShift Enterprise
- Vagrant Documentation
- VirtualBox Documentation