Skip to content

Instantly share code, notes, and snippets.

@omaciel
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save omaciel/1fce72b1e020164b47bb to your computer and use it in GitHub Desktop.
Save omaciel/1fce72b1e020164b47bb to your computer and use it in GitHub Desktop.
Install Foretello nightly on EC2
#!/usr/bin/env sh
# Install fortello on to an Amazon EC2 instance. Make sure to set the variables
# in the head of this script.
set -o errexit -o nounset
# Default user for EC2 images is "ec2-user", so switch to "root"
sudo su -
# By default the EC2 instance's hostname matches its internal hostname. The
# fields ${public_ip} and ${public_dns} can be found in the EC2 Dashboard page
# when you select your instance.
readonly public_ip=
readonly public_dns=
# Red hat username, pool ID and password.
readonly rh_username=
readonly rh_poolid=
readonly rh_password=
#-------------------------------------------------------------------------------
# Update hostname to use public dns values
echo "${public_ip} ${public_dns}" >> /etc/hosts
hostname "${public_dns}"
# Check which version of RHEL we got
if uname -r | grep -q el6; then OS_VERSION=6; else OS_VERSION=7; fi
# We need to install a few packages, so let's configure our Red Hat
# subscription and enable a repo.
subscription-manager register --force --username=${rh_username} --password=${rh_password}
subscription-manager subscribe --pool=${rh_poolid}
subscription-manager repos --enable rhel-${OS_VERSION}-server-rpms
yum install -y ntp
service ntpd start
# Update the iptables rules
iptables -I INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
iptables -I INPUT -m state --state NEW -p tcp --dport 5671 -j ACCEPT
iptables -I INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -m state --state NEW -p tcp --dport 8140 -j ACCEPT
iptables -I INPUT -m state --state NEW -p tcp --dport 9090 -j ACCEPT
iptables -I INPUT -m state --state NEW -p tcp --dport 22 -j ACCEPT
iptables-save > /etc/sysconfig/iptables
service iptables restart
# We need these in order to run the installer
yum install -y git ruby
# Clone the installer code
git clone https://github.com/Katello/katello-deploy.git
# SElinux ON
setenforce 1
# Enable repositories and install packages for RHEL
cd katello-deploy && ./setup.rb --skip-installer --os rhel${OS_VERSION}
# Initial configuration with some defaults
katello-installer -v -d \
--foreman-admin-password='changeme' \
--foreman-initial-organization='Default_Organization' \
--foreman-initial-location='Default_Location'
@omaciel
Copy link
Author

omaciel commented Nov 20, 2014

Thanks @Ichimonji10 for the improvements :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment