Make mothership instance
First we will use your local pc to starting a Fedora 8 mothership instance on Amazon ec2, and creat an AMI image.
- Use the Amazon aws console to start en ami-86db39ef ( amazon/fedora-8-x86_64-v1.14-std ) in zone us-east-1a
-
Create 15+ gb volume by uing the Amazon command line tools. For example 40 gb
ec2-create-volume -s 40 -z us-east-1a
-
Attach your newly created volume to your instanse
ec2-attach-volume vol-a0c985cf -i i-93a448f5 -d /dev/sdh1
Make image
Log into your mothership machine with ssh.
Use a script
You probobly don't want to do this manualy! Insted use the provided awsBuildAmi.sh script.
-
Download and run awsBuildAmi.sh
wget http://bbh-001.boitho.com/es/awsBuildAmi.sh sh awsBuildAmi.sh
↓ Then skip down to export image ↓
Manual method
-
Format your partition(s) and mount them into /mnt. For me that was done with the following:
mkfs.ext3 /dev/sdh1 mount /dev/sdh1 /mnt
-
Make necessary system folders
mkdir /mnt/dev mkdir /mnt/proc mkdir /mnt/etc
-
Make proc system
mount -t proc none /mnt/proc
-
Create a base device setup for the new instance:
for i in console null zero ; do /sbin/MAKEDEV -d /mnt/dev -x $i ; done
-
Create a base fstab file in /mnt/etc/fstab.
cat <> /mnt/etc/fstab /dev/sda1 / ext3 defaults 1 1 none /dev/pts devpts gid=5,mode=620 0 0 none /dev/shm tmpfs defaults 0 0 none /proc proc defaults 0 0 none /sys sysfs defaults 0 0 /dev/sdc1 /mnt ext3 defaults 0 0 /dev/sdc2 swap swap defaults 0 0 EOL
-
Use Yum to install the base of Fedora 8 into /mnt
yum -c http://bbh-001.boitho.com/es/aws.conf --installroot=/mnt -y groupinstall Base yum -c http://bbh-001.boitho.com/es/aws.conf --installroot=/mnt -y remove kernel.x86_64 yum -c http://bbh-001.boitho.com/es/aws.conf --installroot=/mnt -y remove autofs yum -c http://bbh-001.boitho.com/es/aws.conf --installroot=/mnt -y remove NetworkManager-glib.x86_64 NetworkManager.x86_64 yum -c http://bbh-001.boitho.com/es/aws.conf --installroot=/mnt -y remove NetworkManager.i386 NetworkManager-glib.i386
-
Instal the awskeys deamon
yum -c http://bbh-001.boitho.com/es/aws.conf --installroot=/mnt -y install awskeys
-
Instal aws tools
yum -c http://bbh-001.boitho.com/es/aws.conf --installroot=/mnt -y install ec2-ami-tools
-
Clean the yum cache
yum -c http://bbh-001.boitho.com/es/aws.conf --installroot=/mnt -y clean packages
-
Modify the boot script to randomaise root's password:
cat <> /mnt/etc/rc.local # Randomizing the root password if [ -f "/root/firstrun" ] ; then dd if=/dev/urandom count=50|md5sum|passwd --stdin root rm -f /root/firstrun else echo "* Firstrun *" && touch /root/firstrun fi EOL
-
Set sshd to allow remote root connections and not hang on DNS problems
cat <> /mnt/etc/ssh/sshd_config UseDNS no PermitRootLogin without-password EOL
-
Create the networking scripts
cat < /mnt/etc/sysconfig/network NETWORKING=yes HOSTNAME=localhost.localdomain EOL
-
Setup eth0
cat < /mnt/etc/sysconfig/network-scripts/ifcfg-eth0 ONBOOT=yes DEVICE=eth0 BOOTPROTO=dhcp EOL
-
Setup init startup services
chroot /mnt chkconfig --level 2345 avahi-daemon off chroot /mnt chkconfig --level 2345 network on chroot /mnt chkconfig --level 2345 awskeys on # haldaemon is not needed, and may take a long time to start chroot /mnt chkconfig --level 2345 haldaemon off # Dont need printing support chroot /mnt chkconfig --level 2345 cups off # Don't start Kudzu since for some reason it messes up your network settings on first startup of the image. chroot /mnt chkconfig --level 2345 kudzu off # Driver/reader for SCard interface and som cryptografic cards chroot /mnt chkconfig --level 2345 pcscd off # slow to resonde. And not needed because we dont have a console chroot /mnt chkconfig --level 2345 ConsoleKit off # Mouse sopport chroot /mnt chkconfig --level 2345 gpm off chroot /mnt chkconfig --level 2345 bluetooth off
-
Create the missing hostfile
echo '127.0.0.1 localhost.localdomain localhost' > /mnt/etc/hosts
-
Setop correct modprobe
mkdir /tmp/ec2-modules cd /tmp/ec2-modules wget "http://s3.amazonaws.com/ec2-downloads/ec2-modules-2.6.18-xenU-ec2-v1.2-x86_64.tgz" tar -zxf "ec2-modules-2.6.18-xenU-ec2-v1.2-x86_64.tgz" cp -r ./lib/modules/2.6.18-xenU-ec2-v1.2 /mnt/lib/modules/ rm -f "ec2-modules-2.6.18-xenU-ec2-v1.2-x86_64.tgz" rm -rf /tmp/ec2-modules cd - chroot /mnt depmod -a
-
Make sure everything is written to disk and unmount the volume.
sync umount /mnt/proc umount /mnt
Export image
Go back to local pc to export image
-
Make a snapshot of the volume you just installed to, you will need to volume ID that came from step 1
ec2-create-snapshot -d "Searchdaimon ES 2.5 build" vol-id
-
Use the snapshot from the step abow along with the ec2-register command to register your instance
ec2-register -n "Searchdaimon ES 2.5 build" -d "Searchdaimon Enterprise search appliance. Please see http://www.searchdaimon.com/aws/" --block-device-mapping "/dev/sdc=ephemeral0" --architecture x86_64 --kernel aki-e5c1218c --ramdisk ari-e3c1218a --snapshot snap-id
Get it runing
- Launch it
- ssh into it
Searchdaimon ES software
-
Install the Searchdaimon ES software
wget http://bbh-001.boitho.com/es/installEs.sh sh installEs.sh
wget http://bbh-001.boitho.com/es/awsPost.sh sh awsPost.sh
Finished!
That shuold be it. Start it, and follow the instructions on Run ES on Amazon EC2.