Creating CentOS Template For CloudStack


Published on

Creating CentOS templates for CloudStack with VMware/Xen guest tools, password and SSH key management.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Note: If you cant find the exact minor version from the OS drop down list, choose the closest OS type. In this case its 6.4
  • I usually specify the exact name of the ISO for the name and description fields
  • I usually use 512MB 1vCPU offering. The data disk is effectively the “root” disk for your template. Choose its size wisely as CloudStack currently does not offer an easy way to resize your root fs
  • Be sure to customize the OS settings like Timezone, language, disk partitioning, root password etc. In the text installer, its no longer possible to configure network settings in CentOS 6.x. This will be a post install manual task. Please set the default root passwd to something strong. Minimal installer wont allow for package selection.
  • Do the detach ISO quickly so as to prevent the ISO installer from starting once again.
  • Networking: Remove any MAC IDs
  • SSHd would now be runningThe hostname would now match the name you specified while launching the instanceThe IP address of eth0 would match the IP address listed in the NIC details page for the instance
  • The tools package can be installed after attaching the tools ISOTraceroute is a good tool to install by default
  • If present, /etc/udev/rules.d/70-persistent-net.ruleswill stop the network from working correctly if the MAC address changes.
  • Adding a timestamp might be a good idea
  • You might also wish to create templates with different root disk sizes as well.
  • Creating CentOS Template For CloudStack

    1. 1. Creating CentOS Template For CloudStack March 2014 Bangalore CloudStack Meetup @ InMobi Shanker Balan Managing Consultant ShapeBlue India @shankerbalan
    2. 2. @shapeblue “ShapeBlue are expert builders of public & private clouds. They are the leading independent global CloudStack / CloudPlatform integrator & consultancy” About ShapeBlue
    3. 3. @shapeblue Our Customers Enterprises/ devops Service Providers
    4. 4. @shapeblue Register ISO Installer CD/DVD Launch Instance from ISO Install OS Customize / Optimize the Instance Create Template from Instance Register & Share Template Agenda
    5. 5. @shapeblue A “template” is a base OS image for creating new instances CentOS 5.x 64-bit is the default template shipped with CloudStack Templates can be created by admin or by the user directly from ISOs installer Templates can also be uploaded by admin or by the user Templates are Hypervisor specific Xen (VHD), KVM (QCoW), VMware (OVA) Templates are CPU architecture specific 32bit or 64bit CloudStack Templates
    6. 6. @shapeblue Login as ‘Admin’ or ‘User’ Navigate to ‘Templates’ -> ‘Register ISO’ Add download URL to the nearest mirror x86_64-minimal.iso minimal.iso Set to Bootable with OS Type as CentOS 6.4 32bit or 64-bit Register CentOS Installer ISO
    7. 7. @shapeblue Create new instance using ‘Instances’ -> ‘Add Instances’ wizard Choose the ISO and Hypervisor Type Select compute offering Choose data disk size Give it a name OS-version-arch (CentOS65-xen64) Launch Instance and console Create Instance From ISO
    8. 8. @shapeblue
    9. 9. @shapeblue Complete OS Install using the Install Wizard (Anaconda) Language Time Zone Keyboard Disk Partitioning Layout Root password Package selection defaults to ‘minimal’ CentOS Minimal Installer runs in text mode Network configuration not possible in text mode OS Install
    10. 10. @shapeblue Use LVM CloudStack will have root disk resize feature soon LVM will allow for easy expansion Use a simple partitioning scheme / /boot swap Create small sized Swap partition 256MB Disk Layout Best Practices
    11. 11. @shapeblue
    12. 12. @shapeblue Detach ISO from Instance Hit ctrl+alt+del if required from the console Complete Installation
    13. 13. @shapeblue /etc/sysconfig/netwok-scripts/Ifcfg-eth0 DEVICE=eth0 Type=Ethernet ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=dhcp Reboot Enable CentOS Networking
    14. 14. @shapeblue
    15. 15. @shapeblue Install hypervisor tools package XenServer VMware Update the OS Yum update; yum upgrade Install additional packages Openssh-clients, screen, man, traceroute Customize / Optimize
    16. 16. @shapeblue Remove unneeded / insecure packages NetworkManager, NFS, portmapper Remove SSH host keys from /etc/ssh/ Create new guest user with sudo privileges Disable the root user / reset root password Clean yum cache Truncate Logs / shell history Remove /etc/udev/rules.d/70-persistent-net.rules Cleanup CentOS
    17. 17. @shapeblue Cloud-init A set of init scripts for cloud-instances Installed as default on most AWS Linux instances Will automatically set the SSH key for the admin user if instance has an associated SSH key Cloudstack-guest-set-password Will reset/set the admin account password CloudStack Specific Optimizations
    18. 18. @shapeblue Shutdown the Instance Create template from the instance > Volumes > Root Volume tab Set the template name and description CentOS 6.5 Minimal (64bit) CentOS 6.5 Minimal (32bit) Enable password and dynamic scaling options Register CentOS Template
    19. 19. @shapeblue
    20. 20. @shapeblue Create a new instance from the template Mark your template as public Only admin can mark a template as public Create templates for other hypervisors and architectures VMware, KVM, Xen Download more ISOs and create templates Ubuntu Debian FreeBSD Windows Automate with Puppet / Chef / Vagrant / Ansible Next Steps
    21. 21. @shapeblue Template creation in 3 easy steps Register ISO Create Instance from ISO Customize and Optimize Instance Register Root Volume as Template Repeat process for every OS Hypervisor Type Architecture Root Volume Size Recap
    22. 22. @shapeblue Cloud-Init source/ CloudStack Guest Password Scripts Vmware Guest Tools (OpenSource) XenServer Guest Tools Resources
    23. 23. @shapeblue Next Meetup: Creating Windows Templates Q&A @shankerbalan Thank You