Creating CentOS Template For CloudStack

6,710 views

Published on

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

Published in: Technology
0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
6,710
On SlideShare
0
From Embeds
0
Number of Embeds
1,447
Actions
Shares
0
Downloads
0
Comments
0
Likes
9
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. www.ShapeBlue.com @shapeblue “ShapeBlue are expert builders of public & private clouds. They are the leading independent global CloudStack / CloudPlatform integrator & consultancy” About ShapeBlue
    3. 3. www.ShapeBlue.com @shapeblue Our Customers Enterprises/ devops Service Providers
    4. 4. www.ShapeBlue.com @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. www.ShapeBlue.com @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. www.ShapeBlue.com @shapeblue Login as ‘Admin’ or ‘User’ Navigate to ‘Templates’ -> ‘Register ISO’ Add download URL to the nearest mirror http://mirror.leapswitch.com/centos/6.5/isos/x86_64/CentOS-6.5- x86_64-minimal.iso http://mirror.leapswitch.com/centos/6.5/isos/i386/CentOS-6.5-i386- minimal.iso Set to Bootable with OS Type as CentOS 6.4 32bit or 64-bit Register CentOS Installer ISO
    7. 7. www.ShapeBlue.com @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. www.ShapeBlue.com @shapeblue
    9. 9. www.ShapeBlue.com @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. www.ShapeBlue.com @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. www.ShapeBlue.com @shapeblue
    12. 12. www.ShapeBlue.com @shapeblue Detach ISO from Instance Hit ctrl+alt+del if required from the console Complete Installation
    13. 13. www.ShapeBlue.com @shapeblue /etc/sysconfig/netwok-scripts/Ifcfg-eth0 DEVICE=eth0 Type=Ethernet ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=dhcp Reboot Enable CentOS Networking
    14. 14. www.ShapeBlue.com @shapeblue
    15. 15. www.ShapeBlue.com @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. www.ShapeBlue.com @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. www.ShapeBlue.com @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. www.ShapeBlue.com @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. www.ShapeBlue.com @shapeblue
    20. 20. www.ShapeBlue.com @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. www.ShapeBlue.com @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. www.ShapeBlue.com @shapeblue Cloud-Init http://shankerbalan.net/blog/cloud-init-supports-cloudstack-as-data- source/ CloudStack Guest Password Scripts http://shankerbalan.net/blog/cloudstack-guest-scripts/ Vmware Guest Tools (OpenSource) http://open-vm-tools.sourceforge.net XenServer Guest Tools http://www.freshports.org/sysutils/xe-guest-utilities/ Resources
    23. 23. www.ShapeBlue.com @shapeblue Next Meetup: Creating Windows Templates Q&A @shankerbalan http://shankerbalan.net/blog/tag/cloudstack/ Thank You

    ×