Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
Chapter 3. Installing Red Hat Container Development Kit on Mac OS X
To prepare your Mac OS X development system for running the CDK, the steps are:
- Download and install the VirtualBox virtualization software.
- Download and install Vagrant.
- Download Red Hat Container Tools and the Vagrant box for Red Hat Enterprise Linux.
- Install additional Vagrant plugins to support Red Hat Subscription Management and other features.
3.1. Prerequisites Link kopierenLink in die Zwischenablage kopiert!
To run the CDK 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.
3.2. Installing Virtualization and CDK Components on Mac OS X Link kopierenLink in die Zwischenablage kopiert!
Vagrant is used to run a Red Hat Enterprise Linux virtual machine with all necessary components for CDK. 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. You should 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.
3.2.1. Additional Software Requirements for Mac OS X Link kopierenLink in die Zwischenablage kopiert!
In order to run CDK, some command-line development tools are needed on your Mac. You should install either Apple Command Line Development Tools or Apple’s Xcode.
3.2.2. Installing Software and Configuring the System Link kopierenLink in die Zwischenablage kopiert!
Download and install VirtualBox for Mac OS X from virtualbox.org.
Optional: Choose a location for storing VirtualBox VM images. By default, these are stored in your home directory (
~/VirtualBox VMs). You will need several gigabytes of space wherever you choose to store these images. To change the location start VirtualBox, Use the VirtualBoxPreferences General menu, then change Default Machine Folder to the desired location. Documentation for VirtualBox can be found on the virtualbox.org website. Download and install Vagrant from vagrantup.com. The download page is: Vagrant Versions. Select the folder with the latest 1.7.x release (such as 1.7.4) and download the vagrant file in .dmg format (for example,
vagrant_1.7.4.dmg).The default is to install the software in the
/opt/vagrantdirectory. You may change this to whatever you prefer. The Vagrant installer places avagrantsymbolic link in/usr/binto/opt/vagrant/bin/vagrant, so no adjustments to thePATHenvironment variable should be necessary.
3.3. Setting Up CDK Software Components Link kopierenLink in die Zwischenablage kopiert!
Download the CDK 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 Developer 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.
Unzip the ZIP file you downloaded in your home directory (the name of the zip file may change to reflect a release number). This should create the
~/cdksubdirectory (/Users/username/cdk):cd unzip ~/Downloads/cdk*.zip
$ cd $ unzip ~/Downloads/cdk*.zipCopy to Clipboard Copied! Toggle word wrap Toggle overflow At this point, please view the included
READMEfiles to familiarize yourself with the Red Hat Container Tools and to be notified if there have been any changes since this installation guide was published. TheREADMEfile associated with each Vagrantfile can be viewed as a plain text file. The pluginREADMEfiles are are formatted in Markdown. So you might want to use a Markdown reader for a better experience with those files.Install the
vagrant-registration,vagrant-service-manager, andvagrant-sshfsplugins (the plugins in the form of.gemfiles are included in the ZIP file).The installation of the first plugin make take several minutes, and Vagrant may install some additional gem files as needed.
cd ~/cdk/plugins ls -l *.gem vagrant plugin install ./vagrant-registration-1.2.1.gem \ ./vagrant-service-manager-1.0.1.gem \ ./vagrant-sshfs-1.1.0.gem
$ cd ~/cdk/plugins $ ls -l *.gem $ vagrant plugin install ./vagrant-registration-1.2.1.gem \ ./vagrant-service-manager-1.0.1.gem \ ./vagrant-sshfs-1.1.0.gemCopy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the plugins are installed by running the following command:
vagrant plugin list
$ vagrant plugin listCopy to Clipboard Copied! Toggle word wrap Toggle overflow Add the Red Hat Enterprise Linux Server box to Vagrant. This is the configured virtual machine image that you downloaded in one of the previous steps. You will be using this for container development and testing.
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.boxCopy to Clipboard Copied! Toggle word wrap Toggle overflow Note that if you plan on using a Vagrantfile to initialize the Vagrant box, the name you assign to the box using the
--nameparameter in the above step must correspond to the name used by the Vagrantfile to refer to the box. By default, this iscdkv2.Verify that the box is installed:
vagrant box list
$ vagrant box listCopy 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.
3.4. Starting the CDK Vagrant Box on Mac OS X Link kopierenLink in die Zwischenablage kopiert!
With the Vagrant box and Vagrantfiles in place, you are ready to bring up the selected Vagrant box. Your choices of Vagrantfiles are as follows:
- OpenShift (rhel-ose): The OpenShift (rhel-ose) Vagrantfile launches a Red Hat Enterprise Linux server virtual machine (VM) with OpenShift Enterprise running on it. With OpenShift running, you can use either the Web Console from the browser on your desktop or docker, oc, and related commands by logging into the VM. With some additional setup, you can add other tools to access feature in the VM from your host (see Using the CDK for information on how to to access the VM from Eclipse or command line tools from your desktop).
- Kubernetes(rhel-k8s-singlenode-setup): Use the Kubernetes (rhel-k8s-singlenode-setup) Vagrantfile to start a more generic CDK VM. Because OpenShift is not running, you can configure a more basic Kubernetes configuration or use docker directly.
NOTE: Instead of using one of the provided Vagrantfiles, you can copy one of the existing Vagrantfiles and modify it 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.
Follow these instruction to start up a VM from the selected VM, from the proper Vagrantfile provided in the Red Hat Container Tools ZIP file.
Before you start your CDK Vagrant box, consider reviewing the Vagrantfile to see if there are any settings you want to change. In particular, you might want to configure SSHFS to share a directory between your CDK virtual machine and your local system. See the description of the vagrant-sshfs plugin in the "Using the Red Hat CDK" chapter for information on how to configure this.
Start the OpenShift Enterprise integration (rhel-ose)
cd ~/cdk/components/rhel/rhel-ose/ vagrant up vagrant provision # If OpenShift fails, repeat this command until it starts
$ cd ~/cdk/components/rhel/rhel-ose/ $ vagrant up $ vagrant provision # If OpenShift fails, repeat this command until it startsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Start the Single-node Kubernetes setup (rhel-k8s-singlenode-setup)
cd ~/cdk/components/rhel/misc/rhel-k8s-singlenode-setup/ vagrant up
$ cd ~/cdk/components/rhel/misc/rhel-k8s-singlenode-setup/ $ vagrant upCopy to Clipboard Copied! Toggle word wrap Toggle overflow
At this point, if all is going well, you are asked for a username and password for Red Hat Subscription Management in order to register the system and enable downloading from Red Hat repositories. You have the choice of:
- Registering your Red Hat Enterprise Linux VM now (recommended) or
Registering your Red Hat Enterprise Linux VM later
NOTE: See the "Using the CDK" chapter for information on obtaining Red Hat Enterprise Linux subscriptions, how registration works with the CDK, and details on why you need to register your system.
To register your system now, enter the username and password you use with the Red Hat Customer Portal.
==> 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:
You can check whether your Vagrant box is running using the vagrant status command. Note that you must be in the same directory where your Vagrant file is located. For example:
cd ~/cdk/components/rhel/rhel-ose/ vagrant status
$ cd ~/cdk/components/rhel/rhel-ose/
$ vagrant status
If the machine state shows as running, you are ready to start using your CDK. Refer to the following:
- The Using the CDK chapter will help you understand the different Vagrantfiles, plugins and interfaces needed to work with your CDK. It also discusses special topics, such as other ways to register your Red Hat Enterprise Linux virtual machines.
- The Getting Started with Container Development Kit guide provides information on getting started with container development.