Boot a non-RightScale enabled RHEL instance, perform some manual configuration, install the RightLink package, and re-bundle the instance into a new, RightScale-enabled AMI. Optionally, test compatibility before bundling and create an MCI (MultiCloud Image) for your new image.
NOTE: Although the steps provided below for bundling an instance may still be valid in some scenarios, we encourage you to explore using the Instance Provisioner for bundling existing instances. See Create New Instance with the Instance Provisioner for additional information.
RightScale officially supports AWS pay-by-the-hour AMIs for RHEL, or custom RHEL AMIs that use a customer supported satellite server. RightScale RHEL RightImages are coming soon. In the meantime, you can install RightLink on a RHEL AMI.
If you do not wish to prepare your image for testing, you can launch a "bare" instance that is not attached to a RightScale Server.
In the RightScale Dashboard, navigate to the appropriate cloud in the menu (e.g., Clouds > AWS Region > Instances > New) and launch a new instance with the AMI you would like to RightLink-enable.
Note: RightScale only provides a 64-bit RightLink package at the current time, so be certain your instance architecture is compatible before proceeding.
Once the instance or server becomes operational, we will need to open an SSH terminal to the bare instance.
Note: These instructions are for an RHEL 6.4 x64 image, so you may be able to simply use the SSH Console button in the RightScale dashboard for a different image, or may need to login as a different user. The below directions are also specific to the OpenSSH client on a *nix platform.
First, obtain the private key that the raw instance was launched with. To do so, navigate to your instance in the RightScale Dashboard under the Clouds > AWS Region > EC2 Instances menu, then click on the SSH key link on the Info page of the instance. This should expose the private SSH key that the instance was launched with.
Copy and paste this key into a file on your local workstation and save the file (using a text editor, such as vim, nano, etc). Once the file is saved, change it's permissions to 'read only' for the owner:
chmod 400 <path_to_key>
Now, you should be able to SSH into the instance as the 'ec2-user' user, like so:
ssh -i <path_to_key> ec2-user@<hostname_or_IP_of_instance>
Important! All commands run in an SSH terminal from this point forward should be run as root. To gain root access, simply type:
and you should be granted full root privileges to the instance.
Run the following command to set the cloud type to Amazon EC2:
mkdir -p /etc/rightscale.d && echo -n <cloud_type> > /etc/rightscale.d/cloud
This file is used by the RightLink agent to recognize which cloud type the instance is running in. Valid cloud types are as follows:
The Extra Packages for Enterprise Linux (EPEL) project provides thousands of prebuilt RPMs for supplemental packages that are built and maintained by the Fedora open-source community. The RightLink RPM depends on some of these packages as prerequisites and cannot be installed unless EPEL is available to satisfy the dependencies.
You can EPEL-enable your system by installing the EPEL repository package. The repository package configures your system's YUM or up2date system to use EPEL's repositories. You can then install packages with your usual method, and the EPEL repository will be included and used to satisfy any dependencies:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Or for a different architecture or version:
rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Install the RPM package dependencies manually prior to installing RightLink:
yum -y install git curl bash lsb
We also need to install the 'rightimage-extras' package, which is a meta package that lists other packages essential to ServerTemplate functionality. To install, configure a repository:
sudo cat >/etc/yum.repos.d/RightScale-epel.repo<<-EOF [rightscale-epel] name=RightScale Software baseurl=http://cf-mirror.rightscale.com/rightscale_software/epel/6/x86_64/archive/latest/ gpgcheck=1 enabled=1 gpgkey=http://s3.amazonaws.com/rightscale_key_pub/rightscale_key.pub EOF
Then, install the package:
yum install rightimage-extras -y
Browse RightScale's mirror (http://mirror.rightscale.com/rightscale_rightlink/) for available RightLink packages. Although we recommend using the latest available RightLink package, it may not be available for your particular release. The most recently published packages can be found in the "latest" RightLink packages directory. If you do not find a suitable package in one of the "latest" directories, you can also browse for a different version from one of the archived directories. You must choose the distribution package that's most appropriate for your purposes, based upon your instance's operating system and CPU architecture (32-bit or 64-bit).
Install the appropriate RPM package. You can copy and paste the link from your browser if desired.
The following script downloads the latest x86_64 RedHat Enterprise Linux (RHEL) package from the mirror:
#!/bin/bash arch=x86_64 rpms=$(curl -s http://mirror.rightscale.com/rightscale_rightlink/latest/rhel/ | perl -0ne 'print "$1\n" while (/<a\s*href\s*=\s*\"(.*?)\">.*?<\/a>/igs)' | grep .rpm | grep "$arch") && rpm=$(grep "$arch" <<<"$rpms") && \ echo Installing "$rpm". && rpm -iv http://mirror.rightscale.com/rightscale_rightlink/latest/rhel/"$rpm" || echo 'RightLink installation failed!'
Alternatively, install a specific version from the mirror (only recommended if a specific reason to not use the latest exists).
The following installs RightLink 5.8.8.
rpm -iv http://mirror.rightscale.com/rightscale_rightlink/latest/rhel/rightscale_5.8.8-rhel_5.8-x86_64.rpm
Run the following command to specify which version of RightLink you installed:
echo -n 5.8.13 > /etc/rightscale.d/rightscale-release
Note: the RightScale BundleWorker requires the SFTP subsystem to be enabled on your instance. This is disabled in many images.
You can usually re-enable with:
sed -i s/#Subsystem/Subsystem/g /etc/ssh/sshd_config && service sshd restart
To create a new AMI from the running instance, click the Bundle button in the Dashboard.
Once the bundle worker has completed the task, view the audit entry and take note of the AWS ID that was used to register the new AMI.
Note: Free space required when bundling an instance-store (S3-based) AMI (the below is not required for EBS AMIs).
You may also need to mount an ephemeral disk if /mnt does not have enough room to store the bundle created (instance-store images have a 10GB size limit). The instance or image you are running must have the correct device block mapping and using an instance type which provides instance storage. You can ensure the first default ephemeral device is mounted using the following (you may need to replace 'sdb' with it's xvd* counterpart):
mkdir -pv /mnt && mount | grep /mnt || mount /dev/sdb /mnt
To perform a compatibility test on the new private RightLink-enabled image that you just created, see Testing your Private RightLink-enabled Image.
In order to properly use the new RightScale-enabled image with ServerTemplates, you should create a MultiCloud Image (MCI) that references the new image. See Create a New MultiCloud Image. The MCI can then be added to any local (HEAD) ServerTemplates in your account. If you need to make that image available in a different AWS region, follow the Replicate an Image to different AWS regions.
Once you've created the MCI, you will need to add the following tag to the MCI so that RightScale will be able to identify the created image as a RightLink-enabled image:
You now have an MCI that points to a RightLink-enabled image for launching RHEL instances. Just like any other instance that's launched using one of our v5 RightImages (which are RightLink-enabled), you will be able to see monitoring graphs and execute scripts inside the Dashboard.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.