Convert Centos 6 AMI to Scientific Linux 6 AMI in many many many steps.

One wet and windy evening in Ireland, I decided to see how to convert a Centos AMI to become a Scientific Linux AMI, hopefully these steps may be useful.

Using the AWS EC2 command line tools, launch a x86_64 instance using a Centos AMI ( I’ve used one of the Rightscale Images )

$ ec2-run-instances –region us-east-1 ami-dfc302b6 -k {ssh_keypair} –kernel aki-b4aa75dd -g {security_group} -t m1.large

Login to the instance and run these steps

# cat /etc/redhat-release
CentOS release 6.2 (Final)

# yum remove rightscale
# rpm -ivh http://ftp.scientificlinux.org/linux/scientific/6x/x86_64/os/Packages/yum-conf-sl6x-1-1.noarch.rpm
# rpm -ivh –force http://ftp.scientificlinux.org/linux/scientific/6x/x86_64/os/Packages/sl-release-6.2-1.1.x86_64.rpm

change distroverpkg=centos-release to be distroverpkg=sl-release in /etc/yum.conf and
comment out the bugtracker line.

# yum erase centos-release
# yum clean all
# yum distro-sync
# yum reinstall `rpm -qa –qf “%{NAME} %{VENDOR}\n” | grep CentOS | awk ‘{print $1}’`
# yum remove centos-indexhtml
# yum install sl-indexhtml

# cat /etc/redhat-release
Scientific Linux release 6.2 (Carbon)

Remove CentOS stanza from /boot/grub/menu.lst
Add following stanza to /boot/grub/menu.lst ( note xvda becomes xvde ) ( also note that the kernel may be a later version when you attempt this )

title       Scientific Linux 6.2
root        (hd0,0)
kernel      /boot/vmlinuz-2.6.32-220.7.1.el6.x86_64 root=/dev/xvde2 ro console=hvc0
initrd      /boot/initramfs-2.6.32-220.7.1.el6.x86_64.img

Replace “xvda” references to “xvde” in /etc/fstab

# cat /etc/redhat-release > /etc/motd
# reboot
# rpm -e kernel-2.6.32-71.29.1.el6.x86_64 kernel-devel-2.6.32-71.29.1.el6.x86_64
# cd
# rm .bash_history
# logout

We need to create a new AMI of the instance

$ ec2-stop-instances –region us-east-1 i-c18126a6

$ ec2-create-snapshot –region us-east-1 vol-5c4a8c33
SNAPSHOT    snap-e09b369d    vol-5c4a8c33    pending    2012-04-09T19:04:42+0000        007613502184    8

$ ec2-describe-snapshots –region us-east-1 snap-e09b369d
SNAPSHOT    snap-e09b369d    vol-5c4a8c33    completed    2012-04-09T19:04:42+0000    100%    007613502184    8

$ ec2-register –region us-east-1 -n SL6.2 -a x86_64 -d “Scientific Linux 6.2″ -s snap-e09b369d –kernel aki-b4aa75dd –root-device-name /dev/sda
IMAGE    ami-8b74ade2

$ ec2-run-instances –region us-east-1 ami-8b74ade2 -k {ssh_keypair} -g {security_group} -t m1.large

Andy EI3KF

RHCE / Linux administrator based in Dublin Ireland supporting my employer’s customers operate in the cloud.

I hold full UK ( G0 ), Dutch ( PA ) and Irish ( EI ) amateur radio licences, and currently interested in low-power data communications over HF using Linux